Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

2017 13th International Conference on Natural Computation, Fuzzy Systems and Knowledge Discovery (ICNC-FSKD 2017)

Balance Control by Diffuse Logic for a Phoenix


Hexapod Robot
Darwin Alulema1, Cristian Andino1, Diego Rodríguez1, Alexander Ibarra1, Derlin Morocho1, Freddy Tapia2,
Víctor Proaño1 Verónica Alulema1
1
Departamento de Eléctrica y Electrónica 2
Departamento de Ciencias de la Computación
Universidad de las Fuerzas Armadas ESPE Universidad de las Fuerzas Armadas ESPE
Sangolquí, Ecuador Sangolquí, Ecuador

Abstract— Using diffuse control algorithms, a position control for diffuse logic is made, where is detailed its control structure and
the six extremities of the Hexapod Robot was built. As input to the the way how the extremities are going to be controlled to balance
controller, a LIS3DSH accelerometer was used, which gives the the hexapod robot at 0° tilt.
Roll values for the angle in which the accelerometer tilts, typical of
the Discovery STM32F4 card. It was necessary to build a PI
controller in order to reduce the error in stationary state and
stabilize the robot in a zero degree tilt position, allowing the
Hexapod robot to stand and balance automatically over different
surfaces.

Keywords- Phoenix Hexapod Robot, STM32F4 Discovery,


Diffuse Logic, Roll.

I. INTRODUCTION
Hexapod Robots present a big inconvenient while executing Figure 1. Phoenix Hexapod Robot
their movements, due to the dynamics and stability of the robot.
In order to give a solution to the balance, this work proposes A. STM32F4 Discovery card
diffuse logic, because it allows position controlling without the The STM32F4 DISCOVERY card has the following
necessity of an established mathematical model. characteristics:
The Phoenix hexapod robot (see Fig. 1) has a great similarity x STM32F407VGT6 microcontroller with 1 MB flash
to arachnids with three pairs of legs in matter of their body and memory, 192 KB RAM, LQFP100 encapsulating.
the articulations of their extremities. The 3 DOF (Degrees of x ST-LINK/V2 incorporated with selector mode for using
Freedom) characteristic of the Phoenix model, allow the robot to the kit as an independent ST-LINK/V2 (with SWD
walk in any direction. The Phoenix model presents three connector for programming and debugging).
servomotors for each extremity which gives a total of 18 x Board power supply: through USB bus or from a 5V
servomotors for the robot’s movement. The robot is built with external power supply.
ultra-resistant, high quality aluminum parts, making the robot x External application source: 5v y 3v.
very light and easy to control. The commercial controller for the x ST MEMS LIS3DSH motion sensor, accelerometer
Phoenix robot is the BotBoarduino SSC-32. This with three axis digital output.
microcontroller has a program created by Jeroen Janssen for the x Eight LEDs.
PWM impulses generation for the servomotors Hitec HS-645 x Two pushbuttons (user and reset).
(owned by the commercial house), controlling the walking x USB OTG with micro-AB connector. [6]
speed, direction, own axis rotation and height control by using
the servomotors in each extremity. Additionally presents another
controller named RC-01, which allows wireless manipulation of
the robot through PS2 controller, making it easier for the user to
control the robot. [4]
II. THEORETICAL FRAMEWORK
As a first point, a brief description of the STM32F4
Discovery card is presented. The STM32F4 card has a LIS3DSH
accelerometer, which is used for the balancing of the hexapod
robot on the Roll axis; and the Waijung Blocket library, which
allows the programming of the STM32F4 card through the
Matlab Simulink Platform. Later, a description of the theory of Figure 2. STM32F4 Discovery card

978-1-5386-2165-3/17/$31.00 ©2017 IEEE 1271


Waijung Blockset is a free library for Matlab Simulink. This systems and systems which mathematical models are very
library has been especially designed for supporting all the complex. The structure of a diffuse control is observed in Fig.5.
STM32F4 microcontroller family, which programming is based [5]
on Simulink blocks, making it easy to program all the
STM32F4 card family available on the market. The fuzzification has the objective to convert real values to
diffuse values. In fuzzification process, membership degrees
are assigned to each one of the input variables in relation to the
diffuse control previously defined, using the membership
functions associated to diffuse sets. The fuzzification decisions
must be made by:

• Number of inputs.
• Size of universes in discussion.
• Number and forms of the diffuse sets. [1]
The rule base contains the knowledge associated to the
application domain and the objectives of control. In this phase,
Figure 3. Waijung library programming blocks
there must be defined the linguistic rules of control that will
make the decisions that decide the way in which the system has
to work. An example of a rule would be: IF the temperature is
B. Motion sensor ST MEMS LIS3DSH
high THEN the fan must be turned on. [7]
The LIS3DSH sensor is found on the MB997C board
The inference relates the input and output diffuse sets, to
version of the STM32F4 Discovery card. The LIS3DSH is a low
represent the rules that will define the system. The inference
power, 3-axis, lineal accelerometer (see on Fig. 4). In this case,
uses the information to generate responses through the use of
roll axis is the only one used, which gives lineal values that
conditions.
describe the tilt angle in which the STM34F4 Discovery card is
found. Because the card is embedded into the main board of the
The defuzzification does the process of adequating the
hexapod robot, this will allow to indicate the tilt angle of the
diffuse values generated in the inference to real values, which
robot.
later will be used in the control process. The defuzzification
uses simple mathematical methods. [3]

