LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

Precision Motor Control using NXT Direct Commands in LabVIEW

Hi All...

 

Apologies if this is re-hashing what I imagine could be an old topic or such, I've not been able to find it if so, hence the post.

 

I am trying to implement a PD controller for a wall follower application for the Lego Mindstorms NXT robots here using LabVIEW 8.5 and the Direct Command Tool sets... at the moment I'm using the Motor Unlimited VI to control Port B and Port C motors as the RHS and LHS motors of my robot. HOWEVER, things don't seem to be working... the robot seems to be continually veering to the LHS irrelevant of what inputs I give the motor... I've even tried hard-coding the power settings to 20% on both motors, which I would have expected to drive it in a straight line, but it still veers to the LHS!

 

So, I am trying to implement some form of more precise or better motor control using the Direct Command Toolset, and am wondering if people could point me in the right direction to start with... I've browsed a few of the discussions, and have seen mention of items such as NXTOutput & NXTOutputMulti Property Nodes, Turning Ratio vs Power Inputs to the Motors, SendDirectCommand.vi and the Fantom SDK, etc etc but am drawing a blank when it comes to finding much in the line of documentation for any of these... am I just looking in the wrong place or something?

 

I've attached the VI I'm currently toying with to run the motors... is there something obviously wrong maybe that I'm doing there either? I can't see an easy way of synchronising the 2 motors to start/move at the same time, even, which strikes me as being something common that people would want to do? 

 

Anywise, Thanks for all the help I'm hoping to get Smiley Happy,

 

Mike.

0 Kudos
Message 1 of 12
(15,061 Views)

Hi all,

 

 

i am having the same problem.

 

i built a car like model and my car doesnt go in a NXT straight line, it tands to go

to the left.

 

what can i do to make the car more precise?

 

i thought about the compass sensor from LEGO but labview dont have a model for

it in the tool kit.

 

 

does anyone have a suggestion?

0 Kudos
Message 2 of 12
(14,581 Views)
Are you sure the wheels are moving at different rates causing the drift?  I've seen some NXT robots whose wheels are not property aligned causing this behavior.  Make sure your LEGO construction is sound before attempting to make a fix with more sensors and more software.  
Mark
NI App Software R&D
0 Kudos
Message 3 of 12
(14,564 Views)

hi mark,

 

 

thanks for the reply, by "property aligned" do you mean if they are in one line? if so than i am sure because the 

built is symmetrical. 

 

 

any idea how to fix this drift?

 

if i build a properly aligned wheeled car i am not suppose to get a drift?

 

 

itai. 

0 Kudos
Message 4 of 12
(14,547 Views)

In a perfect world your program would work... but alas it's not. Due to error in the building process, lego parts are rarely the same size, if ever. Because of this slight error your motors will not run at exactly the same speed causing the drift. One way to achive a perfectly straight line would be with a duel differental drive. There are many examples of this, i can not describe it accurately to you nor can i point you in the dierection of finfing one. I have seen them built with an NXT so i know they are there. I hope this helps.

 

Justin

0 Kudos
Message 5 of 12
(14,520 Views)

hi again,

 

 

i wish to add a compass sensor from hitechnic to the robot car i am building

in order for it to go on a straight line.

 

 

is the compass sensor module in the labview toolkit? i know it have an NXT-G module.

 

 

itai.

0 Kudos
Message 6 of 12
(14,484 Views)

What version of the LabVIEW NXT Toolkit are you using?  The latest version, NXT Module 2009, does include a VI for the HiTechnic compass sensor.

 

 

Mark
NI App Software R&D
0 Kudos
Message 7 of 12
(14,452 Views)

To Irish-XXX

 

You say that you're creating a wall follower (I presume you've created some kind of car that rides next to a wall, and follows that wall). If I would build this kind of car I should made one with the ultrasonic sensor on the left side of the car and then use the information of that sensor to control your left and right wheels. If the distance to the wall increases, the motor of the right wheel should turn faster and if the distance decreases the motor of the left wheel should turn faster. This can be controlled by some kind of PID-controller. 

 

Is this an option for your problem? 

 

 

To itaibd

 

Maybe a simple solution but have you ever tried to make your left motor turn slighty faster then the right one?

Message Edited by Brandts on 05-04-2010 07:16 AM
0 Kudos
Message 8 of 12
(13,132 Views)

Use a close loop control algorithm to make your robot move straight. Do not just command the motor with direct signal. There are no 2 identical motors in the world, so you will still see this even when you use the most expensive motor

0 Kudos
Message 9 of 12
(12,651 Views)

Hi ,  There is  example  in the  nxt/example/motor/Straight_Line_PControl.vit

 

 

this  takes the   differece  in the position  of the encoders on each of the motors.   Will this  resolve your problem?

0 Kudos
Message 10 of 12
(12,314 Views)