Coding Issues

Hello,
My team is currently having the problem of not being able to get autonomous to work with our mecanum drive. To be quite honest, we don’t even know where to begin. We know how to program our other motors, but we don’t know how to program the wheels to move. Any help would be greatly appreciated!

What language are you programming in?

Java

Can you use the code about half way down the page here - Using the WPILib Classes to Drive your Robot — FIRST Robotics Competition documentation. You mentioned you know how to move other motors and would have to change that part if you are using can instead of pwm.

Mecanum drive shouldn’t matter. In autonomousPeriodic(), just tell the motors to move at a fixed speed, like 0.25. Get this going, then proceed from there.

How are you enabling Autonomous? Please see https://docs.wpilib.org/en/stable/docs/software/driverstation/driver-station.html. You can set the Driver Station to run Autonomous, or a full (Practice) match: Autonomous followed by Teleop, see “Operation Tab”.

ALWAYS TEST THE ROBOT ON BLOCKS, WHEELS OFF THE GROUND, WHENEVER YOU MODIFY THE DRIVE CODE. Satisfy yourself that the ‘bot is controllable and well-behaved before driving it on the floor.

2 Likes

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