I implemented PWM output, encoder and current sensing, PID control and CAN communication in C. We used Simulink to model steering self-centering and virtual-spring force feedback, then generated embedded C code.
Testing vehicle following
We modeled adaptive cruise control, vehicle following and throttle response. In an eight-vehicle simulation we validated speed-data exchange over CAN.