Controlling underactuated systems is a challenging problem in control engineering. This paper presents a novel constraint-following approach for control design of an underactuated two-wheeled mobile robot (2 WMR), which has two degrees-of-freedom (DOF) to be controlled but only one actuator. The control goal is to drive the 2 WMR to follow a set of constraints, which may be holonomic or nonholonomic constraints. The constraint is considered in a more general form than the previous studies on constraint-following control (hence including a wider range of constraints). No auxiliary variables or pseudo variables are required for the control design. The proposed control only uses physical variables. We show that the proposed control is able to deal with both holonomic and nonholonomic constraints by forcing the constraint-following error to converge to zero, even if the system is not initially on the constraint manifold. Using this control design, we investigate two cases regarding different constraints on the 2 WMR motion, one for a holonomic constraint and the other for a nonholonomic constraint. Simulation results show that the proposed control is able to drive the 2 WMR to follow the constraints in both cases. Furthermore, the standard linear quadratic regulator (LQR) control is applied as a comparison in the simulations, which reflects the advantage of the proposed control.

## Introduction

In recent years, studies on two-wheeled mobile robot (2 WMR) or wheeled inverted pendulum (WIP), especially the motion control for it, have received extensive attention in both academia and industry worldwide [14]. This is mainly attributed to its capability to model a class of modern vehicles transporting human or goods safely and efficiently [2], and to demonstrate various control strategies. For instance, SEGWAY, which is a well-known and popular commercial personal transporter, is essentially a 2 WMR; Mu et al. [5], Huang et al. [6], and Pathak et al. [7] applied their proposed control approaches to the WIP for demonstration. From the view point of motion control design, a salient feature of the 2 WMR or WIP is that it is usually underactuated. That is, it has fewer control inputs than the degrees-of-freedom (DOF) to be controlled. This presents a tough problem frequently encountered by researchers, i.e., control design for underactuated mechanical systems [8].

Despite the complexity, the problem of control design for underactuated systems has been among hotspot issues for years. This is due to its wide existence in engineering practice—there are a great number of practical mechanical systems belonging to this community, e.g., underwater vehicles, unicycle robots, humanoid robots, and aircraft. The existing studies on this problem include a variety of methodologies accounting for different issues. In general, these studies can be classified into two types: kinematics approach and dynamics approach. The kinematics approach aims to regulate displacement and/or velocity by controlling other kinematic properties. The control is not force or torque, and examples are Refs. [9,10]. The dynamics approach designs controls are closely related to force or torque, and examples are [1113]. Some conventional control methodologies also have been applied to underactuated systems [1416], and most of these studies belong to the dynamics approach. Regarding examples of 2 WMR and WIP, Yang et al. [17] applied neural network-based control approach for an underactuated WIP; Cui et al. [18] investigated adaptive backstepping control for underactuated WIP models; Guo et al. [19] and Xu et al. [20] employed sliding-mode control for an underactuated WMR. Despite the fact that so many studies have been done, the problem of control design for underactuated systems still calls for new developments and more insight. This study targets this problem and aims to design control that falls into the dynamics approach.

In this paper, to design the motion control for an underactuated 2 WMR, we propose a new approach based on constraint-following [21,22]. The 2 WMR consists of two wheels in parallel and an inverse pendulum. The model for the motion of the 2 WMR is formulated as a 2DOF (wheels displacement and pendulum tilting angle) system with one control input (single actuator). The constraints can be holonomic or nonholonomic. The control design is then carried out in two steps. First, a control design without addressing possible initial constraint deviation is proposed. Second, an additional control action is added to deal with possible initial constraint deviation. The control is then obtained as the sum of the controls proposed in the first and second steps. We show that the proposed control is able to force the constraint-following error to converge to zero, even if the system is not initially on the constraint manifold. Following this framework, we investigate two cases with different constraints on the 2 WMR motion. The first one is with a holonomic constraint, which is to render the wheels move forward while keeping the pendulum approximately upright. The second one is with a nonholonomic constraint, which is to render the tilting angle of the pendulum to vary in a specific interval with its midpoint at the upright position. The corresponding control input of the 2 WMR is then obtained based on the constraint by using the proposed control design approach.

The main contributions of this study are threefold. First, we formulate the underactuated 2 WMR motion control problem as constraint-following. The constraints may be holonomic or nonholonomic, thus including a wide range of practical robot needs. Second, we propose a control that can achieve constraint-following for the 2 WMR, even if it is not initially on the constraint manifold. Despite the system being under constraint, no auxiliary variables (such as Lagrange multiplier) or pseudo variables (such as generalized speeds) are needed for the control design. The control only uses physical variables. Third, we investigate two cases with different constraints (one holonomic and one nonholonomic) on the 2 WMR motion and corresponding numerical simulation results are provided to demonstrate the effectiveness of the control.

## Constrained Mechanical System

Consider the following mechanical system:
$M(q(t),q˙(t),t)q¨(t)+C(q(t),q˙(t),t)q˙(t)+g(q(t),q˙(t),t)=B(q(t),q˙(t),t)τ(t)$
(1)

