LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

Servo Motors: Precision and Moving Backwards

The NXT firmware contains what you are looking for in the form of a PID algorithm.  I don't know anything about how LabVIEW direct commands are implemented, but I assume they don't utilize this functionality in the firmware. 

When building NXT-G blocks in LabVIEW, you can receive input from any sensor in your vi's.  If you can get input from the built in rotation sensor with direct commands (which I thought was possible), you should be able to turn on the motor, wait for the rotation sensor to reach your desired value and turn off the motor.  If you want true precision, you can loop the motor + or - until you get the exact reading you want (+/- 1 degree, which is the accuracy of the built in rotation sensor)..
0 Kudos
Message 11 of 17
(4,879 Views)
If you can get input from the built in rotation sensor with direct commands (which I thought was possible), you should be able to turn on the motor, wait for the rotation sensor to reach your desired value and turn off the motor. If you want true precision, you can loop the motor + or - until you get the exact reading you want (+/- 1 degree, which is the accuracy of the built in rotation sensor)

That was what I thought too, it simply doesn't work for me. There's always either enough power that it overshoots unpredictably or insufficient power to complete the movement. By loading programs to the brick and then using LabVIEW to activate them, however, we are able to get consistent precision. (For example, to move 8.5 cm forward, we would run the "for1cm" program 8 times and the "forhalfcm" program 1 time.)
0 Kudos
Message 12 of 17
(4,877 Views)
Hey

If you have bluetooth, you can make a program, that receives bluetooth-commands, running in loop on your nxt, and then send Bluetooth-commands from the computer.
I haven't fully read the previous  posts, so maybe it have been suggested before. Anyway, if you have a bluetooth, i am sure it will work for you.

I newer use direct-commands myself, i always makes this program-layout.

/Steffen
------------------------------
LabVIEW 2009 and 2011 user, with LabVIEW toolkit for Lego Mindstorms NXT.
0 Kudos
Message 13 of 17
(4,843 Views)
Hello,

Can you please elaborate on your last post about "loading programs to the brick and then using LabVIEW to activate them"?  What do you mean by activate? Is it possible to invoke an NXT program that has been downloaded to the NXT brick from a LabView vi? Or are you just literally using the Compile, Download and Run function from the tools menu.

I'm quite new to LabView and the NXT.  I'm also hoping to be able to control the motors with precision but from what I've read that seems to be difficult using the direct commands. I'd like to create a program that will be able to control the motors as well other components such as a CCD camera.  Not sure if it's possible to integrate non-lego components but if I could create a program that will only call upon NXT programs when they are needed that would be ideal.  Have I interpreted correctly? Is this what you have been able to do?

Thanks a bunch!
0 Kudos
Message 14 of 17
(4,837 Views)
My solution consist of tow things:
1) A "master"-program on the computer with user-interface, that sends bluetooth-commands to the nxt.
2) A "slave"-program that executes the retrieving commands.

To get it work well, quite a bit of programming has to be done, but it seems like you have some ambitious plans, so i think you can do it.

You can not use the USB cable, you have to setup an bluetooth-connection. You can use directcommands, as a initial task in the master-program, to start the "slave"-program on the nxt, but then it is wise, not to make directcommands while running the slave-program.
------------------------------
LabVIEW 2009 and 2011 user, with LabVIEW toolkit for Lego Mindstorms NXT.
0 Kudos
Message 15 of 17
(4,833 Views)
What do you mean by activate? Is it possible to invoke an NXT program that has been downloaded to the NXT brick from a LabView vi?

Yes, this is what I am doing. I have attached a picture showing how to do this.



I'd like to create a program that will be able to control the motors as well other components such as a CCD camera. Not sure if it's possible to integrate non-lego components but if I could create a program that will only call upon NXT programs when they are needed that would be ideal. Have I interpreted correctly? Is this what you have been able to do?

I'm not clear on what a CCD camera is, but I'm guessing it's not related to the Lego stuff at all. Assuming this to be the case: A LabVIEW VI that uses both Lego devices and non-Lego devices is as easy to make as would be a VI for just non-Lego devices or a VI for just Lego devices. If you can control two unrelated things with LabVIEW at all, you should be able to control them both with the same VI.

Message Edited by DJDDA on 05-28-2008 01:53 PM
0 Kudos
Message 16 of 17
(4,814 Views)
Thank you DJDDA!! That is exactly what I was looking for.  I guess I just didn't browse those direct commands thoroghly enough.  🙂 I'll give it a shot an see how things go.

Thanks also to whoever responded earlier about the Bluetooth solution.  Unfortunately, I don't have that capability but it certainly looks like another logical solution for triggering programs loaded on the brick.




0 Kudos
Message 17 of 17
(4,808 Views)