To make my initial approach simple and manageable, I consider only a two-dimensional movement in which BoRam moves in one plane. I assume the two motors symmetrically move together when an identical input is given, although this is unlikely to be the case, it is a good approximation for motors which are manufactured as the same product. A control voltage is applied to the motors, which results in displacement of the wheels and change in angular attitude of the body. A mathematical model for the system is obtained by observing the FBDs in the figure above. The first diagram in the figure indicates the inertial frame. All the equations will be derived in this inertial frame. $h$ is the friction force between the each wheel and surface. $H$, $V$ are the horizontal and vertical force respectively acting among the body and the motor shaft. $l$ is the length from the motor shaft to the CG of the body. and finally $\tau$ is the torque produced by the DC motor.

Applying Newton's law in the third diagram to the horizontal motion of the wheel, and to the angular motion induced by two torques yield

(1)It is assumed that no slip occurs between the wheels and the surface, so the following relationship must hold.

(3)Note that $\omega$ is the angular velocity of the wheel in the inertial frame and it is different from $\omega_{enc}$that I used in the DC motor identification section. This will be explained in Coupling between IMU and Optical Encoder. It is important to know this relationship especially when it comes to implementing in the

microcontroller.

The second diagram in the figure illustrates the body dynamics. The rotational motion of the pendulum body about

its center of gravity can be described by

where $I$ is the moment of inertia of the pendulum body about its center of gravity. The horizontal force, vertical force and torque are applied as pairs on both sides and each pair are assumed to be equal because I consider only two-dimensional motion.

The horizontal motion is given by

(6)The vertical motion is given by

(7)Since I must keep the inverted pendulum robot vertical, I can assume that $\theta$is small such that $\sin\theta\approx\theta$, $\cos\theta=1$. Then, Eq.(5) through Eq.(7) can be linearized. The linearized equations are

(8)The objective here is to find suitable differential equations that fully describe the system in terms of input $v$, and the and states $x$, $\theta$ and their derivatives. The following describes how to characterize the essence of the system in two differential equations.

With Eq.(1), Eq.(4), and Eq.(9)) substituted into Eq.(2) yields $\tau$ in terms of $\ddot{x}$ and $\ddot{\theta}$.

(11)Substituting Eq.(7), Eq.(8), Eq.(3) and Eq.(11) into Eq.(9) yields

(12)Finally substituting Eq.(9), Eq.(10), Eq.(11) into Eq.(8) yields

(13)Equations Eq.(12) and Eq.(13) describes the motion of BoRam, and these are the equations that constitute the two-dimensional linearized mathematical model of the system and can be expressed in State-Space form as

(14)The rest of the unknown properties, $I$ and $l$ were found by conducting a reverse engineering on the physical model using CATIA.