Here, tR is the time, qRn is the position vector, $q˙∈Rn$ is the velocity vector, $q¨∈Rn$ is the acceleration vector, and τRm with m  n is the control input vector. Furthermore, $M(q(t),q˙(t),t), C(q(t),q˙(t),t), g(q(t),q˙(t),t)$, and $B(q(t),q˙(t),t)$ stand for the inertia matrix, the matrix of Coriolis/centrifugal terms, the gravitational force, and the input matrix, respectively, and they are of appropriate dimensions. The functions M(⋅), C(⋅), g(⋅), and B(⋅) are continuous. In addition, the position vector q does not need to be the generalized coordinate and can be chosen based on the specifications of the problem.

Now, we propose a class of constraints as follows:
$∑i=1nA′li(q,q˙,t)q˙i=c′l(q,q˙,t), l=1,…,m$
(2)

where $q˙i$ is the ith component of $q˙, and A′li(·)$ and $c′l(·)$ are both C1.

Remark 1. The proposed constraints are in the first-order form. They may not be integrable and generally may be nonholonomic. Furthermore, the proposed constraints have similar form as those in Ref. [21]. However, they are different. To be specific, the constraints in Ref. [21] do not include the velocity vector $q˙$ as an argument in the functions “$A′li(·)$” and “$c′l(·)$,” but the proposed constraints do. Therefore, the proposed constraints are more general than those in Ref. [21].

To convert the first-order form into the second-order form, we take derivative of Eq. (2) with respect to t and obtain
$∑i=1n(ddtA′li(q,q˙,t))q˙i+∑i=1nA′li(q,q˙,t)q¨i=ddtcl(q,q˙,t)$
(3)
where
$ddtA′li(q,q˙,t)=∑k=1n∂A′li(q,q˙,t)∂qkq˙k+∑k=1n∂A′li(q,q˙,t)∂q˙kq¨k+∂A′li(q,q˙,t)∂t$
(4)

$ddtc′l(q,q˙,t)=∑k=1n∂c′l(q,q˙,t)∂qkq˙k+∑k=1n∂c′l(q,q˙,t)∂q˙kq¨k+∂c′l(q,q˙,t)∂t$
(5)
Since
$∑i=1n(∑k=1n∂A′li(q,q˙,t)∂q˙kq¨k)q˙i=∑k=1n∑i=1n∂A′li(q,q˙,t)∂q˙kq˙iq¨k=∑i=1n(∑k=1n∂A′lk(q,q˙,t)∂q˙iq˙k)q¨i$
(6)

$∑k=1n∂c′l(q,q˙,t)∂q˙kq¨k=∑i=1n∂c′l(q,q˙,t)∂q˙iq¨i, ∑k=1n∂c′l(q,q˙,t)∂qkq˙k=∑i=1n∂c′l(q,q˙,t)∂qiq˙i$
(7)
the second form of the constraints, i.e., Eq. (3), can be rewritten as
$∑i=1n(A′li(q,q˙,t)+∑k=1n∂A′lk(q,q˙,t)∂q˙iq˙k−∂c′l(q,q˙,t)∂q˙i)q¨i=−∑i=1n(∑k=1n∂A′li(q,q˙,t)∂qkq˙k+∂A′li(q,q˙,t)∂t−∂c′l(q,q˙,t)∂qi)×q˙i+∂c′l(q,q˙,t)∂t=:bl(q,q˙,t), l=1,…,m$
(8)
or in matrix form
$A(q,q˙,t)q¨=b(q,q˙,t)$
(9)
where $A=[Ali]m×n, b=[b1 b2 ⋯ bm]T$ and
$Ali:=A′li(q,q˙,t)+∑k=1n∂A′lk(q,q˙,t)∂q˙iq˙k−∂c′l(q,q˙,t)∂q˙i$
(10)
Furthermore, the first-order form of the constraint, i.e., Eq. (2), can be rewritten as
$∑i=1n(A′li(q,q˙,t)+∑k=1n∂A′lk(q,q˙,t)∂q˙iq˙k−∂c′l(q,q˙,t)∂q˙i)q˙i=c′l(q,q˙,t)+∑i=1n(∑k=1n∂A′lk(q,q˙,t)∂q˙iq˙k−∂c′l(q,q˙,t)∂q˙i)q˙i=:cl(q,q˙,t) l=1,…,m$
(11)
or in matrix form
$A(q,q˙,t)q˙=c(q,q˙,t)$
(12)

and where $c=[c1 c2 ⋯ cm]T$.

Definition 1. The constraint (9) is consistent if for given A and b, there is at least one solution$q¨$.

Assumption 1. The constraint (9) is consistent.

Lemma 1 [23]. A necessary and sufficient condition for the constraint (9) to be consistent is A+Ab = b. Here, “+” denotes the Moore–Penrose (MP) generalized inverse.

The constraint (9) is in fact a very general form. Both holonomic and nonholonomic constraints can be expressed as this form. Task constraints can also be put in this form, e.g., Ref. [24]. Other control problems such as stabilization, trajectory following, and optimality can also be cast into this form by taking derivatives [22].

## Servo Control Design Without Initial Condition Deviation

Let $x¨:=M12q¨, a:=M−12(−Cq˙−g), and τ:=τn$, then the system (1) can be rewritten as
$x¨=a+M−12Bτn$
(13)
and the constraint (9) can be rewritten as
$Φ1x¨=b$
(14)
with $Φ1=AM−12$.

Definition 2. For given Φ1 and b, the constraint (14) is called consistent if there exists at least one solution$x¨$.

Since there is a one to one correspondence between $x¨$ and $q¨$, Eq. (9) is consistent if Eq. (14) is consistent.

