LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to structure sending two different arrays when different buttons are triggered

Solved!
Go to solution

I am looking for some ideas on what might be the best way of sending two different arrays based on the button trigger that is pushed. The ideal goal would be when an initiate button is pushed it will trigger the top array in the picture to send commands to a UDP address. After that array finishes I would hit a start button and the second lower array would start sending the information to the same UDP. The major problem I face is if the UDP address is not getting continuous values it will close and the device we are sending this information to will go back to a parked position. If I want it to stay at a neutral position I have to always be sending it zeros or a movement command. Appreciate any ideas! image.png

0 Kudos
Message 1 of 5
(462 Views)
Solution
Accepted by topic author LunarSurface13

Hi Lunar,

 


@LunarSurface13 wrote:

The ideal goal would be when an initiate button is pushed it will trigger the top array in the picture to send commands to a UDP address. After that array finishes I would hit a start button and the second lower array would start sending the information to the same UDP. 

If I want it to stay at a neutral position I have to always be sending it zeros or a movement command. Appreciate any ideas!


Use a state machine!

  • In the first state you send the first arrays.
  • When state 1 is finished you can send the 2nd array.
  • When you press the "neutral position" button you switch to state 3 to send "zeros"…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(430 Views)

@LunarSurface13 wrote:

I am looking for some ideas on what might be the best way of sending two different arrays based on the button trigger that is pushed. The ideal goal would be when an initiate button is pushed it will trigger the top array in the picture to send commands to a UDP address. After that array finishes I would hit a start button and the second lower array would start sending the information to the same UDP. The major problem I face is if the UDP address is not getting continuous values it will close and the device we are sending this information to will go back to a parked position. If I want it to stay at a neutral position I have to always be sending it zeros or a movement command. Appreciate any ideas! 


 

You show an useless image of some very messy partial code that shows several "arrays" (some as diagram constants and some from a file read) and no "buttons" in sight (which seems to be the point of your question). There is also no UDP communication shown, so how exactly are you expecting us to help you?

 

In the subject you are talking about sending two different arrays, but in the body text you talk about the major problem with UDP communication. Also define what you mean by "continuous".

 

UDP is a connectionless protocol and as long as somebody is listening at the target IP, it will be received. So maybe the problem is on the other side if that's not the case.

 

I recommend:

 

  1. clean up the code
  2. Attach you VI
  3. explain exactly how you are using it and what you expect to happen
  4. Describe the format of the UDP packet expected by the receiver.

 

 

0 Kudos
Message 3 of 5
(398 Views)

oops i was wrong

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 5
(377 Views)

We have this code running a motion profile on a motion platform. Very simple code that grabs a text file and sends the movements over UDP and it also grabs joystick inputs. I need to add an additional movement before the motion profile begins. I need to slowly ramp up the heave movement of the motion platform from a parked position to a neutral position so that when the code is initiated it does not try to jump to the neutral in less than a second. 

 

I am going to try to rap all of this into a state machine so I can add a neutral button for the initial heave movement and then still have a start and stop button for the motion profile movement. 

0 Kudos
Message 5 of 5
(356 Views)