If I 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.
If I 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.
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.
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.
This is just not true.
Actually he asked about code that would essentially turn the motor to brake mode, and you can’t (short of adding an accelerometer) do it in the code.
but yes the jumper will work for stoping that motor from moving.
I asked the electronical guy about that jumper thing but he seems he doesnt know about it. I assume I am not going to do this jumper thing in my code but in the electronical circuit of the robot.
If you can tell me how to move the jumper I would be very pleased.
Thanks for your help!
If you are using CAN you can actually turn on/off the braking in software with no hardware changes, ignoring the jumper position.
If you are using PWM to control the motors:
Looking at the Jaguar motor controller, to the right of where you plug in the PWM cable there are three pins with a jumper. if you put the jumber on the two pins to the right (these should be signal and low) the controller is in brake mode. I do not have a controller in front of me to see the specific labelling but if my directions are not clear enough go to the Jaguar site http://www.luminarymicro.com/jaguar and you can look at there instructions in the geting started file.
What he is really looking for is closed loop control which is not only possible but is a huge part of control systems engineering. It is pretty common in control and automation to build a system so it resists positional changes due to the environment.
Also it is worth noting that you can infact break a motor using software. If you use CAN there is a function to switch between break and coast. If you use PWM then you can connect the signal wire from a digital out to the center pin on the Brake/Coast jumper and control braking that way.
Thank you James! I got it!