Skip to content

Make PID Gains for Launch Wheel #33

@rbmj

Description

@rbmj

Use the PID controller class to make it so we can set a speed, wait until the speed is within a certain tolerance, and then shoot.

Hopefully we'll have the encoder on the shooter wheel by Wed/Thurs. As soon as we get this we need to test, changing the PID gains until they work. Just some boilerplate code that has a few different buttons that sets the RPM, and some debug printfs to output the current speed and the setpoint. Remember to slowly increase the P value (and when it says slowly, I mean slowly. Like start at .05) until you get a small constant error. Then make a tiny I value (tiny like .01). The I component really makes it unstable if you go too high. Then tweak with a D value. You can see some sample theoretical response curves at wikipedia.

We need the same thing for the potentiometer on the launch deflection angle. This is next priority after the launch angle speed. The pulleys should be wired very soon. Figure out what the voltage should be (remember to use oversampling).

We also need some PID gains for the drivetrain in case we need to go back a certain distance. We need to talk with Mechanical people about this. Find the gear ratios (note that this will change when we change the gear, so remember to change the SetDistancePerPulse() whenever we shift), and figure out what the theoretical distance per pulse should be for each gear. But this is lower priority.

PID Controller Class Reference Doc:
http://rbmj.github.com/612-code/doc/html/classPIDController.html

Note that all of the sensors multiply inherit from PIDSource, and Jags multiply inherit from PIDOutput. So just a &sensor, &jag should work.

PIDController::Enable() spawns its own thread to handle updating, so no need to have a .update() for that. ::Disable() will also set the jag's output to 0 to stop the motor

Remember to call SetTolerance! This needs to be small enough to remain accurate while big enough to keep the system from oscillating.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions