# Mobile robot speed synchronization for straight line moving

I would like to build a simple mobile robot with differential wheels, and I am currently design the wheel speed controller. After reading some papers, I noticed that to realize a straight line moving, the linear speed and angular speed of the mobile robot have to be controlled at the same time, which makes the system a Multi-input-multi-output (MIMO) system. I plotted two different controller structures I came across while reading materials. Both of them have angular speed feedback and control, but one with linear speed feedback and control, the other without. In the picture, Gl(s) and Gr(s) refer to the motor transfer function, and vl and vr are the measured wheel speed.

Would anyone please suggest which controller structure is more reasonable and can realize better straight line moving?

Updates v* and w* are linear speed reference and angular speed reference respectively that could either be fixed values or come from trajectory generation; corrected a typo in the motor block in structure 2, as @Chuck pointed out, and changed G1(s) and G2(s) to Gl(s) and Gr(s) for better illustration.

There are really two problems here:

1. You are trying to derive an appropriate speed command to send to the motors, and
2. You are trying to drive the vehicle in a straight line.

Suppose you get the "perfect" control scheme that sends exactly the correct signals to the motors. The problem then becomes: What if one wheel runs over a piece of paper and just spins for a little bit instead of generating traction? What if one wheel runs over some dust that sticks to the tire and now it's a little bigger than the other wheel?

I'm assuming here that your wheel odometry is coming off of encoders on the motor, but the same arguments are true if you've got an idle wheel to do odometry measurements.

Assuming some rotation of the motor $\theta$, each wheel should traverse a distance of $r\theta$, where $r$ is the wheel radius. However, if one wheel is slightly larger than the other $(r+\epsilon)$, then one wheel traverses $r\theta$ while the other traverses $(r+\epsilon)\theta$, or $r\theta + \epsilon \theta$.

Your vehicle will then turn (assuming a differentially steered or two-wheel robot) an angle of $\psi = \epsilon \theta / d$, where $d$ is the wheel base (distance between the two wheels.

You can see now that the angle your vehicle turns, $\psi$, is a linear function of how far your wheels turn, $\theta$.

I have posted an answer like this before - The only way you can be sure to drive in a straight line is to measure where the robot is relative to the straight line. This could be LIDAR, a localization routine (like SLAM), overhead webcam watching the robot, compass/magnetometer, etc. There will always be variations that prevent your vehicle from going exactly straight, so you need to be able measure how you're travelling and be able to adjust accordingly.

With regards to your original question though, first I'll comment that you're looking to provide only a wheel speed, so if anything it's multi-input single-output. If you're looking for someone to comment specifically on the block diagrams you've provided, then you need to explain what they mean. Typically the symbols $x$, $v$, and $a$ are used for linear position, speed, acceleration, respectively, and $\theta$, $\omega$, $\alpha$ are used for angular position, speed, and acceleration.

You use $v$* and $\omega$*, which looks like linear speed and angular speed, so I don't know what your inputs are, or what the star means, or why there aren't any integrator or derivative blocks (how are you getting between position and speed?), or why Structure 1 has G1 and G2 where Structure 2 has G1 and G1, etc.

If you want to drive in a straight line without measuring the orientation of the vehicle, send the same speed signal to both motors. That's probably the best you can do.

• thanks a lot for your comments and I updated my post to answer some of your questions. As you may see, if the system has linear and angular speed as reference inputs and left and right wheel speed as output, isn't it a MIMO system? The purpose of this controller is to make the left and right wheel speed follow the desired reference so that the mobile robot linear and angular speed can follow the reference value. I understand the structures here are not the same as those using dx/dt, dy/dt and dtheta/dt, but can the two structures realize linear and angular speed control? – roTor-roTor May 3 '17 at 5:18

Chuck made a very good observation that unless your control algorithm can use sensors to reference the external environment, an odometry-based vehicle can't go perfectly straight - there's always factors unaccounted for by wheel encoders.

That said, if LIDAR/SLAM/rangefinders/compasses are out of the question (or are unnecessary for your application), you may be making this too complicated:

• Drive one motor at a constant speed.
• Use PID to slave other motor to the first, attempting to match speed/angular position.

In a controlled environment, with a well-tuned PID, this will achieve very good results.

For achieving exact straight line motion on a differential drive robot. It is best to use PWM techiques to control current supplied to the motors. Using PWM waves generated on the micro-controller/processor, output the current to pins to which you are connecting the driver circuit(like L293D) for motors.