My team is building a VEX Spin-Up Robot, with a four-wheel drive train (green motors). When they run the robot straight and release the run button, the robot tends to push forward and tends to tip over a little before completely stops.
Did you know how to code the robot so it has a smooth stop after a movement?
If the robot tips upon stopping then your drive motors are most likely set to hold or brake, alternatively you could have stick drift to where its always reversing just enough to make it full on stop
But if its during an auton then you need PID which you can just copy paste from someone else
The simplest solution would be to check if all your controller axis are zero and if so set your motors to coast. It will look something like this
while (1){ // Drive control loop
if (controller1.axis1.position() == 0 && controller.axis2.position() == 0){
motor.stop(coast);
}
}
This isn’t the best solution because your robot will drift far after the joystick values stop. The best solution would be to lower your center of mass so that your robot doesn’t want to tip over. You should try various methods and record them in your engineering notebook
@Glucose_Gaurdian is right about the brake type of the motor. VEX motors have three types of brake modes in software. These are what the motor will do when you as the programmer are no longer supplying power.
BRAKE - This applies internal mechanical resistance to hold the motor’s position
HOLD - This tells the motor to use power to prevent the robot from moving. This is stronger than BRAKE
COAST - This allows the motor to continue turning until friction naturally stops it. This is what you want to solve your problem
Also, if it tips when it stops, then the center of gravity could be off center of the robot. Is there one side of your bot that is heavier than the other?
One way you could also fix this besides all of the previous ways mentioned would be to redesign the drive base to be longer or use smaller wheels (lowers center of mass + can move further out)
Good luck solving your problem!
To my understanding, Brake mode tells the motor to try not to turn, Hold tells the motor to return to the position it stopped at if it is moved, and Coast tells the motor to not interfere. Hold is not, to my understanding, much stronger than brake. I may be wrong, though
Exactly this. Hold is stronger than Brake simply because it will return to the original position if something does manage to move it. This would imply that rather than being a mechanical stop, it actively uses power to hold its position, which I would argue is stronger.
We could do some experimentation on this to definitively determine which is able to resist higher magnitudes of force, but I’m strongly inclined to think it would be Hold.