Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

2 issues I see:

  • The variables "new_cmd" & "new_pwm" are never used, so they could be deleted.
  • It returns an int, so it will be rounding to integer values. My guess with proportional gain failing is it rounded a decimal (like 0.4) down to zero.

If you want to move the PID away from the Arduino, you could

  • Publish "state" (aka currentValue) and "setpoint" (aka command) topics
    • Subscribe to a "control_effort" (aka topic
    • Launch a pid control nodelink text

2 issues I see:

  • The variables "new_cmd" & "new_pwm" are never used, so they could be deleted.
  • It returns an int, so it will be rounding to integer values. My guess with proportional gain failing is it rounded a decimal (like 0.4) down to zero.

If you want to move the PID away from the Arduino, you could

  • Publish "state" (aka currentValue) and "setpoint" (aka command) topics