Mecanum Tank drive

Hello everyone, We have been trying to get a mecanum tank drive system working but we have been running into some issues. In the robot container file we are using a joystick button to change between a mecanum and tank drive state ( seen here ), the state change seems to work fine but while driving the robot just stops and then starts to spam 2 errors. Both are coming from the drive subsystem (drive subsystem) MecanumDrive output not updated enough and DifferentialDrive not output not updated enough. We are kinda stumped on what is wrong here. Any and all help is appreciated.

Does it spam the 2 errors simultaneously, or only the one that’s not related to the mode you’re currently in?

Based on your code right now, I would expect the latter.

It spams the error for the current state that is active while trying to drive.

Can you explain what a Mecanum Tank drive is? Do you have two physical drive systems that you’re switching between? Do you only have a mecanum drive train, but are trying to change the user interface? I suspect there are probably better ways to do what you’re trying to do, but I’m not sure what you are trying to do.

You’re fighting against the motor safety. Any drive object needs to be called periodically (at least every 100ms) or else the motors will turn off. This makes sure that your robot stops driving if you had an issue where your code got stuck in an infinite loop and stopped updating the drive motors.

The way your code is structured, you’re guaranteed to not send commands to either the mecanum or differential drive objects, which ever one is not selected. The one that isn’t selected will send the stop command to the motors, but since the motors are shared between the objects, it will stop the other object as well.

1 Like

One way around this is to use the static functions with the IK suffix in the name (e.g., DifferentialDrive.arcadeDriveIK()) instead of drive class instances, which will return normalized voltages you can choose between and not instantiate any motor safety.

1 Like

If you don’t have two phyisical drive trains on the robot, this whole thing is pretty much a waste of effort. You won’t get any advantage from driving a mecanum drive train like it’s a tank drive. It will still be easier to push around and you whenever you switch you lose the one big advantage you get from having mecanum in the first place, strafing. My advice is a lot simpler than any fix to your code (and from a team that has run very successful mecanum drive robots in the past): stick to just the mecanum code and focus on lots and lots of driver practice to use the advantages and overcome the weaknesses of your chosen drive train.

1 Like

We are using mecanum wheels but we want to use 2 joysticks to drive the robot and then when we want to use mecanum we hold a button on the joystick the old way we would do this doesn’t work anymore due to wpilib separating the 2 drive classes. Any ideas on how to do this?

I admit we never used two joysticks when we used a mecanum drive. Ours was a single Logitech Extreme 3D Pro joystick, which has a z-axis twist control on the stick. We used the twist to control the differential between the two sides when driving in forward or reverse using the y-axis (i.e., like tank driving) and the x-axis control to run the strafing commands. It actually worked out really well. Here the link to our 2019 code for that mecanum drive robot. Even if you choose to go another way with your controls, it might help your programmers pin down what they need.

Tyler’s suggestion above is sound.

1 Like

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