Bot in arcade mode goes backwards when stick is push foward

#1

so i have coded my bot for arcade control with this code

BackLeft.spin(directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis4.value())/2, velocityUnits::pct);
MiddleLeft.spin(directionType::fwd, (Controller1.Axis3.value()+ Controller1.Axis4.value())/2, velocityUnits::pct);
FrontLeft.spin(directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis4.value())/2, velocityUnits::pct);

   BackRight.spin(directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis4.value())/2, velocityUnits::pct);  
   MiddleRight.spin(directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis4.value())/2, velocityUnits::pct); 
   FrontRight.spin(directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis4.value())/2, velocityUnits::pct);

when stick is pushed forward the bot goe backwards
when pull back thwe bot goes forward.

wh do i fix this

0 Likes

#2

did you reverse your motors in robot-config.h?
Use this for an example, unless you’re using it already.

0 Likes

#3

@tlavalle, did you use the arcade drive example from the vex help site or you started with a blank project?

What @Enderclaw_8373H was saying is that, when you mount motors in symmetric fashion on your robot and you send same positive control command to both left and right sides, then one side will have the wheels spinning in forward and the other in backward direction.

There is a little circle with the arrow on the back of each V5 motor indicating positive spin direction.

To fix that you either need to set direction flag to reverse when you configure your robot base (see robot-config.h in the linked example) or set directionType to reverse when you send the command to the motors:

    int leftSide = (Controller1.Axis3.value() + Controller1.Axis4.value())/2;
    int rightSide = (Controller1.Axis3.value() - Controller1.Axis4.value())/2;

    BackLeft.spin(directionType::fwd, leftSide, velocityUnits::pct);
    MiddleLeft.spin(directionType::fwd, leftSide, velocityUnits::pct);
    FrontLeft.spin(directionType::fwd, leftSide, velocityUnits::pct);

    BackRight.spin(directionType::rev, rightSide, velocityUnits::pct);  
    MiddleRight.spin(directionType::rev, rightSide, velocityUnits::pct); 
    FrontRight.spin(directionType::rev, rightSide, velocityUnits::pct);
1 Like