How to hold the position of a motor (NXC)?
-
- Posts: 4
- Joined: 17 Mar 2011, 08:12
How to hold the position of a motor (NXC)?
how to hold the position of a motor by using NXC? like, if i want to make a robot arm, and use it to hold an object. if i use the command "Off(OUT_A)", the position of the motor can be held, but the force is not strong enough. if I use the command "OnFwd(OUT_A, 100)", the motor will give an force on the object, but it might break the object. furthermore, will the motor itself be broken if it is stuck for a long time by the object? So what's the correct way to make the motor to hold the certain position with certain force?
-
- Posts: 224
- Joined: 30 Oct 2010, 04:10
- Location: 127.0.0.1
- Contact:
Re: How to hold the position of a motor (NXC)?
Edit: use linusa's info instead
Last edited by timpattinson on 09 Aug 2011, 10:36, edited 1 time in total.
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
Re: How to hold the position of a motor (NXC)?
Try this:
This is really strong, and consumes quite a lot of power, but it's "not a hack" and safe for the motors (even if they get a bit warmer). The motors have thermal over-heat-protection by the way. You can release this brake again using Coast().
Edit: P.S.: The MotorBrake() function might be the same as Off(), but there's a good chance it's stronger. Can't try it at the moment, please do try it for yourself.
Code: Select all
safecall void MotorBrake(const byte &port) {
//Enables active braking for a motor...
SetOutput(port, Power, 0,
OutputMode, OUT_MODE_BRAKE + OUT_MODE_MOTORON + OUT_MODE_REGULATED,
RegMode, OUT_REGMODE_SPEED,
RunState, OUT_RUNSTATE_RUNNING,
UpdateFlags, UF_UPDATE_MODE + UF_UPDATE_SPEED); // + UF_UPDATE_TACHO_LIMIT);
}//end MotorBrake
Edit: P.S.: The MotorBrake() function might be the same as Off(), but there's a good chance it's stronger. Can't try it at the moment, please do try it for yourself.
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
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: How to hold the position of a motor (NXC)?
Try looking into APR, which is a fairly new feature. It is now completely implemented into NXC and John's EFW. I haven't used all the features of it, but it seems to work great for everything I have needed it for so far (with NXT motors). For non-NXT motors (with the built in encoders), I made my own PID motor control loops so that I could input the position with a different sensor (like the RCX rotation sensor).
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Who is online
Users browsing this forum: No registered users and 0 guests