Hello,
I’m curious to know if it’s possible to keep something in a position even if force is applied (such as gravity) with only a Victor SP and encoder. Any help with the code is also welcome.
Thanks!
Hello,
I’m curious to know if it’s possible to keep something in a position even if force is applied (such as gravity) with only a Victor SP and encoder. Any help with the code is also welcome.
Thanks!
Yeah you can, use a PID control loop. https://wpilib.screenstepslive.com/s/4485/m/13809/l/241879-operating-the-robot-with-feedback-from-sensors-pid-control
Jacob’s answer is good. You could also use a standalone PID controller (rather than wpilib’s subsystem). Lots of teams have written PID controllers, but I’m going to stick in a plug for mine.
You only need PI control for keeping an arm in place. D isn’t likely to help, so you can ignore it and keep its calibration constant at zero.
If you need to hold position against gravity, you might run into problems with overheating a stalled motor. A more sustainable solution is to use a counterweight or spring to oppose the force of gravity, so the motor doesn’t have to be providing continuous torque at zero speed.