Definition 3. The system (13) is called servo constraint controllable with respect to the constraint (14) if there is a control τn such that the system under this control meets Eq. (14) for all$(q,q˙,t)∈Rn×Rn×R$.

Let $b¯:=b−Φ1a, Φ2:=M−12B$. For given Φ1,2 and $b¯$, consider the equation
$(Φ1Φ2)τn=b¯$
(15)

where τnRm is the unknown. This equation can be viewed as a constraint on τn.

Definition 4. For given Φ1,2 and$b¯$, Eq. (15) is consistent if there exists at least one solution τn.

Assumption 2. Equation (15) is consistent.

Assumption 2 gives the existence condition for the servo control τn, which can render the nominal system to follow the constraint (9). A direct solution is $τn=(Φ1Φ2)+b¯$ such that
$(Φ1Φ2)τn=(Φ1Φ2)(Φ1Φ2)+b¯=b¯$
(16)
for all $(q,q˙,t)∈(q,q˙,t)∈Rn×Rn×R$ [23].
Theorem 1. Subject to Assumption 2, the system (1) is servo constraint controllable with respect to the constraint (14) if and only if
$rank[Φ1(q,q˙,t)Φ2(q,q˙,t)]≥1$
(17)
for all$(q,q˙,t)∈Rn×Rn×R$, and the servo control τn is given by
$τn=(Φ1Φ2)+b¯+[I−(Φ1Φ2)+(Φ1Φ2)]S$
(18)
where S ∈Rm is an arbitrary vector, possibly dependent on q,$q˙$, and t.
Proof. (Sufficiency) Suppose $rank[Φ1(q,q˙,t)Φ2(q,q˙,t)]≥1$ for all $(q,q˙,t)∈(q,q˙,t)∈Rn×Rn×R$, which means the MP inverse of $Φ1(q,q˙,t)Φ2(q,q˙,t)$ always exists [23] and the control (18) is meaningful. Substituting the control (18) into the system (13) and premultiplying both sides of Eq. (13) by Φ1 yield
$Φ1x¨=Φ1a+Φ1Φ2{(Φ1Φ2)+b¯+[I−(Φ1Φ2)+(Φ1Φ2)]S}︷=τn=Φ1a+Φ1Φ2(Φ1Φ2)+b¯︷=b¯+[Φ1Φ2−Φ1Φ2(Φ1Φ2)+Φ1Φ2︷=Φ1Φ2]︸=0=Φ1a+b¯︷=b−Φ1a=b$
(19)

Here, a property of MP inverse, GG+G = G, is applied.

(Necessity) Suppose that $rank[Φ1(q,q˙,t)Φ2(q,q˙,t)]=0$ for some $(q,q˙,t)$, which indicates $Φ1(q,q˙,t)Φ2(q,q˙,t)=0$. Premultiplying both sides of Eq. (13) by Φ1 yields
$Φ1x¨=Φ1a+Φ1Φ2︷=0τn=Φ1a$
(20)
which is inconsistent with the constraint (14). Therefore, we can conclude that one needs $rank[Φ1(q,q˙,t)Φ2(q,t)]≥1$ for all $(q,q˙,t)∈(q,q˙,t)∈Rn×Rn×R$. ◻

There are two consistency provisions in this section. The first (Assumption 1) ensures the constraint to be meaningful, for otherwise the constraint-following problem is impossible. The second (Assumption 2) ensures the control design to be meaningful, for otherwise there is no way to come up with the control.

Remark 2. The servo control τn in Eq. (18) is a model-based state feedback control and is readily applicable. Note that the control is continuous in the state. The condition (17) simply means that the rows of Φ1 and the columns of Φ2 should not be all perpendicular to each other. This allows the control τn to be able to project a specific amount of component in $R(Φ1T)$. As shown before, eventually the system needs, after applying the control, a net projection of $Φ1+b$ in $R(Φ1T)$.

From Theorem 1, we can find that the control (18) is only to account for the second-order form of the constraint, i.e., Eq. (9) or Eq. (14). That is, the control (18) is only able to guarantee Eq. (9) to be satisfied. If the initial condition of the system, $q(t0) and q˙(t0)$ with t0 the initial time, satisfies the first-order form of the constraint (12), i.e., $A(q(t0),q˙(t0),t0)q˙(t0)=c(q(t0),q˙(t0),t0)$, the control (18) can also guarantee Eq. (12) to be satisfied, since Eq. (12) can be obtained by computing the integral for Eq. (9) with respect to t. However, it is likely that the initial condition does not satisfy the constraint (12) in practice. Notice that the constraint (12) is the purpose of control design, it is necessary to add an additional control for dealing with possible initial condition deviation so that the constraint (12) can be satisfied, which will be discussed in the following section.

## Dealing With Initial Condition Deviation

Let $D(q,q˙,t):=M−1(q,q˙,t)$, and
$β(q,q˙,t):=A(q,q˙,t)q˙−c(q,q˙,t)$
(21)

$β̂(q,q˙,t):=(A(q,q˙,t)D(q,q˙,t)B(q,q˙,t))Tβ(q,q˙,t)$
(22)

Since the constraint (12) is the control purpose, β in Eq. (21) can be viewed as a directly measure of the system performance. This will be used in later development.

