Controlling the robot
With all that we have discussed so far, we have the inputs and outputs of the control system in place. The inputs are as follows:
- The sensed PWM pulse widths from the RC receiver
- The motor encoder velocities estimated with the moving average
- The pitch rate sensed by IMU’s gyroscope
- The pitch angle, estimated from the IMU’s gyroscope, and the accelerometers by the complementary filter
The outputs of the control system are the motor PWM values for the left and right motor drivers. The goal of the control system is to drive the motors such that the robot 1) automatically balances upright and 2) follows the joystick commands, driving forward and backward, steering left and right, and turning in place. We can, therefore, naturally split the discussion of the control system into two parts: the balance control and the remote control. We can formulate both parts of the control system as individual controllers that both generate...