Can a command call a pidcommand? I want a command to call a pidcommand to rotate the robot before doing other things.
You can either schedule the command in the other command: pidCommand.schedule()
or you can create a sequential command group that runs the PID command before the other commands in order. The second option is probably better as it’s best to separate commands and code that perform different functions as much as possible.
I have done the second option before. My objective is to make one of the joysticks control the front of the robot and the other to move forward. When the joystick is pointed to the left, the robot will turn to the left. In other words, I want the turn pid command anytime the joystick is moved.
Can you just use a PIDController
inside of the command, and do you really need PID (like is it for heading control where the angle of the joystick is the angle of the robot or just being able to turn the robot)? You can calculate the ChassisSpeeds
values or even just percentages of speeds in your command and then put them into your drive subsystem which runs all of the motors properly. I’m not sure which drivetrain you’re using, it sounds like tank, but there should be a method to run at a specific forward and rotational speed.
I probably do not need pid. My drive subsystem is tank. Thank you for those ideas.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.