04-30-2012 05:01 AM
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.
05-01-2012 01:09 PM
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.
05-04-2012 04:39 AM
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:
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?
05-06-2012 11:37 AM
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.
05-07-2012 02:07 AM
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).
03-14-2016 03:20 PM
Hello cedhoc and everyone,
Another noob question..
I understand your code but how make it run once in LabView ( Similar to setup loop in text programming). I want to reference the motor once, in the begining, and then just use absolute position.
Thanks in advance!