Quote:
Originally Posted by bladetech932
A motor not moving is a quality of the gears not the program. you cant do anything without burning up the motor
|
This is just not true.
Quote:
Originally Posted by cilginbilgin
If I dont want CIM motor to be locked (I mean I dont want it to move even if someone tries to move it) what can I do in my code.
I dont think I can do something like that but my friends insist.
|
There are a couple of solutions to this.
First to be sure I am understanding what you guys want to do: When the robot is stopped you want the robot to resist being pushed, correct?
The first and simplest step is to move the jumper on the speed controllers from coast to break. When you spin an electric motor it becomes a generator, this jumper configures the speed controller so that when you spin the motor (by pushing the robot) the motor leads are shorted and the motor resists being pushed. This will prevent the robot from rolling, however if you push it hard enough it will still move (if you can overcome the friction).
The other solutions are more complicated. You can uses the Accelerometer and Gyro to detect changes in position that occur when they shouldn't. If the robot is not receiving commands to move then have it monitor the gyro and accelerometers. If the Gyro or Accelerometers show that the robot is moving then have the bot try to oppose that motion by driving or turning towards the force (in the opposite direction of the motion).
This will get you some of the results you want, but I warn you, it wont be perfect, and in my experience it is more trouble than it is worth.
Edit: This combined with your other thread that I just repiled to makes me think that you are trying to do this with a motor on an arm, not with the drive motors. If this is the case your PID control (that you are working on in the other thread you created should handle this pretty well, if it is in one position it should stay there even if you try to move it.