When we made the auton for the drive train, we had to require the drive subsystem. We wrote our shooter code all in robot.java, so is there no way for us to require it and create auton for it? Or do we have to create a subsystem for the shooter?
No you should just be able to call your methods for controlling the shooter in the auto routine, assuming you made something like that.
In general though you want to move each subsystem to it’s own file for convenience and clarity of the code. Having a lot of stuff in Robot.java can make it look really messy.
This is my old team’s 2019 code if you want to use it as a reference for formatting: https://github.com/FRC4561TerrorBytes/TB2019
Hi, I’ll try and help here. I think what your saying is you want to autonomously move the robot from within robot.java in combination with your code already there for your shooter.You already have a drive subsystem set with a default command for teleop. That command requires that subsystem.
Theoretically you could directly call your drive method from robot.java to set a value to the motors. I assume you declared you drive subsystem in robot.java robotinit(), so all you have to do is call that object.your_method to drive. For example: drive_subsystem.drive(0.5,0.5); No need to require it. Be careful on the loops and stopping it when it ends. I’ll test this out later tho.
The reason the subsystems/commands work nice is it protects you from trying to tell the drive subsystem to do different things at the same time. It also handles situations where the command needs to be interrupted, and ends it properly. Without it you have to handle all these yourself. You need to make sure to stop your motors before time runs out or they could run away.
If you are following the command based structure then I would recommend creating a subsystem. Command groups work well for this. You can schedule the commands to run sequentially or parallel to each other for both the drive and shooter.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.