Figure 5. Diffuse model structure

Figure 4. Axis of the LIS3DSH sensor


III. DIFFUSE CONTROL ALGORITHM
C. Diffuse Control System
The objective of the controller is to balance the position of
the robots base, which means, using its six extremities to
A diffuse control system works in a very different way to a achieve that its base is on a zero degrees tilt angle. It was used
conventional control system. These use the expert knowledge as input for the controller, the LIS3DSH accelerometer that
to generate a knowledge base, which will give the system the gives the Roll values of the angle.
capacity of making decisions about certain actions that occur on
operation. [2] A PI controller is made to reduce the error in stationary stat
and stabilizing the robot in an initial position, which is zero
Diffuse control allow to describe a set of rules to control a degree tilt, allowing the hexapod robot to stand and balance
process and beginning from these rules, generate the control itself automatically over different surfaces. The general schema
actions. Control diffuse systems can be applied in both simple

1272
of the diffuse controller is seen on Fig. 6, where is showed the VL Very Left, which membership function is in the range
set point value always as 0° tilt, the inputs are the tilt values of [-15000, -8000, -4000], being -15000 to -8000 a degree of
the accelerometer and the outputs go directly to the servomotors membership 1.
called the robot’s thighs. L Left, which membership function is triangular in the
range [-8000, -4000, 0].
C Center, which membership function is trapezoid in the
range [-2000, -1000, 1000, 2000].
R Right which membership function is triangular in the
range [0, 4000, and 8000].
VR Very Right, which membership function is in the
range [4000, 8000, 15000], being 8000 to 15000 a degree
of membership of 1.

Figure 6. Diffuse PI Control Diagram.

To solve the balancing on the Roll axis, the membership


functions and the rule set has to be defined. The Roll axis data
is gotten from the LIS3DSH accelerometer inside the STM32F4
Discovery card.
Figure 8. Roll Input Diffuse sets
One of the advantages of programming the STM32F4
Discovery card is that it presents various programmable As second input it has the integral of the error (errorRoll)
elements, in case of the diffuse control; there is the LIS3DSH that as universe of discourse is between [-5000, 5000], as shown
accelerometer that has the Waijung library with the respective in Fig. 9.
programming blocks. This accelerometer generates numeric
values of the Roll, Pitch, and Yaw axis. For the diffuse control,
it is made the balancing of the Roll axis, ergo the balancing
respect to the longitudinal axis, being the numerical values
positive a rotation to the right, and with negative numerical
values, a turn to the left; considering that the balance
longitudinal point is equal to zero. With these numerical values
of turn, the diffuse control of six servomotors (thigh
servomotors) is made to control the balance on the surface. Figure 9. Input diffuse sets: Integral of the error (erroRoll)

A. Fuzzification B. Rule base


The input is the numeric values of the accelerometer (Roll)
(See Fig. 7), and the integral of the sensor error (errorRoll). The Table I, shows the rule base for the balancing on the Roll
numeric values lend by the LIS3DSH accelerometer are axis. There are 5 diffuse sets on the Roll input and 3 diffuse sets
between the [-15000, 15000] range, which interpretation in in the input ErrorRoll, because of that, we have 5 * 3 = 15
angles is between [-90°, 90°], being -15000 equal to -90° y possible rules for each servomotor, namely that while
15000 equal to 90°. The accelerometer values are equal. controlling 6 servomotors, there could be a total of 90 rules.

TABLE I. RULE BASE

M* ErrorRoll
EI EC ED
VL MIM* MIM* IM*
L MIM* IM* CM*
Roll C IM* CM* DM*
D CM* DM* MDM*
VR DM* MDM* MDM*
* Represents the number of a servomotor. (1-6)

Figure 7. IS3DSH accelerometer signal C. Defuzzification

After the evaluation of the rule base for each servomotor,


The first input named Roll has as universe of discourse the the response for each one of them is gotten. There are 6 outputs
range between [-15000, 15000], being divided in five diffuse where each one of them controls a servomotor (Thighs) which
sets. (See Fig. 8). will present different universes of discourse with their
respective diffuse sets. Each servomotor has different PWM

1273
values, which are angles between -20° and 20° respect to the
longitudinal axis. The values of each servomotor in the Matlab
program can be observed in Table II.

TABLE II. PWM VALUES OF THIGH SERVOMOTORS

ServoMotors PWM Values


-20° 0° 20°
Thigh1 5 8.5 12
Thigh 2 5 8.5 12
Thigh 3 6 9.5 13
Thigh 4 3.5 7 10.5
Thigh 5 4 7.5 11
Thigh 6 4 7.5 11

