NI Home > Community > NI Discussion Forums

LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

Showing results for 
Search instead for 
Do you mean 
Reply
Member
Birrel
Posts: 3
0 Kudos

Absolute position NXT motor

Hello,

 

Is it possible to send the NXT motor to an absolute position? I want the motor to act as a servo so that i can use it to steer an rc car.

 

 

 

Member
cedhoc
Posts: 193
0 Kudos

Re: Absolute position NXT motor

Hello Birrel,

 

There is only relative position sensor on NXT motor. So, you have to first set a reference position if you want to use absolute positioning.

 

You have two possibilities to set the reference position:
- either you fix the reference position as the starting position (which is not the most convenient solution)
- or, if your motor can move within a given mechanical range with a min and a max position (as it is the case for steering purpose), you can find those limits at the begining of your program and then decide to fix a reference position somewhere in that range (probably in the middle in your case).
You can easily find the mechanical limits by running the motor and monitoring the position. If the position does not change in a (small) amount of time, you have reached a limit.

Cédric | NI Belgium
Member
Birrel
Posts: 3
0 Kudos

Re: Absolute position NXT motor

Hello,

 

Thank you for your answer. I had figured out something like that, but have some troubles to program it. I am totally new in Labview and NXT and rely on existing programs. Do you know if there is an example somewhere. I have found the PI controller and do only have to program the limits.

 

Kind regards,

 

Frank.

Member
cedhoc
Posts: 193
0 Kudos

Re: Absolute position NXT motor

Hello Frank,

 

As I told you, you can easily find the limits by running the motor and checking when the position is not evolving anymore. Once that happens, it means that you have found one limit. Then you can do the same in reverse direction to find the other one.

 

Here is a simple example I quickly did to find one limit:

sr_1156910.jpg 

Disclaimer: The example Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

 

 

From there, you should be able to find the other limit and compute the center.

 

Does this reply to your need? 

Cédric | NI Belgium
Member
Birrel
Posts: 3
0 Kudos

Re: Absolute position NXT motor

Hello,

 

Thank you, this is what I was looking for. Can you also tell me a way (probably a shift register) to store the value cause I also have to do a move the other way to determine the middle of the steering unit. Can this also been done by using sequential programming (the filmstrip)? I am normally a plc programmer so Labview programming is totally new for me and I have to use examples.

 

Kind regards,

 

Frank.

Member
cedhoc
Posts: 193
0 Kudos

Re: Absolute position NXT motor

Hello Frank,

 

The limit is already stored in a shift register! You can simply copy the example above a second time and you will have two shift registers with your two limits (but don't forget to change the motor direction and to remove the second "Reset Rotation" node).

Cédric | NI Belgium