Assumption 3. For all$q∈Rn, q˙∈Rn, t∈R$, there exists a constant$λ¯>0$such that
$λm(A(q,q˙,t)D(q,q˙,t)B(q,q˙,t)×(A(q,q˙,t)D(q,q˙,t)B(q,q˙,t))T)≥λ¯$
(23)

Remark 3. Note that the matrix ADB(ADB)T is always positive semidefinite for all $q∈Rn, q˙∈Rn, t∈R$, hence all eigenvalues are non-negative. What this assumption adds is that the minimum eigenvalue will not equal zero and is always a finite distance away from 0 for all $q∈Rn, q˙∈Rn, t∈R$ (therefore not infinitesimally close to 0).

Now, we propose the following control to deal with possible initial condition deviation:
$τa(q,q˙,t)=−κβ̂(q,q˙,t)$
(24)

where κ > 0 is a constant.

The final control design for the system (1) is proposed as
$τ(t)=τn(q(t),q˙(t),t)+τa(q(t),q˙(t),t)$
(25)

Theorem 2. Subject to Assumptions 2 and 3, consider the system (1). The control (25) renders the following performance:

• (i)

Uniform stability: For each ζ > 0, there exists ξ > 0, such that if β(⋅) is any solution with $‖β(t0)‖<ξ$, then $‖β(t)‖<ζ$ for all t > t0.

• (ii)
Converge to zero: For any given constraint (12)
$limt→∞β=0.$
(26)
Proof. Choose the Lyapunov function candidate as
$V=βTβ$
(27)
In the proof, for simplicity, arguments of functions are omitted when no confusions are likely to arise. Taking derivative of V with respect to t yields
$V˙=2βTβ˙=2βT(Aq˙−b)=2βT{A[M−1(−Cq˙−g)+M−1B(τn+τa)]−b}=2βT[AM−1(−Cq˙−g)+AM−1Bτn−b]+2βTAM−1Bτa$
(28)
Note that $AM−1(−Cq˙−g)=Φ1a, AM−1B=Φ1Φ2$. Furthermore, since Assumption 3 imposes $λ(ADB(ADB)T)≠0$, we can obtain $rank [Φ1Φ2]=rank [ADB]≥1$. Therefore, by using Eq. (19), we have
$AM−1(−Cq˙−g)+AM−1Bτn−b=Φ1a+Φ1Φ2τn−b=b−b=0$
(29)
By Rayleigh's principle and Assumption 3, we have
$2βTAM−1Bτa=−2κβTADB(ADB)Tβ≤−2κλm(ADB(ADB)T)‖β‖2≤−2κλ¯‖β‖2$
(30)
Combining Eqs. (28)(30), we can obtain
$V˙≤0−2κλ¯‖β‖2=−2κλ¯‖β‖2$
(31)

Since the upper bound of the derivative of V is nonpositive and equals 0 only if β = 0, we have the uniform stability as well as the convergence of β to 0 as t. ◻

## Dynamical Model of an Underactuated Two-Wheeled Mobile Robot

Up to now, many dynamical models for two-wheeled mobile robots have been proposed. This paper adopts the one in Ref. [20], which takes frictions and input coupling into consideration. Figure 1 depicts the schematic of the 2 WMR. The wheels move along the road surface, and their displacement and velocity are, respectively, denoted by x and $x˙$ with rightward as the positive direction. The tilting angle and the angular velocity of the pendulum are, respectively, denoted by θ and $θ˙$, with the upright position as origin and clockwise rotation as the positive direction. φ is the slope angle of the road, and for the flat road, φ = 0. fr is the friction between the wheels and the road. fj is the joint friction acting on both the wheels and the pendulum as fj and −fj, respectively. u is the control torque generated by the motor which directly acts on the wheels with clockwise rotation as the positive direction. As the motor is directly mounted on the pendulum, there is a reaction torque −u directly applied to the pendulum.

According to Lagrangian mechanics, the dynamic equations of the 2 WMR are given by
$a1x¨+a2θ¨−mpl sin(θ+φ)θ˙2+sin φ(mp+mw)g0=1r(u+fj−rfr)$
(32)

$a2x¨+a3θ¨−mplg0 sin θ=−u−fj$
(33)
where $a1=mw+mp+Iw/r2, a2=mpl cos(θ+φ),and a3=Ip+mpl2$; mw, Iw, and r are the mass, rotation inertia, and radius of the wheels, respectively, mp and Ip are the mass and rotation inertia of the pendulum, respectively, l is the distance between center of gravity of the pendulum and the center of the wheel, and g0 is the acceleration of gravity. The frictions are modeled as a combination of viscous friction and Coulomb friction. That is, $fr=fvx˙+fcsgnx˙ and fj=fjvθ˙+fjcsgnθ˙$, where fv and fjv are viscous-friction constants, fc and fjc are Coulomb-friction constants, and sgn(⋅) represents the signum function. Substituting the expressions of the frictions into Eqs. (32) and (33) yields
$a1x¨+a2θ¨+fvx˙−(mpl sin(θ+φ)θ˙+fjvr)θ˙+sin φ(mp+mw)g0+fcsgnx˙−fjcrsgnθ˙=ur$
(34)

$a2x¨+a3θ¨+fjvθ˙−mplg0 sin θ+fjcsgnθ˙=−u$
(35)
which can be put in the form of Eq. (1) by letting
$q=[xθ], q˙=[x˙θ˙], q¨=[x¨θ¨], M=[a1a2a2a3]C=[fvmpl sin(θ+φ)θ˙+fjvr0fjv]g=[ sin φ(mp+mw)g0+fcsgnx˙−fjcrsgnθ˙−mplg0 sin θ+fjcsgnθ˙]B=[1r−1], τ=u$
(36)

