One of my teams has a simple auton that looks correct to me, but the spinTo commands hang up. Motors do not spin at all. Commenting those lines has the bot drive all the Drivetrain steps no problem. I have confirmed with them the motor ports. We have checked the motors in the devices page on the brain and confirmed the degrees they are using are correct and in the right direcrtion. I have had them try spinToPosition and rotateTo. I have had them setPosition for those motors in PreAuton and Auton and both.
void pre_auton(void) {
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, ...
Drivetrain.setDriveVelocity(80,percent);
Lift.setPosition(0, degrees);
Fork.setPosition(0, degrees);
Claw.setPosition(0, degrees);
Lift.setVelocity(100, percent);
Fork.setVelocity(100, percent);
Claw.setVelocity(100, percent);
Claw.setStopping(hold);
Fork.setStopping(hold);
Lift.setStopping(hold);
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
}
/*---------------------------------------------------------------------------*/
/* */
/* Autonomous Task */
/* */
/* This task is used to control your robot during the autonomous phase of */
/* a VEX Competition. */
/* */
/* You must modify the code to add your own robot specific commands here. */
/*---------------------------------------------------------------------------*/
void autonomous(void) {
// ..........................................................................
// Insert autonomous user code here.
// ..........................................................................
// neutral goal rush
// set motor variables
Drivetrain.setDriveVelocity(80,percent);
Lift.setPosition(0, degrees);
Fork.setPosition(0, degrees);
Claw.setPosition(0, degrees);
Lift.setVelocity(100, percent);
Fork.setVelocity(100, percent);
Claw.setVelocity(100, percent);
Claw.setStopping(hold);
Fork.setStopping(hold);
Lift.setStopping(hold);
// raise lift
Lift.spinTo(50, degrees, true);
// drive to goal
Drivetrain.driveFor(forward, 45, inches);
Drivetrain.setDriveVelocity(40, percent);
Drivetrain.driveFor(forward, 2, inches);
// close claw
Claw.spinTo(900, degrees, true);
// drive back to starting position
Drivetrain.setDriveVelocity(80, percent);
Drivetrain.driveFor(reverse, 46, inches);
Any thoughts on what I am missing?
The motors were originally initiated with the device manager, so have correct configuration there and have the externs in robot-config.h. They switched to expert mode to set a software limit on the claw and lift that works in driver contol:
// check the ButtonL1/ButtonL2 status to control Lift
if (Controller1.ButtonL1.pressing()) {
Lift.spinTo(1550, degrees, false);
Controller1RightShoulderControlMotorsStopped = false;
} else if (Controller1.ButtonL2.pressing()) {
Lift.spinTo(50, degrees, false);
Controller1RightShoulderControlMotorsStopped = false;
} else {
Lift.stop();
// set the toggle so that we don't constantly tell the motor to stop
// when the buttons are released
Controller1LeftShoulderControlMotorsStopped = true;
}
// check the ButtonR1/ButtonR2 status to control Claw
if (Controller1.ButtonR1.pressing()) {
Claw.spinTo(0, degrees, false);
Controller1RightShoulderControlMotorsStopped = false;
} else if (Controller1.ButtonR2.pressing()) {
Claw.spinTo(900, degrees, false);
Controller1RightShoulderControlMotorsStopped = false;
} else {
Claw.stop();
// set the toggle so that we don't constantly tell the motor to stop
// when the buttons are released
Controller1RightShoulderControlMotorsStopped = true;
}
So, yeah, I cannot see the issue.