From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Interface For Arduino: Very Slow Angle Actuation of Servo Motors

I have my labview vi control panel and block diagram panel printscreens (labview 1,2,3 and 4) with the Labview Interface for Arduino  The Labview is the receiver while the Python code(3d hand tracking) is the sender through UDP. Whenever the python send sets of angles,take note that the angles are varying in some fractions of time, the labview with the arduino and servos connected didnt actuate according to the varying time of the sender ..the servos wait 1 sec to actuate and this is very slow compare to the real varying time of angles from the sender ..this is our problem..

 Thanks for the help!

0 Kudos
Message 1 of 11
(3,222 Views)

Hi Audrey,

 

what is the purpose of the wait function inside the timeout event?

Why set a timeout time of 1ms and waiting 100ms in the event case???

 

You want to handle UDP messages as fast as possible, so don't wait!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(3,183 Views)

What are the other event cases you are handling with the Event Structure.  You might be able to not even have the Event Structure and simplify your diagram, but that depends on what the other cases do.

 

As Gerd already stated, that 100ms wait is not needed.  The other concern I have is the Wait Forever on the UDP Read.  That will lock up your program if data is not being sent by the other system.  Set the timeout to be 100ms and handle any errors you see.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 11
(3,152 Views)

Good day .. I have modified the block diagram ..but the output is still the same.. Hope you can help me ..See the printscreen .

Download All
0 Kudos
Message 4 of 11
(3,053 Views)

Hi Audrey,

 

how often do you receive UDP messages? What is the "sample rate" here?

 

Btw. what happens in the "Error" case? Are you outputting a zero then? Is this behaviour intended/needed?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 11
(3,047 Views)

Thanks for the help sir .. The Python sends sets of angles(angles of yaw,pitch and roll) to the Labview in some factions of seconds .. but the servos waits 2 seconds to actuate every angles ,one after another  which is very slow..But ,whenever I remove the arduino from the pc, the labview graphs angles with respect to time accurately ,which is the ideal output .Hope you understand .I'll wait for your response guys and thank you in advance!

 

i have provided a video but I saved it using my facebook account..you can visit 

Fist video : the arduino is connected

https://www.facebook.com/EuNico105/videos/vb.100002514763187/1405209926239486/?type=3&theater

 

 

2nd video: the arduino is not connected

https://www.facebook.com/EuNico105/videos/vb.100002514763187/1405214186239060/?type=3&theater

 

0 Kudos
Message 6 of 11
(3,042 Views)

Hi Audrey/Eugene,

 

unfortunately Facebook is blocking access to your videos - atleast for non-members…

At the second try the video was visible. You really need to improve the video quality…

 

But ,whenever I remove the arduino from the pc, the labview graphs angles with respect to time accurately ,which is the ideal output .

So your VI is getting slow whenever you communicate with your Arduino? And is runs fast without that communication?

So I see two things:

- Arduino communication is maybe slower than you would think.

- You may try to use some kind of producer-consumer-scheme to separate faster processes from slower ones…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 11
(3,035 Views)

Im sorry for the low quality video sir .. Hope you see the graph and values 

Can you help me with this??

--You may try to use some kind of producer-consumer-scheme to separate faster processes from slower ones…--

0 Kudos
Message 8 of 11
(3,029 Views)

Hi Eugene,

 

see this!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(3,023 Views)

Thanks GerdW for the help but what is the significance of this producer-consumer concept to my problem? Thanks for the help !

0 Kudos
Message 10 of 11
(3,019 Views)