Hi - im working on a project that requires quite accurate motor positioning relative to degrees of rotation. In NXC.
I have an NXT ServoMotor (standard) that I want to rotate in increments of wither 90, 180, 270, or 360 degrees. I made the model so that the motor directly drives the item in question, thinking it would keep the programming simple. So I set the motor to rotate 360 degrees, and to my surprise it rotated about 400. I ended up with this to get 360 degrees.
ResetTachoCount(SPINNER);
RotateMotor(SPINNER, 50, 341);
Is this normal for NXT Servo motors? and if so, is the only way to get accuracy to use additional sensors? Does gearing down reduce errors , or does it just introduce more "play" in the system and accentuate them over time (before I try I want to avoid a major rebuild of this component)
[NXC] Servomotor position degrees - accuracy, or lack of...
Re: [NXC] Servomotor position degrees - accuracy, or lack of...
The software tends to keep track of the motors as soon as they are switched on. I found that that if I moved a motor manually before running a program, the program would set the motor back to where it was before I moved it then apply the movements in the program.
I found it best to reset the motors inside the program before commanding any movements.
I found it best to reset the motors inside the program before commanding any movements.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Re: [NXC] Servomotor position degrees - accuracy, or lack of...
Indeed - that's why I showed in my post that I'm using resettachocount before each command. I'm now looking at using a touch switch on a cam but I'd still be interested to hear if the innacuracy I'm experiencing is normal. I get it from the moment I turn on the robot.
Re: [NXC] Servomotor position degrees - accuracy, or lack of...
Please try this:dodgey wrote:Indeed - that's why I showed in my post that I'm using resettachocount before each command. I'm now looking at using a touch switch on a cam but I'd still be interested to hear if the innacuracy I'm experiencing is normal. I get it from the moment I turn on the robot.
Code: Select all
ResetAllTachoCounts(SPINNER);
Wait(1);
RotateMotor(SPINNER, 50, 360);
// if you want, do this to verify the tacho count:
// Wait(100);
// use NumOut or whatever to display TachoCount(SPINNER)
The Wait(1) is to commit the changes to the firmware before starting the rotation, and there are 3 tacho counters and 1 "tacho goal" that should be cleared before starting a movement.
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
Re: [NXC] Servomotor position degrees - accuracy, or lack of...
OK, I tried different ports and different motors, and I included your suggested code to reset the tacho counts and wait.
It makes no difference, and also, I've discovered it is speed related
If I turn the motor 360 degrees at speed 60 it turns too much and reports the tacho count of 385
If I slow it to 40 I get 378 degrees
I have to slow it to around 20 to get 361 degrees (whcih is too low power for my application)
I've tried issuing a stop command directly after. No difference
It makes no difference, and also, I've discovered it is speed related
If I turn the motor 360 degrees at speed 60 it turns too much and reports the tacho count of 385
If I slow it to 40 I get 378 degrees
I have to slow it to around 20 to get 361 degrees (whcih is too low power for my application)
I've tried issuing a stop command directly after. No difference
Re: [NXC] Servomotor position degrees - accuracy, or lack of...
Update - Got it! I was on NXC Firmware 128 and started testing PID motor control with no change, then I updated to the NXC 131 FW and it works a treat - the motor flies round then corrects itself
Who is online
Users browsing this forum: No registered users and 6 guests