LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

Direct Commands / Rotation Count

    Hi All!

I know that this question was already posted before, but i can't use the solution proposed there.

With this first version of the NXT Toolkit, it is only possible to use the "motor unlimited"-VI (with direct commands). It is not possible to specify the rotation count (in degrees). Will this feature be available in future versions of the toolkit or can somebody tell me how to implement it in this version? I can't use the solution proposed in the threat already posted because, at high speed, the motor doesn't stop early enough.

Thanks for every help!

Christian

THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 1 of 12
(12,476 Views)
I was wondering about the same thing.
So I started to mass around with SentDirectCommand.vi. In the 'Appendix 2-LEGO MINDSTORMS NXT Direct commands.pdf' you can read all about it.
In the attached file is a small program I wrote to rotate you A-port 1000 deg.
I'm now busy with a larger program to synchronize A and B. I think it is also possible to ramp-up when the motor starts and ramp-down wen it approaches it's tarret deg (by adjusting real-time it's power input)
0 Kudos
Message 2 of 12
(12,456 Views)
I made a small mistake.
This program works better.
0 Kudos
Message 3 of 12
(12,451 Views)
    Hey, great Code! Thanks very much! I hadn't read the PDF before as its not linked on the NI Website. I found it on the Lego Website...with this document and the fantom-vis, its a great solution!!

Thanks!!!

THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 4 of 12
(12,436 Views)

I tried your get&set output state portA. vi using 7.1.1. I liked that you have given the inner workings of the process although we cannot see inside the fantom vis. (Reminds me of the the Phantom of the Opera which is showing here right now).

When I run the vi, BT connects and I can see the battery level but the rest doesn't respond. The motor dosen't run at all although I have entered a Distance. Then when I turn the motor by hand, the Rotation counter readings appear.

The set output port doesn't seem to work correctly. How does one send the distance info so the motor will move accordingly? 

 

 

0 Kudos
Message 5 of 12
(12,381 Views)
cssoh,
Strange on my computer its working fine.....
Try the reset and restart button, i can not think of somethink else only to try this other attachment I have added
It is possible to look inside the fantom.vi. I have downloaded this file (fantomSDK1.0.2f0.zip) from this site (http://mindstorms.lego.com/Overview/NXTreme.aspx).
This zip file contains the unprotected fantom.vi and lost of other protected files.
 
I have added an other file to this reply. It is, like the program in my previous reply, a program to set a distance. it synchronizes the start and the run of the a and b port. it ramps up and down. It is not yet finish, there are still some small error (like the reset button is acting strange) but i did not yet had the time the complete the subvi.
 
w.k.g,
Andries
0 Kudos
Message 6 of 12
(12,377 Views)
Thanks. After studying the fantom sdk, I've figured how to make the motor move by degrees using the sendDirectCommand. This is accurate and repeatable. If you enter degrees=0, the motor will run forever (like Motor Unlimited). The VI is attached.
0 Kudos
Message 7 of 12
(12,338 Views)
Yes, "Fantom_MotorMovebyDegrees_2007apr17.vi" can work,but it is does not what we really need.
We need motor rotates a degree and STOP at that degree!
 
Anyway,thanks guys working for this:) 
0 Kudos
Message 8 of 12
(12,291 Views)
uowNXT:
Did you, or for that matter, has anybody gotten it to "go to a certain degree and stop"?
 
Thanks!
 
--
Jairo
0 Kudos
Message 9 of 12
(11,885 Views)
Yes but, the bluetooth communication with the NXT is slow. The rotation update is to late to accuratly drive the servo untill a certain degrees. The internal communication in the NXT is much quicker. You can better focus on the "mailbox messages" function of the NXT.
0 Kudos
Message 10 of 12
(11,877 Views)