Code to hold clawbot in up position

Does anyone have code for keeping the clawbot in the up position when no buttons being pushed on the controller? When we use the pre-programed clawbot examples, the clawbot stays in position but we want to put in our own program. Does anyone have code for this?

Welcome @denaeoneil!
What are you using as your hardware? Cortex or V5? What are you using to program with? RobotMesh Studios or VEXcode or PROS or RobotC or something different?

For V5, there are multiple ways to do this. The simplest is to set the brake type on the motor to hold. In VEXcode that should be:

motor.setStopping(brakeType::hold);

The commands might be different depending on what you are coding in. When the motor stops, the V5 brain will automatically send power to keep the motor there based on how much it is moving.

The more complex way to do this is to program a P or PID loop (see below). P or PID loop is a feedback loop that isn’t dependent on programming platform or hardware. A lot of teams used a PID loop for their tray last season. A P loop should work for keeping a claw in up position for the Cortex.
http://georgegillard.com/documents/2-introduction-to-pid-controllers


3 Likes