LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

Servo Motors: Precision and Moving Backwards

I am using the NXT kit with LabVIEW to create remote-operated devices that control the one-dimensional movement of an object. The idea is that a user should be able to set a position on his VI interface and the robot should move to that position, ideally with a precision in millimeters.

My first question is easy:
How do I make a motor run backwards with direct commands?


The other part isn't so easy:
When using direct commands to set the motor state, especially if I try to use TachoLimit to control the distance moved, the distance that the robot moves (as driven by one motor with an axel through the middle and a wheel on either side) is highly variable. I'm lucky to get within 4 cm, much less 1 mm. This occurs with speed regulation and without speed regulation, with braking and without braking, regardless of what amount of power I give the motor. When I use the Mindstorms software, I seem to get much better results.

How do I achieve precise motor movements with direct commands?
0 Kudos
Message 1 of 17
(11,159 Views)
I have done very little with direct commands.  With that caveat, try using a negative power value to make it go backwards.
Message 2 of 17
(11,156 Views)
Thank you, negative power worked. Now, does anyone know how to achieve precision?
0 Kudos
Message 3 of 17
(11,129 Views)
We took a look at it and it looks like precision motion may not be possible over direct commands. There were some technical reasons why we were unable to provide a a "motor distance" direct command.


Joel Sumner
NI-Shanghai
0 Kudos
Message 4 of 17
(11,102 Views)
Hmm, okay, thanks. I guess I'll just make several small NXT programs for certain distances (e.g. 2.5 mm, 5 mm, 10 mm, 20 mm, 40 mm), then call them in various combinations whever motion is requested.

Out of curiousity, why is it that the precision motion cannot be made to work by direct commands?
0 Kudos
Message 5 of 17
(11,099 Views)
My guess is that it is because of the direct link with the computer.. I think the computer or the connection can't keep up with the speed of the motor..
that being said, I can't get precision with the other kind of programming (I forgot the name) the brick either...
0 Kudos
Message 6 of 17
(10,742 Views)
If you're building blocks to run in NXT-G, you should be able to get very precise movement.  I don't have LabVIEW on this computer, but the names of the vi's from the NXT Toolkit are something like Move Distance and Motor Distance.  Just make sure you have the motor braked and not floated.
0 Kudos
Message 7 of 17
(10,738 Views)
I am building it in Labview... But it shouldnt matter..
for example:
If I tell the program to move the motor 60 degrees at a power of 75, it has loads of overshoot.. and I can't seem to get to motor to turn TO a specific angle instead of for a x amount of degrees.

0 Kudos
Message 8 of 17
(10,735 Views)
I'm not sure what you mean by your building it in LabVIEW.  There are two ways to control an NXT using LabVIEW.  The first is by direct commands, where you build  a vi and immediately run it on the brick.  Based on Joel Sumner's comment above in this thread, you can't get precision motor movement this way. 

The second is to build a series of vi's which are then imported into NXT-G to create a custom block.  Doing that, you should be able to control the motors very precisely.  In NXT-G (either with or without a custom block), if you want the motor to go to a specific position, reset the rotation counter and then move the motor + or - until it reaches the rotation counter value (0) + whatever angle you want.  Until you reset the rotation counter again, you can use the same method to go TO whatever angle you want.
0 Kudos
Message 9 of 17
(10,731 Views)
ah!
That clarifies a lot!
Then I am indeed very puzzled as to why you can't get precision motor control with direct commands in labview... basically, the blocks have the same functions dont they?
Also, I dont think that way of using the motor will work... because then you can still only tell the motor to turn a specific amount of degrees, with no feedback..
because the motors are servo's, shouldnt there be some kind of regulation that if it goes to far, it corrects itself?


0 Kudos
Message 10 of 17
(10,727 Views)