Since the dynamic equations of the 2 WMR can be expressed in the form of Eq. (1), the robot motion control can be designed according to Secs. 3 and 4 if the proposed constraint can be expressed as Eqs. (12) and (9), which will be discussed in Sec. 6.

## Control Design for the Two-Wheeled Mobile Robot

### Constraint on the Two-Wheeled Mobile Robot Motion.

The proposed control design in Secs. 3 and 4 requires the number of the constraint to be equal to that of the control input. Since there is only one available control input, it is only able to impose one constraint on the 2 WMR motion. Generally, there are many choices of the constraint that can be expressed as Eqs. (12) and (9), either holonomic or nonholonomic. For well demonstration of the proposed control, we will consider two cases regarding different constraints—a holonomic one and a nonholonomic one.

#### Case 1: Holonomic Constraint.

For the physical meaning, we choose the holonomic constraint as
$θ=θd$
(37)

where θd > 0 is a constant. This constraint can render the wheels to move forward while keeping the pendulum approximately upright if we impose some restrictions on θd. The arguments are as follows.

First, since the upright position of the pendulum is at θ = 0, θd should be small (hence be close to “0”) so that the pendulum can be “approximately upright.” Second, taking derivative of Eq. (37) with respect to t twice yields
$θ˙=0, θ¨=0$
(38)
By Eqs. (34) and (35), we can eliminate the control u and obtain
$(ra1+a2)x¨+(ra2+a3)θ¨+rfvx˙−rmpl sin(θ+φ)θ˙2=mplg0 sin θ−rfcsgnx˙−r sin φ(mp+mw)g0$
(39)
Substituting Eqs. (37) and (38) into Eq. (39) yields
$(ra1+a′2)x¨+rfvx˙=mplg0 sin θd−rfcsgnx˙−r sin φ(mp+mw)g0$
(40)
where $a′2=mpl cos(θd+φ)$. Since θd is small (close to zero) and the absolute value of the slope angle of road, $|φ|$, is usually much smaller than π/2, it is reasonable to assume that $−π/2≤θd+φ≤π/2$. Therefore, we have $a′2≥0$. Now we impose the following restriction on θd:
$sin θd>rfc+r sin φ(mp+mw)g0mplg0$
(41)
This restriction can be easily satisfied since the values of r, mp, mw, and l are the designer's discretion. Consequently, we have
$mplg0 sin θd−rfcsgnx˙−r sin φ(mp+mw)g0>0$
(42)
for all $x˙∈R$. If $x˙>0$ at some time, then Eq. (40) becomes
$(ra1+a′2)x¨+rfvx˙=mplg0 sin θd−rfc−r sin φ(mp+mw)g0$
(43)
Combining r, a1, $fv>0, a′2≥0$, and $mplg0 sin θd−rfc−r sin φ(mp+mw)g0>0$, we can obtain from Eq. (43) that $x˙$ will converge to a positive value, which is
$vd=mplg0 sin θd−rfc−r sin φ(mp+mw)g0rfv$
(44)
If $x˙<0$ at some time, then Eq. (40) becomes
$(ra1+a′2)x¨+rfvx˙=mplg0 sin θd+rfc−r sin φ(mp+mw)g0$
(45)

Since $mplg0 sin θd+rfc−r sin φ(mp+mw)g0>0$, we can obtain from Eq. (45) that $x˙$ will converge to a positive value. When $x˙$ becomes positive, Eq. (40) becomes Eq. (43), and consequently, $x˙$ will converge to vd. In a conclusion, under the constraint (37), θ will converge to θd, $x˙$ will converge to a positive value, which is vd. That is, the 2 WMR will move forward while keeping the pendulum approximately upright under the constraint (37). Furthermore, since vd depends on θd, we can adjust the moving speed vd by choosing different θd.

To put the constraint into the form of Eqs. (12) and (9), we consider the following constraint that is equivalent to Eq. (37):
$θ˙+k̂(θ−θd)=0$
(46)
where $k̂>0$ is a constant. The constraint (46) can be cast into the form of Eqs. (12) and (9) with
$A=[01], c=−k̂(θ−θd), b=−k̂θ˙$
(47)

Note that the matrix A is of full rank. Therefore, $A+Ab=(ATA)−1AT︸A+Ab=b$, which verifies Assumption 1 according to Lemma 1. That is, the constraint (46) is consistent.

#### Case 2: Nonholonomic Constraint.

We choose the nonholonomic constraint as
$x˙=k0 tan(k1θ)$
(48)

where k0 > 0 and k1 ≥ 1 are constants. This constraint implies that the moving direction of the wheel will be consistent with the tilting direction of the pendulum. Furthermore, as the domain of $tan(·)$ is discontinuous at $k̃π+π2 (k̃∈Z)$, we can choose $k1θ(t0)∈(−π2,π2)$ so that $k1θ(t)∈(−π2,π2)$ for all t > t0. Therefore, this constraint can render the tilting angle of the pendulum θ to vary in the interval $(−π2k1,π2k1)$, whose midpoint is at the upright position (θ = 0). This will be reflected in the simulation results.

