Skip to content

Firmware: pid_right updates the right wheel's PID - #115

Open
fjp wants to merge 1 commit into
noetic-develfrom
fix/pid-right-callback
Open

fjp wants to merge 1 commit into
noetic-develfrom
fix/pid-right-callback

Conversation

@fjp

@fjp fjp commented Oct 14, 2026

Copy link
Copy Markdown
Member

BaseController::pidRightCallback in the Teensy firmware (diffbot_base/scripts/base_controller/lib/base_controller/base_controller.h) set the constants of motor_pid_left_. So a message on pid_right changed the left wheel's PID, and the right wheel kept its gains. It now updates motor_pid_right_.

  • Both PID callbacks called updateConstants twice with the same values. updateConstants only stores kp, ki and kd, so one call does the same.
  • The right callback's comment said "left motor".

Nothing in the repository publishes pid_left or pid_right. They're for tuning by hand, for example with rostopic pub and a diffbot_msgs/PIDStamped message. Related: #54 (PID tuning over topics). #114 plans native firmware tests that would catch this kind of mix-up.

Testing

Both boards build with PlatformIO 6.2.0 (pio run -e teensy40 -e teensy31), and CI builds both too. Not tested on the robot.

pidRightCallback set the left motor's PID constants, so tuning the right
wheel over the pid_right topic changed the left wheel and left the right
one unchanged. Both callbacks also set the constants twice; once is
enough, since updateConstants only stores kp, ki and kd.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant