disabling PID and setting target on launch
When I start/restart a PID node, the setpoint is always set to 0, but the actual current position may be something else. If I want to make sure that my robot doesn't move back to 0 every time I restart the PID node, how would I give it an initial value, read from a node publishing the robots actual position? (the position publisher is on an arduino)
In other words, what I want to do is set the setpoint = current_position whenever the PID node starts/restarts.
These are the steps to reproduce the issue:
- Start the Arduino (publishes actual position)
- Move the robot manually to 5 meters (the arduino now publishes the current position as +5 meters)
- Start the PID; the PID is automatically set to "enabled" with a set position of "0"
- Robot moves to 0 without explicit instruction to do so
So I think the best solution would be to have an parameter to disable the PID on start. That way whatever logic enables it can make sure that the set-point is set correctly.