The constraint (48) can be cast into the form of Eqs. (12) and (9) with
$A=[10], c=k0 tan(k1θ), b=k0k1 sec2(k1θ)θ˙$
(49)

Note that the matrix A is of full rank, which can verify Assumption 1 by invoking the same argument in the case 1. Therefore, the constraint (48) is consistent.

### The Control Torque.

Since the dynamical model of the 2 WMR can be put in the form of Eq. (1) and the constraints can be put in the form of Eqs. (12) and (9), the robot motion control can be designed according to Secs. 35. If there is no initial condition deviation, the control torque, u, can be derived as τn in Eq. (18); if initial condition deviation exists, u can be derived as τ in Eq. (25).

### Design Procedure.

Figure 2 shows a flowchart to sum the control design procedure for the underactuated 2 WMR.

## Numerical Simulations

This section presents the numerical simulation results on the 2 WMR to verify the proposed control design approach. As a comparison, the standard linear quadratic regulator (LQR) (linear quadratic regulator) control is also applied to the 2 WMR, and corresponding simulation results are presented. The most common robustness measures attributed to the LQR are a one-half gain reduction in any input channel, an infinite gain amplification in any input channel, or a phase error of ±60 deg in any input channel. The calculation for the standard LQR control gain is based on linear system model. Therefore, to obtain the LQR control gain, we first apply standard (Jacobian) linearization on the dynamical model of the 2 WMR, i.e., Eqs. (32) and (33), and the resulting linear model is then used for the LQR design by invoking the standard procedure of calculating the LQR control gain (selecting the weighting matrices, solving the Riccati equation, etc.). All the simulations are implemented by using the ode15i algorithm in matlab, and the tolerance is chosen to be 10−8.

To begin with, we assume that the 2 WMR moves on flat road, i.e., φ = 0. Therefore, a2, C, and g can be rewritten as
$M=[a1a2a2a3], C=[fvmpl sin θθ˙+fjvr0fjv]g=[fcsgnx˙−fjcrsgnθ˙−mplg0 sin θ+fjcsgnθ˙]$
(50)

where $a2=mpl cos θ$. The parameters of the 2 WMR are chosen as follows: $mw=4 kg, Iw=0.08 kg·m2, mp=8 kg, Ip=0.2 kg·m2, r=0.2 m, l=0.25 m, fv=0.5$, fc = 1, fjv = 0.2, fjc = 0.3, and g0 = 9.81 m/s2. Here, the considered 2 WMR is not meant to emulate a SEGWAY. That is, it is unnecessary to consider the 2 WMR with the same size or mass as a SEGWAY. Actually, the 2 WMR model is suitable for various types of vehicles, from outdoor to indoor transportation. The parameters of the 2 WMR can take different values based on different engineering applications. The initial conditions are $x˙(0)=0.1 m/s, x(0)=0 m, θ˙(0)=0 rad/s, and θ(0)=0.08 rad$. Note that the initial conditions do not satisfy the constraints (46) and (48) in the two cases. As discussed in Sec. 6.2, we should apply the control torque u = τn + τa to the 2 WMR.

### Simulations for Case 1.

Regarding Assumption 2, we have
$Φ1Φ2=ADB=−a2+ra1r(a1a3−a22)$
(51)
As discussed in Sec. 6.1.1, we have $−π/2≤θ+φ=θ≤π/2$, and thus, $cos θ∈[0,1]$. Consequently, we can obtain $a2=mpl cos θ≥0$, and $(mw+mp+Iw/r2)Ip+(mw+Iw/r2)mpl2≤a1a3−a22=(mw+mp+Iw/r2)Ip+(mw+Iw/r2)mpl2+mp2l2(1−cos2θ)≤(mw+mp+Iw/r2)Ip+(mw+Iw/r2)mpl2+mp2l2$. Note that r and a1 are positive constants, hence we can obtain
$Φ1Φ2=−a2+ra1r(a1a3−a22)≤−a1(mw+mp+Iw/r2)Ip+(mw+Iw/r2)mpl2+mp2l2<0$
(52)
Therefore, Φ1Φ2 is always a 1 × 1 invertible matrix, indicating that Eq. (15) is consistent and Assumption 2 is verified. Furthermore, Eqs. (51) and (52) imply
$λm(ADB(ADB)T)=(a2+ra1r(a1a3−a22))2≥(a1(mw+mp+Iw/r2)Ip+(mw+Iw/r2)mpl2+mp2l2)2=λ¯>0$
(53)
which verifies Assumption 3. The parameters of the constraint are chosen as $k̂=1 rad and θd=0.1$. The control parameter is chosen as κ = 0.1. The desired tilting angle θd is small so that the pendulum can be approximately upright. Furthermore, we have $sin θd=0.0998>(rfc+r sin φ(mp+mw)g0/mplg0)=0.0102$, which satisfies the restriction (41). Figure 3 shows the time histories of $‖β‖$ under no control, the LQR control, and proposed control. The simulations under no control and the LQR control suffer interruptions due to the miracle of overflow. We can find that $‖β‖$ histories under no control and the LQR control are far away from zero, while the $‖β‖$ history under the proposed control converges to zero after some time, which echoes Theorem 2. Figure 4 shows the θ histories. Apparently, only the θ history under the proposed control converges to the desired titling angle θd, the other two histories do not. Figure 5 shows the $x˙$ histories. It can be found that the speed $x˙$ under the proposed control increases in the beginning and finally converges to vd, which is calculated from Eq. (44) as vd = 19.5873 m/s > 0. This verifies the discussions for the constraint in Sec. 6.1.1. Figure 6 shows the histories of control torque u. The LQR control input appears to be very large (at the level of 104 N⋅m) at around t =6 s, while the proposed control input keeps small all the time. The proposed control torque can be generated by using an appropriate motor. It can be found that the maximum value of the control torque is less than 3 N⋅m. Therefore, the proposed control torque can be generated by a motor whose rated torque is around or larger than 3 N⋅m.

