I'm building a two-wheeled, self-balancing, remote-controlled robot. I'm familiar enough with the IMU and PID to get it working to just stand up but I need to drive it via remote control.

I've got no code written yet; trying to understand the concepts before diving in.

This much I understand: [IMU] -> [Kalman filter] -> [PID] -> [Motors]

Where I'm getting tripped up is where to mix the RC component into that control chain?

1 Answer 1


The PID get's a set point from you. For a standing still robot this a basically an angle of zero in respect to the gravity direction (which variable you use for the PID depends on your actal implementation, but it always be something derived from the angle to gravity direction). For driving forward, the robot must lean forward. So you set the new angle set point to let's say 2 degrees. The PID will try to hold that value by driving forward constantly, with a speed depending on the set angle.

So, via the remote control you simply change the angle setpoint.

  • Seems so obvious now, thanks! Aug 14, 2019 at 15:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.