Command Based and Timed robot

Hello, I was wondering if it was possible to create a drive subsystem and use it in timed robot. The code also has drive function in timed robot that uses the same motors to drive in teleop.

I suggest you take a look at this example from WPILib. The Drivetrain class does not extend the SubsystemBase class specifically (I might be wrong, but I think it would make no effect in a Timed Robot to extend the SubsystemBase class), but it keeps the same idea as a subsystem of modularizing the code.

1 Like

I strongly suggest you consider using the command-based framework unless you have a very compelling reason not to. At this point it is substantially easier to use than a raw TimedRobot even for simple tasks - you do not need to expand your code into a large object-oriented hierarchy to use it anymore, you can just write commands more-or-less as if they’re ordinary methods.

5 Likes

This is our 2023 season code. We used TimedRobot with our own custom Swerve drivetrain code. Really the main drivetrain update function is called in OI (operator input - where we handle joystick inputs). One thing we lacked was a robust autonomous movement and that was because we just didn’t have time to adapt a common path-planning solution (like PathPlanner) in time for our competitions - however we are now working on that! Let me know if you have questions!