LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Servo motor with a trapeze of velocity

Solved!
Go to solution

Hi, I am trying to control a servo motor with a trapeze of velocity by NI 7330. After pressing a "start" button, the velocity will start from 0 with a acceleration, go to a constant speed, stay there for some seconds then go down with a desaceleracion.

 

I have search the forum but samples I found are too complex. For me, the hardest part is "start" button. If it is in python, it is like: "if t <  ... ; v =...- else if... - else ....". But I dont know how to do the same thing with LabView.

 

Sorry for my bad english. If there is any help/examples/documents I would be very appreciated. Thanks!

0 Kudos
Message 1 of 7
(2,257 Views)

Hi Giang,

 

For me, the hardest part is "start" button.

So your VI should wait until you press that Start button? Use an event structure…

 

If it is in python, it is like: "if t < ... ; v =...- else if... - else ....". But I dont know how to do the same thing with LabView.

The IF-THEN-ELSE is a case structure in LabVIEW…

 

(It seems you should take the Training resources offered in the header of this LabVIEW board…)

Best regards,
GerdW


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

The term I have always heard and used for such a profile of Constant Acceleration, Constant Velocity, Constant Deceleration, particularly where the Start and End Velocity is zero, is a "Velocity Trapezoid".  It is fairly easy to work out the timing of the stimulus waveform, particularly if the position is not constrained (in my case, I was using this stimulus to "Move from Position A to Position B", which effectively puts a maximum on the allowed Acceleration and/or Velocity values).

 

Do learn more LabVIEW, particularly the material covered in the Tutorials listed on the first page of this Forum.  You will learn about Event Loops, which are excellent ways to "Do Something When I Push This Button".  You may need to learn "more than you are ready to absorb", so a good strategy is to find a colleague, a teacher, a LabVIEW Guru whom you can consult who can help you organize the "facts", "structures", and "functions" of LabVIEW into an intelligently-designed Program (VI).

 

Bob Schor

Message 3 of 7
(2,212 Views)

After searching online for what you say, I finally make this VI. I hope it work!

Thank you for information, do you have any advise for my VI?

0 Kudos
Message 4 of 7
(2,185 Views)

thank you, I will go to tutorials section now.

0 Kudos
Message 5 of 7
(2,181 Views)

Yes, I have advice for your VI.  Attach the VI rather than a "picture" of it -- it wastes too much of my time opening a Picture, then not being able to "see" the other Cases, adjust wires, test the logic, etc.

 

Bob Schor

0 Kudos
Message 6 of 7
(2,155 Views)
Solution
Accepted by topic author GiangNH

Hi Giang,

 

do you have any advise for my VI?

  • Cleanup the block diagram. Use AutoCleanup…
  • Use appropriate datatypes: don't use a DBL to sump up your "Time Count". Use U32 (or U64)…
  • While there is a reason to create its own "Time count" you could also place a TickCount function before the loop and subtract its output from the output of "Wait until…" to get your "Time count"…
  • When you wire a value to the selector ofa case structure you can also read the selector inside the case. No need for an additional tunnel ito the case…
  • Do you really need to configure your outouts every 10ms, 100 times a second? Really?
  • Instead of 3 Divide/Multiply functions (inside the case) you could employ just one CompoundArithmetic function…
  • Why is the loop inside the case structure set to run forever? How will you stop your VI?
  • What's the point of the outer case structure? It will ALWAYS be calles with a TRUE input…
Best regards,
GerdW


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