I have recently changed my robot to a geared 6 motor drive. However, when I stop driving it keeps giving an input for a long period of time after I stop. it also turn unexpectedly and it is not the controller because it worked fine on the old drive train. I have attached my code. does anyone see any obvious flaws that would cause this?
void usercontrol(void) {
// User control code here, inside the loop
while (1) {
//drive train control
L1.spin(vex::directionType::fwd,(Controller1.Axis3.value()), vex::velocityUnits::pct);
L2.spin(vex::directionType::fwd,(Controller1.Axis3.value()), vex::velocityUnits::pct);
L3.spin(vex::directionType::fwd,(Controller1.Axis3.value()), vex::velocityUnits::pct);
R1.spin(vex::directionType::fwd,(Controller1.Axis2.value()), vex::velocityUnits::pct);
R2.spin(vex::directionType::fwd,(Controller1.Axis2.value()), vex::velocityUnits::pct);
R3.spin(vex::directionType::fwd,(Controller1.Axis2.value()), vex::velocityUnits::pct);
//Belt Control
{
if(Controller1.ButtonR2.pressing()) {
Belt.spin(directionType::fwd, 200, vex::velocityUnits::rpm);
}
else if(Controller1.ButtonY.pressing()) {
Belt.spin(directionType::rev, 200, velocityUnits::rpm);
}
else{
Belt.stop(vex::brakeType::coast);
}
}
//claw
if (Controller1.ButtonY.pressing()){
Claw.on();
}
if (Controller1.ButtonA.pressing()) {
Claw.off();
}
//mogo
if (Controller1.ButtonR1.pressing()){
Mogo.on();
}
if (Controller1.ButtonRight.pressing()){
Mogo.off();
}
//Lift
{
if(Controller1.ButtonL1.pressing()) {
Lift.spin(directionType::fwd, 100, vex::velocityUnits::rpm);
}
else if(Controller1.ButtonL2.pressing()) {
Lift.spin(directionType::rev, 100, velocityUnits::rpm);
}
else{
Lift.stop(vex::brakeType::hold);
}
}
// This is the main execution loop for the user control program.
// Each time through the loop your program should update motor + servo
// values based on feedback from the joysticks.
// ........................................................................
// Insert user code here. This is where you use the joystick values to
// update your motors, etc.
// ........................................................................
wait(20, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
}
Please use the search bar
https://www.vexforum.com/t/how-do-you-program-a-6-motor-drivetrain/95113G
Edit: use Holbrooks link
1 Like
says no results found
Correct link to that thread:
1 Like
thank you
(20 characters)
1 Like