The objective of the output values for each thigh servomotor,


is to maintain the robot’s base parallel to the longitudinal axis
no matter the angle of the surface. (See Fig.10).

Figure10. Hexapod robot tilt on surfaces

The diffuse sets for each servomotor are presented on


Fig.11. From where can be seen the five universes of discourse
that present (Very Left, Left, Center, Right, and Very Right).
Each servomotor has similar values of its universes of discourse
due to the symmetry that this hexapod robot has on its
extremities. The universe of discourse named Center has
trapezoid shape due to the sensor that has high noise sensibility
and that point is where the control system has to be more stable. Figure 11. Diffuse sets of the hexapod robot’s thighs a) thighs 1, 2,3 b)
thigs 4, 5,6

IV. PROGRAMMING OVER THE STM32F4 DISCOVERY CARD

On Fig. 12 the block diagram of the diffuse control


implemented in Matlab can be observed. The accelerometer
uses a digital filtering block for the input signal of the diffuse
control block (Fuzzy Logic Controller) to not capturing noise
values that the accelerometer can have and getting a better
control.

1274
On the next figure the controller response is oscillatory; this
is due the Kp affects the control’s action, making it faster and
oscillatory.

Figure 12. Diffuse control in Matlab Simulink

Figure 14. Controller response with Kp=1 y Ki=0.3


To reduce the error in stationary state and balancing the robot
in an initial position, namely, zero degrees tilt respect to the On Fig. 15, the controller is unstable, because of the integral
longitudinal axis, it was made a Diffuse Proportional Integral action, which is too high, and gives a very fast response of the
controller (Diffuse PI). This kind of controller allows that the controller and finds in oscillatory state.
stationary state presents zero error and evades the possible
oscillations in the equilibrium position or set point.
V. TUNING OF THE CONTROLLER PARAMETERS
Some adjustments were made experimentally to the
proportional and integral coefficients. Table III shows the
different experimented values of the coefficients and the
respective results.

TABLE III. RESULTS OF THE DIFFUSE CONTROL

Kp Ki Result
0.4 0.3 Stable system without error
Oscillatory system
1 0.3
(establishes after a time) Figure 15. Controller response with Kp=0.4 y Ki=1
0.4 1 Unstable system
0.5 0.5 Stable system with error Finally, on Fig. 16 the controller shows a good response
with a light error considerable for the balance of the hexapod
On Fig. 13 is observed the diffuse controller response with a robot, in difference to the control of the Fig. 13 that is ideal
zero error. These values for Kp and Ki were the most efficient without the presence of error.
for the robot´s balance. The Fig. 16 shows the test of the robot´s
balance. The time of testing is 0.01seconds with a total number
of 2000 samples gathered by the diffuse controller, which
represents the 100 samples per second.

Figure 16. Controller response with Kp=0.5 y Ki=0.5

Figure 13. Controller response with Kp=0.4 y Ki=0.3

1275
Figure 17. Balance execution of the hexapod robot.

VI. CONCLUSIONS
The STM32F4 card is a great utility as controller for the
hexapod robot, and allows embedding any code and Matlab
tool, such as: Fuzzy Controller and filtering blocks for signals.
This facilitates the creation of algorithms that control the
hexapod movement.

The balancing problem of the hexapod robot was solved


successfully through the use of a PI diffuse controller. The
inexistence of the mathematical model for the hexapod makes
it perfect the election of diffuse logic as control method.
Namely, the robot is controlled through “propositions” that are
not necessarily true or false.

The membership functions for the diffuse controller were


obtained experimentally. The number of these membership
functions affect directly to the controller response, while more
functions are developed, more accurate will be the response.
This implies an increase of the rule base that interacts in the
controller.

The gain values of the PI diffuse controller were obtained by


try and failure. The modification of these gains meet the theory
of control, where the Ki is the integral time, which regulates the
velocity of control action while the Kp affects both the integral
and proportional part of the control action.
REFERENCES
[1] Kevin Passino, Stephen Yurkovich, Fuzzy Control, Ohio, USA: Addison-
Wesley, 1998.

[2] Zdenko Kovacic, Stjepan Bogdan, Fuzzy Controller Design, Zagreb,


Croacia: Taylor & Francis, 2006.

[3] Berkan, Trubatch, «Fuzzy Systems Design Principles,» IEEE Press,


1996.

[4] Robot Shop Inc, «Lynxmotion,» Agosto 2012. [En línea]. Available:
http://www.lynxmotion.com/c-117-phoenix.aspx.

[5] Roberto Supo, Lógica Difusa, Tacna, Perú: Universidad Nacional Jorge
Basadre, 2003.

[6] Aimagin, «Waijung Blockset,» 21 Abril 2015. [En línea]. Available:


http://waijung.aimagin.com/.

[7] Pedro Ponce Cruz, Inteligencia Artificial con Aplicaciones a la


Ingeniería, México D.F.: AlfaOmega, 2010.

1276

You might also like