Using the proposed control, we further investigate the relation between the speed $x˙$ and the desired titling angle θd. Figure 7 shows three different $x˙$ histories under three different desired tilting angles, i.e., θd = 0.1 rad, θd = 0.15 rad, and θd = 0.2 rad. It can be found that the larger θd is, the faster $x˙$ increases and the larger $x˙$ is. This is actually reflected by Eqs. (43) and (44), which implies that the acceleration and speed of the 2 WMR can be tuned by choosing different desired tilting angles.

### Simulations for Case 2.

By invoking similar arguments to that for case 1 (from Eqs. (51)(53)), we have
$Φ1Φ2=ADB=ra2+a3r(a1a3−a22)≥a3r((mw+mp+Iw/r2)Ip+(mw+Iw/r2)mpl2+mp2l2)>0$
(54)
since a3 > 0, which verifies Assumptions 2 and 3.

We choose three groups of constraint parameters for demonstration: k0 = 1, k1 = 5; k0 = 1, k1 = 10; and k0 = 1, k1 = 15. It can be noted that the three groups have the same k0 and different k1. The control parameter is chosen as κ = 1. Figure 8 shows the time histories of $‖β‖$ for the three groups of constraint parameters. The three $‖β‖$ histories all converge to zero after some time, which echoes Theorem 2. Figures 9 and 10, respectively, show the θ and $x˙$ histories of the three groups of constraint parameters. We can find that (1) all θ and $x˙$ histories are strictly positive, indicating that the moving direction of the wheel is consistent with the tilting direction of the pendulum and (2) all θ histories vary in the range of $(−π2k1,π2k1)$. This result verifies the discussions for the constraint in Sec. 6.1.2. Figure 11 shows the time histories of control torque u, which are all mild and can be generated by a motor whose rated torque is around or larger than 6 N⋅m.

## Conclusions

Controlling underactuated mechanical systems is often a very challenging problem. Past researches show many endeavors on applying conventional control methodologies (e.g., sliding model control). This paper, on the other hand, proposes a constraint-following approach to design the control. The constraints may be holonomic or nonholonomic, thus including a wide range of practical system needs. The control is designed in two steps. First, a control without considering initial condition deviation is designed. This sets the base for the second step, which deals with possible initial condition deviation. The control finally obtained is a model-based state feedback control, which is readily applicable. One salient feature is that no auxiliary variables (such as Lagrange multiplier) or pseudo variables (such as generalized speeds) are needed for the control. The control only uses physical variables. We believe that the proposed control design is the simplest and the approach may open a new avenue for controlling underactuated mechanical systems.

Using the proposed control design approach, we investigate two cases regarding different constraints on the 2 WMR motion: one for holonomic constraint and the other for nonholonomic constraint. Both constraints have specific physical meanings. Simulation results on the 2 WMR provided verify the effectiveness of the proposed approach.

## Funding Data

• National Natural Science Foundation of China (Grant No. 11572121; Funder ID: 10.13039/501100001809)

• Independent Research Projects of State Key Laboratory of Advanced Design and Manufacturing for Vehicle Body in Hunan University (Grant No. 71375004; Funder ID: 10.13039/501100003824)

• China Scholarship Council (Grant No. 201606130100; Funder ID: 10.13039/501100004543)

• Hunan Provincial Innovation Foundation for Postgraduate (Grant No. CX2016B081; Funder ID: 10.13039/501100010083).

## References

