How to toggle reverse steering on controller?

We have a 6WD using custom motor groups for each side. What what would be the easiest way to reverse the steering with the press of a button on the controller. PLS and Thank You.

Welcome to the forum.

Easiest way would be to use an arcade style drive (forward and reverse on one joystick axis and turn on another.) With that you could toggle a boolean with a button press, then multiply the boolean by the forward/reverse axis signal in driver control.

Or you could just free up some time for driving practice and “get gud”. Many teams have this same issue/idea when they first start driving. After a bit of practice they get more comfortable with orienting themselves mentally with the robot front and driving becomes more intuitive.

3 Likes

Kind of depends on how your drive is setup. It’d help if you posed the driver control you already have with enclosed like this → ```` so the code shows up readable.

Anyways my best guess would be to reverse the two joystick inputs with a toggle. Something like this:

bool toggle;
void DriverControl() {
 int LeftStick = ControllerLeftYAxis;
 int RightStick = ControllerRightYAxis;

 if(ControllerButtonPress){
  if(toggle){
  toggle = false;
  } else {
  toggle = true;
  }
 }

 if(toggle){
  LeftStick = LeftStick * -1;
  RightStick = RightStick * -1;
 }

 RightMotorGroup = RightStick;
 LeftMotorGroup = LeftStick ;
}
1 Like

Turns for a reversed drive are not reversed. If you make the front the back, right is still the same direction. So the trick of this toggle the direction thing is you are only toggling front to back, not turns. (Thus my suggestion of arcade drive for the basis of the toggle.)

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.