Professional Documents
Culture Documents
1. Introduction
The aim of this workshop is to design and implement a feedback control system in order to balance an
inverted pendulum attached at the front of the LEGO MINDSTORM EV3 robot and to maintain it at
an upright position without any disturbances while the robot is in motion. To this end, a gyro
measurement of the angular rate of pendulum is available. The upright position is to be maintained in
the presence of disturbances that act on the pendulum particularly, an impulsive disturbance applied
manually to the top of the pendulum and a disturbance acting on the base of the pendulum due to the
motion of the robot corresponding to steering (reorientation of the heading).
2. System Modeling
The small signal dynamics about the pendulum on the vertical position are given by:
ml2 θ̈ = τ − bθ̇ + mglθ (Equation from Workshop4 handout)
where m is the equivalent pendulum mass in (kg), l is the length in (m), b is the coefficient of viscous
damping in (N.m.sec/rad) which we obtain by placing the robot upside down and swinging the
pendulum when the robot is static, τ is the motor torque in (N.m), g is the acceleration due to gravity in
(m/sec2) and θ is the angle in (radians). With τ = Kti = Kt R (v − Kb ˙θ), and taking the Laplace
transform gives -:
Θ(s) Kt /R
= K K (rad/V)
V(s) (s ×ml +s×(b+ t b )−mgl)
2 2
R
Accounting for the “percentage full power” units of the motor command and the gyro sensor and the
encoder angle measurement units, the transfer function obtained from motor command to the pendulum
angle in degrees is expressed as -:
Θdeg (s) 9 180 Kt /R
V% (s)
= 100 ∙ ∙
π (s2 ×ml2 +s×(b+KtKb )−mgl)
(deg/p.c.f.p.).
R
By taking the physical measurements, we get m = 0.25kg, l = 0.23m, b = 0.017. Using the stalled
characteristics, analysis of the electrical side( with back emf = 0) yield -:
Now to set the parameters we follow a two step procedure as expressed below -:
1. Initially the pendulum is placed upside down in a stable position with the robot being static.
Manually, the pendulum is pulled to the horizontal level making it parallel to the edge of the
table and then it is released. This is done to obtain the pendulum angles corresponding to various
time instances.
3.Controller Design
The task of controller design is aimed to achieve the following specifications as listed below-:
40π
internal stability with a phase margin of at least 180radians;
As it can be seen from the root locus, K> 6.5 for the system to be stable. In the next step we sketch the
Bode plots of G(s) with different values K(6.5, 7,8,10,11,12,50) in order to analyze the corresponding
phase margins.
Figure 5: Bode diagram of G(s) with different values of K
By choosing the value of K=8 and observing the bode plot as shown below, the phase margin of the
system is approximately equal to 1 and thus to match the desired phase margin, we choose our controller
to be in the form of a lead compensator as it pushes the phase up and by setting the parameters we will
be able to achieve the desired phase margin.
We add 40 degrees to the existing phase margin and the new phase margin is chosen to be 50
1−sinϕ 1
degrees. Also we ωc=ωmax = 6 rad/s. We get α = 1+sinϕmax = 0.132, Hence T = ωmax = 0.459.
max √𝑎
Ts+1 3.67s+8
So our controller transfer function is C(s) = 𝐾 αTs+1 = 0.06s+1
3.67s+8 0.0866
Hence, C(s)G(s) = 0.06s+1 ∗ 0.013225∗𝑠2 +0.0049302∗𝑠−0.5635
The bode plot of the open loop transfer function is shown below:
From the Bode plot it can be seen that the specification of phase margin <= 40 degrees is being
achieved.
The blue curve represents the simulated behavior while the yellow curve represents the real behavior.
By choosing the controller parameters and by observing the results, it is validated that the desired
specifications are met. The system overall matches the criteria of desired phase margin, internal stability
and complimentary sensitivity. As it can be seen that there is a visible difference between the real and
simulated behavior. This affirms that the reference tracking is not completely effective. This could
possibly be due to the time delay of the sensor or measurement disturbance.
5. Conclusion
The overall objective of this workshop, which was to design and implement a feedback controller to
balance an actuated inverted pendulum mounted on the robot has been met. This workshop helped the
team members in translating the knowledge obtained in regard to designing of feedback control systems
into practical application. Estimating the parameters by placing the robot upside down helped the team
to understand the need to be more innovative when it comes to designing. It was well established and
seen physically that the use of Lead Compensator type controller will result in an increase in phase
margin. However, the controller can further be optimized to make it more robust. For future references,
the parameters should be selected in order to achieve relatively higher phase margin that just 40 degrees.
Also due to the time constraint, we could only analyze the robot when it is in “drive” mode. To check
the robustness of our designed feedback control system and to optimize it further, it is recommended to
test the designed controller under “steer” mode as well, which would further help in analyzing which
parameters are required to be changed or if a completely different type of compensator should be used.