References
1.
Chiu
,
C. H.
,
2010
, “
The Design and Implementation of a Wheeled Inverted Pendulum Using an Adaptive Output Recurrent Cerebellar Model Articulation Controller
,”
IEEE Trans. Ind. Electron.
,
57
(
5
), pp.
1814
1822
.
2.
Yang
,
C.
,
Li
,
Z.
, and
Li
,
J.
,
2013
, “
Trajectory Planning and Optimized Adaptive Control for a Class of Wheeled Inverted Pendulum Vehicle Models
,”
IEEE Trans. Cybern.
,
43
(
1
), pp.
24
36
.
3.
Larimi
,
S. R.
,
Zarafshan
,
P.
, and
Moosavian
,
S. A. A.
,
2015
, “
A New Stabilization Algorithm for a Two-Wheeled Mobile Robot Aided by Reaction Wheel
,”
ASME J. Dyn. Syst. Meas. Control
,
137
(
1
), p.
011009
.
4.
Da Silva
,
A.
, and
Sup
,
F.
,
2017
, “
A Robotic Walker Based on a Two-Wheeled Inverted Pendulum
,”
J. Intell. Robot. Syst.
,
86
(
1
), pp.
17
34
.
5.
Mu
,
B.
,
Chen
,
J.
,
Shi
,
Y.
, and
Chang
,
Y.
,
2017
, “
Design and Implementation of Nonuniform Sampling Cooperative Control on a Group of Two-Wheeled Mobile Robots
,”
IEEE Trans. Cybern.
,
64
(
6
), pp.
5035
5044
.
6.
Huang
,
J.
,
Ri
,
M.
,
Wu
,
D.
, and
Ri
,
S.
,
2017
, “
Interval Type-2 Fuzzy Logic Modeling and Control of a Mobile Two-Wheeled Inverted Pendulum
,”
IEEE Trans. Fuzzy Syst.
,
26
(
4
), pp.
2030
2038
.
7.
Pathak
,
K.
,
Franch
,
J.
, and
Agrawal
,
S.
,
2005
, “
Velocity and Position Control of a Wheeled Inverted Pendulum by Partial Feedback Linearization
,”
IEEE Trans. Robot.
,
21
(
3
), pp.
505
513
.
8.
Seifried
,
R.
,
2014
,
Dynamics of Underactuated Multibody Systems
,
Springer International Publishing
,
Berlin
.
9.
Bullo
,
F.
,
Leonard
,
N. E.
, and
Lewis
,
A. D.
,
2000
, “
Controllability and Motion Algorithms for Underactuated Lagrangian Systems on Lie Groups
,”
IEEE Trans. Automat. Control
,
45
(
8
), pp.
1437
1454
.
10.
Bullo
,
F.
, and
Lynch
,
K. M.
,
2001
, “
Kinematic Controllability for Decoupled Trajectory Planning in Underactuated Mechanical Systems
,”
IEEE Trans. Robot. Autom.
,
17
(
4
), pp.
402
412
.
11.
Reyhanoglu
,
M.
,
van der Schaft
,
A.
,
Mcclamroch
,
N.
, and
Kolmanovsky
,
I.
,
1999
, “
Dynamics and Control of a Class of Underactuated Mechanical Systems
,”
IEEE Trans. Autom. Control
,
44
(
9
), pp.
1663
1671
.
12.
Behal
,
A.
,
Dawson
,
D.
,
Dixon
,
W.
, and
Fang
,
Y.
,
2002
, “
Tracking and Regulation Control of an Underactuated Surface Vessel With Nonintegrable Dynamics
,”
IEEE Trans. Autom. Control
,
47
(
3
), pp.
495
500
.
13.
Blajer
,
W.
, and
Kołodziejczyk
,
K.
,
2007
, “
Control of Underactuated Mechanical Systems With Servo-Constraints
,”
Nonlinear Dyn.
,
50
(
4
), pp.
781
791
.
14.
Liu
,
D.
,
Yi
,
J.
,
Zhao
,
D.
, and
Wang
,
W.
,
2005
, “
Adaptive Sliding Mode Fuzzy Control for a Two-Dimensional Overhead Crane
,”
Mechatronics
,
15
(
5
), pp.
505
522
.
15.
Muske
,
K. R.
,
Ashrafiuon
,
H.
,
Nersesov
,
S.
, and
Nikkhah
,
M.
,
2012
, “
Optimal Sliding Mode Cascade Control for Stabilization of Underactuated Nonlinear Systems
,”
ASME J. Dyn. Syst. Meas. Control
,
134
(
2
), p.
021020
.
16.
Park
,
B. S.
,
2015
, “
Neural Network-Based Tracking Control of Underactuated Autonomous Underwater Vehicles With Model Uncertainties
,”
ASME J. Dyn. Syst. Meas. Control
,
137
(
2
), p.
021004
.
17.
Yang
,
C.
,
Li
,
Z.
,
Cui
,
R.
, and
Xu
,
B.
,
2014
, “
Neural Network-Based Motion Control of an Underactuated Wheeled Inverted Pendulum Model
,”
IEEE Trans. Neural Networks Learn.
,
25
(
11
), pp.
2004
2016
.
18.
Cui
,
R.
,
Guo
,
J.
, and
Mao
,
Z.
,
2015
, “
Adaptive Backstepping Control of Wheeled Inverted Pendulums Models
,”
Nonlinear Dyn.
,
79
(
1
), pp.
501
511
.
19.
Guo
,
Z.
,
Xu
,
J.
, and
Lee
,
T.
,
2014
, “
Design and Implementation of a New Sliding Mode Controller on an Underactuated Wheeled Inverted Pendulum
,”
J. Franklin Inst.
,
351
(
4
), pp.
2261
2282
.
20.
Xu
,
J.
,
Guo
,
Z.
, and
Lee
,
T.
,
2014
, “
Design and Implementation of Integral Sliding-Mode Control on an Underactuated Two-Wheeled Mobile Robot
,”
IEEE Trans. Ind. Electron.
,
61
(
7
), pp.
3671
3681
.
21.
Chen
,
Y. H.
, and
Zhang
,
X.
,
2010
, “
Adaptive Robust Approximate Constraint-Following Control for Mechanical Systems
,”
J. Franklin Inst.
,
347
(
1
), pp.
69
86
.
22.
Chen
,
Y. H.
,
2009
, “
Constraint-Following Servo Control Design for Mechanical Systems
,”
J. Vib. Control
,
15
(
3
), pp.
369
389
.
23.
Noble
,
B.
, and
Daniel
,
J. W.
,
1977
,
Applied Linear Algebra
,
2nd ed.
,
Prentice Hall
,
Englewood Cliffs, NJ
.
24.
Rosenberg
,
R. M.
,
1977
,
Analytical Dynamics of Discrete Systems
,
Plenum Press
,
New York
.