Vous êtes sur la page 1sur 22

Autores:

Harold Fernando Ruiz Bravo


Laura María Rodríguez Rivera
Andrés Pantoja Buchelli
Jhon Barco
Introduction
We are going to describe the use of a co-simulation between a free environment of
virtual plants (V-REP) and a common language for the study of control (Matlab), working
in a platform communicated by an API (application programming interface). To show the
methodology, a ball-and-plate system is presented.
Virtual Enviroment
A. V-REP
V-REP is a program with a free educational version that is used as a
tool to test and develop virtual robots and mechanical systems. It is
characterized by having extensive documentation, allowing importation
of 3D models.
B. V-REP Remote API
The remote API allows to control a simulation from an external application or a
remote hardware (e.g. real robot, remote computer, etc.). The V-REP remote API is
composed by approximately one hundred specific functions.
However, the original functions of the API are quite complex given the
large number of parameters they need to use. For this reason, we change
the remote script to provide an easy library to facilitate the link between
the two platforms.
On the other hand, since there is no way to
connect Simulink to Matlab, we created a block
that allows the connection between these for
greater ease of learning.
Study-Case
To illustrate the process of implementing virtual plants and
their control through Matlab, we present the development
of a ball-and-plate experiment.
A. Creation of the plant in V-Rep
B. Estimation of ball position by image processing
In order to know the position of the ball on the plate, a camera is used to send the
images to Matlab, where it is possible to obtain this value by means of image
processing.
B. Controller Design
Assuming complete symmetry in the system and that the ball does not slide
and is always in contact with the surface, a non- linear model describing the
behavior of the plant is given by
where 𝑥1 and 𝑥2 are the position
𝑥2 and velocity along the x-axis,
𝑥Ǘ1
𝑎 𝑥1 𝑈Ǘ𝑥2 + 𝑥3 𝑈𝑥ሶ 𝑈𝑦ሶ − 𝑔 𝑠𝑖𝑛(𝑈𝑥 ) respectively, while 𝑥3 and 𝑥4 are
𝑥Ǘ2
= 𝑥4 , the same variables on the y- axis.
𝑥Ǘ3
The inputs 𝑈𝑥 and 𝑈𝑦 are the
𝑥Ǘ4 𝑎 𝑥3 𝑈Ǘ𝑦2 + 𝑥1 𝑈𝑥ሶ 𝑈𝑦ሶ − 𝑔 𝑠𝑖𝑛(𝑈𝑦 )
angular positions of the
servomotor axes and 𝑔 is the
(0,0,0,0) linearization gravity.

0 1 0 0 0 0
𝐴= 0 0 0 0 𝐵 = −𝑎𝑔 0
,
0 0 0 1 0 0
0 0 0 0 0 −𝑎𝑔
As an initial point of comparison, a discrete PID controller is designed using two
independent loops (one for each motor). The tuning is performed in a single
subsystem and replicated for the second joint given the assumed symmetry in the
plant. The standard discrete control structure is defined as

The final values are


𝑘𝐼
𝑈 𝑧 = 𝑘𝑃 + + 𝑘𝐷 1 − 𝑧 −1 𝐸 𝑧 , 𝑘𝑃 =−0.4626,
1−𝑧 −1
𝑘𝑖 =−0.0029,
𝑘𝐷 = −5.3064.
for comparison purposes, a second controller is developed. A discrete lineal
quadratic controller is characterized by being an optimal, robust, and easy to
implement strategy with state feedback. Its operation is based on minimizing the
function
∞ I. LQR PARAMETERS AND CONSTANTS
𝑇
𝐽 = ෍ (𝑥 𝑘 𝑄 𝑥𝑘 + 𝑢𝑘𝑇 𝑅𝑢𝑘 ), LQR constant and input parameters Value

𝑘=0 𝟏 𝟎 𝟎
𝑄 𝟎 𝟓𝟎𝟎 𝟎
𝟎 𝟎 𝟎. 𝟏

𝑅 100

K [-0.5779 -1.1352 -0.0150]


Results
The results over the implemented plant are analyzed by comparing the response of
systems to the designed controllers in two scenarios: i) using ideal models in a
Simulink simulation, ii) with the interaction of the controllers in Matlab regulating
the ball position in the designed virtual plant through the co-simulation (with the
position of the ball obtained directly from the API, and iii) using the virtual plant in
co-simulation but using a camera to get the ball position

To test this plant, we propose to follow a simple trajectory, starting in rest at


position (0,0) cm, then changing setpoint every 40 seconds to (-5,-5), (-5,5), (5,5),
(5,-5) and (-5,-5) centimeters.
A. LQR Results
A. LQR Results
B. PID Results
B. PID Results
Conclusions
• The differences on the simulation and the virtual plant (with and without
camera) are remarkable in all the results.
• The signals obtained through the use of the camera (especially in Figures 5
and 6) present more oscillations due to the existing error in the conversion
of pixels by the low resolution of the image.
• The oscillations in the PID controller produce a longer settling time, while
the abrupt changes in the control signal allow the ball to slide, increasing
the errors.
• The LQR controller presents a higher performance in robustness, set time,
control signal and steady-state error over the PID controller.
Work Done

Vous aimerez peut-être aussi