Thesis-4709354-ECTE953 PDF full

53
1 Trajectory control of a DYNAMIXEL PRO Make H42-20-S300-R model (2 DOF Robot arm) using Fuzzy logic control (FLC) A thesis submitted in partial fulfilment of the requirements for the award of the degree Masters of Professional Engineering (Major in Electrical Engineering) From University of Wollongong By Kalpitkumar Thakar (4709354) School of Electrical, Computer and Telecommunications Engineering November, 2016 Supervisor: Prof. Fazel Naghdy

Transcript of Thesis-4709354-ECTE953 PDF full

Page 1: Thesis-4709354-ECTE953 PDF full

1

Trajectory control of a DYNAMIXEL PRO Make H42-20-S300-R

model (2 DOF Robot arm) using Fuzzy logic control (FLC)

A thesis submitted in partial fulfilment of the

requirements for the award of the degree

Masters of Professional Engineering

(Major in Electrical Engineering)

From

University of Wollongong

By

Kalpitkumar Thakar (4709354)

School of Electrical, Computer and

Telecommunications Engineering

November, 2016

Supervisor: Prof. Fazel Naghdy

Page 2: Thesis-4709354-ECTE953 PDF full

2

Abstract

Control Engineering is a vast and fascinating field of Engineering, but at the same time, many of

control engineering students are having different sorts of problems in understanding the practical

aspects of control techniques for a robotic arm. In the era of inventions, there are many control

techniques are developed to control a robotic arm. In this particular project, I will control and

monitor the results of DYNAMIXEL PRO Make H42-20-S300-R model (2 DOF Robot arm) using

MATLAB and FLC (Fuzzy logic control) because FLC enables design engineers to model very

complex systems more swiftly and effectively than traditional approaches and methods. The aim

of this project is to help control engineering students to understand how to control robotic arm

using MATLAB and FLC (fuzzy logic control). The DYNAMIXEL PRO Make H42-20-S300-R (2-DOF

robot arm) has 2 revolute joints, and both joints are connected to each other with cylindrical rods

in order to make 2-DOF robot arm. Both revolute joints revolve with the help of the connected

servo system and move in the same plane (trajectory).

Here, the DYNAMIXEL PRO Make H42-20-S300-R (2-DOF robot arm) has been controlled using

different control environments: the first control technique was done by using “ROBOPLUS

(Dynamixel Wizard)” standard software, which is created by hardware manufacturer. The second

control technique is “MATLAB” software, and the third and final control technique approach was

done using “FLC (fuzzy logic controller)”.

The first control environment was successfully done by “ROBOPLUS (Dynamixel Wizard)”, the

results of this control technique showed, it was not very friendly for users and most of the time, it

needed modification in the program, which was not an easy task for any user to include feedback

and further develop PID control due to aforementioned reason a “MATLAB” based control

technique was developed, and it (2-DOF robot arm) connected with “MATLAB” software. In this

case, experimental results showed that the goal positions and the goal accelerations of this Robot

arm could be controlled, and most importantly the goal accelerations of the 2-DOF robot arm can

be controlled while changing its goal position.

In the end, I will explain about future recommendations for the possible use of integrating with

various other softwares such as LABVIEW, C, C++, JAVA, Visual Basic, Python and so on.

Page 3: Thesis-4709354-ECTE953 PDF full

3

Acknowledgement

I would like to express my sincere thank to Professor Fazel Naghdy, My supervisor, who gave me

this chance to do this project. He has been very generous with guidance, constant support and

valuable time throughout this task.

Last, but not the least, I am also grateful to all, who have helped, motivated and encouraged me to

complete this project.

Page 4: Thesis-4709354-ECTE953 PDF full

4

Statement of Originality

I, Kalpitkumar Thakar, declare that this thesis, submitted as part of the requirements for the award

of Master of Engineering, in the School of Electrical, Computer and Telecommunications

Engineering, University of Wollongong, is wholly my own work unless otherwise referenced or

acknowledged. The document has not been submitted for qualifications or assessment at any other

academic institution. As author of this thesis, I also hereby grant, subject to any prior confidentially

agreements, SECTE permission, to use, distribute, publish, exhibit, record, digitize broadcast,

reproduce and archive this work for the purposes of further research and teaching.

Signature:

Name: Kalpitkumar Thakar

Student ID: 4709354

Date:

Page 5: Thesis-4709354-ECTE953 PDF full

5

Table of content

Topic Pg. No.

Abstract 2

Acknowledgement 4

Statement of Originality 5

Table of Content 6

List of Figures 8

List of Tables 9

Notation 10

Chapter – 1 Introduction

1.1 Overview

1.2 Importance of Project

1.3 Objectives

11

Chapter – 2

2.1 Literature Review

2.2 Kinematics & dynamics of a 2-DOF robot arm

13

Chapter – 3 Experimental design

3.1 Hardware

3.2 Software

3.3 Block Diagram & specification

3.4 Connection & Set up for experiment

3.5 Operating Modes of 2-DOF robot arm

19

Chapter – 4 Modelling

4.1 MATLAB modelling

4.2 Simulink modelling

29

Page 6: Thesis-4709354-ECTE953 PDF full

6

4.3 FLC Modelling

Chapter – 5 Results & Conclusion

5.1 Results

5.2 Conclusion

5.3 Future work

43

References 46

Appendix A 47

Appendix B 50

Appendix C 51

Page 7: Thesis-4709354-ECTE953 PDF full

7

List of Figures

Topic Pg. No.

Figure 2.1: Estimated worldwide annual supply of industrial robots 13

Figure 2.2: Overview of Control Structure of 2DOF robotic arm 15

Figure 2.3: Schematic representation of a 2-DOF robot arm manipulator 16

Figure 3.1: DYNAMIXEL PRO Make H42-20-S300-R model 19

Figure 3.2: Dynamixel Pro Power supply circuit board 19

Figure 3.3: Dynamixel Pro USB2DXL dongle 20

Figure 3.4: Lists of softwares can be used to control dynamixel Pro 21

Figure 3.5: RoboPlus software 21

Figure 3.6: Block representation of Fuzzy Logic Controller 22

Figure 3.7: Block diagram of the project 24

Figure 3.8: Two Dynamixel pro servo motors connection with USB dongle 25

Figure 3.9: 4-pin connection and servomotor connection points 26

Figure 3.10: Dynamixel PRO goal angle and goal position relation 27

Figure 4.1: Figure 4.1: Dynamixel Wizard window for COM Port connection 28

Figure 4.2: Dynamixel Wizard Parameter Window 29

Figure 4.3: Result of the servomotor-1 to an angular position of 1 radian 31

Figure 4.4: Result of the servo motor-2 to an angular position of 1 radian 32

Figure 4.5: Simulink model for each servo individually 33

Figure 4.5.1: Function Block Parameters 33

Figure 4.6: Simulink model for both servos at a same time 34

Page 8: Thesis-4709354-ECTE953 PDF full

8

Figure 4.6.1: Function Block Parameters 35

Figure 4.6.2: Function Block Parameters 35

Figure 4.7: Fuzzy Logic Schematic for the 2-DOF robot arm control system 36

Figure 5.1: Result of the servo motor-1 at -1 and servo motor-2 at -1 42

Figure 5.2: Result of the servo motor-1 at -0.5 and servo motor-2 at -0.5 43

Figure 5.3: Result of the servo motor-1 at 0 and servo motor-2 at 0 43

Figure 5.4: Result of the servo motor-1 at 0.5 and servo motor-2 at 0.5 44

Figure 5.5: Result of the servo motor-1 at 1 and servo motor-2 at 1 44

Figure 5.6: Dynamixel Pro control methods 45

Page 9: Thesis-4709354-ECTE953 PDF full

9

List of Tables

Topic Pg. No.

Table 3.1: Table for Fuzzy logic mathematical operations 23

Table 3.2: Specification table of Dynamixel pro 24

Table 3.3: Table for Fuzzy logic operation modes 27

Table 4.1: FLC computational steps 36

Page 10: Thesis-4709354-ECTE953 PDF full

10

Notation

Symbols

I – Current

V – Voltage

1ϕ – Single phase

θ – Displacement

g – Gravity

τ – Torque

μ – Membership function

Abbreviations

DOF – Degree of Freedom

Dynamixel Pro – Dynamixel make H42-20-S300-R (2-DOF robot arm)

PC – Personal Computer

FLC – Fuzzy Logic Control

USB2DXL – USB to Dynamixel PRO Dongle

Goal Position – Angular position

Goal Acceleration – Speed/Velocity

AC – Alternating Current

DC – Direct Current

RPM – Rotations per minute

PID – Proportional Integral derivative

PD - Proportional derivative

IJC – Independent Joint Control

Page 11: Thesis-4709354-ECTE953 PDF full

11

Chapter 1 - Introduction

1.1 Overview

The aim of the project is to study, control and monitor the results of the given 2-DOF Robot arm

using MATLAB and FLC. The robot has 2 revolute joints, and both joints are connected to each other

with cylindrical rods in order to make 2-DOF robot arm. Both revolute joints revolve with the help

of the connected servo system and move in the same plane (trajectory). The robot arm is interfaced

to a PC through USB2DXL, a Serial communication (RS 485). The robot can operate in three modes,

which are Position mode, Velocity mode, and torque mode. In this project, the robot arm will be

controlled in each mode individually. For example, I will run the given robot arm at various

velocities in this mode robot arm can rotate at desired velocity and I will check its results. Similarly,

the given robot arm will run in various joint modes, which controls velocity and the positions of the

robot arm. In this given robot, the position ranges between 180 degrees (151875) to -180 degrees (-

151875) and the joint mode results will be monitored. The robot arm can move to the desired

position at the desired velocity. Finally, I will operate a robot arm at various torque. This mode can

control the output torque and the performance of the robot arm will be measured.

1.2 Importance of Project

The project is very important in the field of control engineering and it will give the idea about

applying FLC to the given robot arm. The project will also cover various aspects of robot arm

control with a fuzzy logic control such as velocity control, torque control and position control of a

robot arm.

Today, many industries accept and welcome robot arm technologies to increase productivity and

accuracy and meet their desired requirements. Hence, programming the robot arm with FLC is

very important because this is one of the unique and effective ways to control of the given robot

arm. This project will help control engineering students to gain knowledge about robot arm

control with FLC.

Page 12: Thesis-4709354-ECTE953 PDF full

12

1.3 Objectives

The main aim of the project is to study and understand the control of the 2-DOF robot arm using

FLC. The following objectives will be pursued:

[1] A better understanding of the application of the FLC to the given robot arm will be developed.

[2] The robot arm will be analytically modelled,

[3] A FLC will be developed to control the 2 - DOF planar robot.

Page 13: Thesis-4709354-ECTE953 PDF full

13

Chapter 2 – Literature Review

2.1 Literature Review

Flexible Automation is playing a significant role in the modern manufacturing industry around the

globe. Especially, robotic arm technology has become an increasingly common in many industries

because of its high precision; improve productivity, reliability and very little supervision. All

industrial robotic arms have two basic elements, one is the manipulator arm and another is the

controller of this robotic arm. It is also one of the popular illustrations of trajectory-following

electromechanical system; it presents various challenges in control because of its nonlinearities &

strong couplings represent in the dynamics of the robot manipulator [Mahmoud M. Othman,

Abdel Badie Sharkawy, and Abouel Makarem A. Khalil, January, 2010].

Since last decade, the Robotic arm control system has come out rapidly as an active area of

research.

[International Federation of Robotics, 2015]

Figure 2.1 Estimated worldwide annual supply of industrial robots

Page 14: Thesis-4709354-ECTE953 PDF full

14

Robotic arms are becoming popular in several applications such as pick and place, grinding,

welding, painting, mechanical handling, assembling and other industrial applications. Many of

robotic arm controls, industrial and commercial approach deals with the joints of robotic arm

created of servomechanism with PID, PD and IJC [Osman, 1991]. Most of current industrial

approaches to the robotic arm control design to treat each joint of the manipulator as a simple

linear servomechanism with simple controller like independent Joint Control (IJC), Proportional

Derivative (PD), or Proportional Integral Derivative (PID) controllers.

There is a long history of the control design of robotic arm; it provides control engineer a good

opportunity to learn intelligent control based techniques such as computed torque method,

optimal control, Variable Structure Control (VSC), Neural Networks (NNs), Fuzzy system [Reham H.

Mohammed, Fahmy Bendary Benha, Kamel Elserafi, 2013]. The Dynamixel servo motors (Dynamixel

Pro) are used widely in many developments and research projects around the world. The biggest

advantage of dynamixel servos are robust, fast, and they are easy to program, therefore they

become a smart actuators for precision control [Ahmad Zahid Rao, 2013].

Popularity of the Fuzzy logic control (FLC) has increased in the last couple of years.

FLC design fol lows the linguistic structure and it g i v e s u s a v e r y g o o d

performance for all non-linear systems.

However, in Fuzzy logic control (FLC) we need to include parameters such as linguistic

control rules and limits and membership functions for a given system. A major

disadvantage is i ts tuning process becomes more and more difficult for control

engineers and moreover it is very t ime consuming as well. Especially, when system

inputs and outputs are increased [Zafer Bingul, Og zuhan Karahan, 2010].

Lastly, below figure is a representation of an overview of the control structure of 2

DOF robot arm and here, in this project, I am using a non-model based Fuzzy logic

control to control 2-DOF robotic arm manipulator.

Page 15: Thesis-4709354-ECTE953 PDF full

15

Figure 2.2: Overview of Control Structure of 2 DOF robotic arm

Nonetheless, when linkages of the robotic arm are moving at high speed and at a same time, the

nonlinear coupling of the robot arm and the interaction forces between the links of robotic arm will

be responsible to decrease the overall performance of the system and it improves the performance

of the tracking error. The disturbances and uncertainties like as the variable payload in a task cycle

can be one reason for the poor tracking performance of the robotic arm system [Osman, 1991].

Literature review also includes the kinematics & dynamics of the given 2 DOF robot arm. It is

explained in numerical analysis as below further.

2.2 Kinematics & dynamics of a 2-DOF robot arm

For developing a control strategy for the positioning of a 2-DOF robot manipulator, an

understanding of the kinematics and further dynamics of the manipulator need to be examined.

Page 16: Thesis-4709354-ECTE953 PDF full

16

Figure 2.3: Schematic representation of a 2-DOF robot arm manipulator

A 2-DOF robot arm is shown in Figure 2.3; Robotic arm kinematics and dynamics calculation can be

done as follow:

𝑥₁ = 𝑙₁𝑠𝑖𝑛𝜃1 (E.1)

𝑦₁ = 𝑙₁𝑐𝑜𝑠𝜃1 (E.2)

𝑥₂ = 𝑙₁𝑠𝑖𝑛𝜃1 + 𝑙₂sin(𝜃1 + 𝜃2) (E.3)

𝑦₂ = 𝑙₁𝑐𝑜𝑠𝜃1 + 𝑙₂cos(𝜃1 + 𝜃2) (E.4)

Where, 𝑙₁ - Length of link 1.

𝑙₂ - Length of link 2.

𝜃1 - Angle between link-1 and positive y axis.

𝜃2 - Angle between link-2 and positive y axis.

g - Gravitational constant to include the effects of inertia and self weight of robot linkages.

Now, we can use Lagrangian formulation to find the overall energy contributions of the system

𝛤 = 𝐾𝑖𝑛𝑒𝑡𝑖𝑐𝑒𝑛𝑒𝑟𝑔𝑦𝑜𝑓𝑡ℎ𝑒𝑠𝑦𝑠𝑡𝑒𝑚 − 𝑝𝑜𝑡𝑒𝑛𝑡𝑖𝑎𝑙𝑒𝑛𝑒𝑟𝑔𝑦 Of the system (E.5)

Therefore, the kinetic energy can be formed as below

𝐾𝑖𝑛𝑒𝑡𝑖𝑐𝑒𝑛𝑒𝑟𝑔𝑦 = 0.5(m₁x1̇2 + m₁y1̇

2 +m₂x2̇2 +my2̇

2) (E.6)

Page 17: Thesis-4709354-ECTE953 PDF full

17

Overall kinetic energy can be calculated as

𝐾𝑖𝑛𝑒𝑡𝑖𝑐𝑒𝑛𝑒𝑟𝑔𝑦 = 0.5((𝑚₁ +𝑚₂)𝐿12𝜃1̇ +𝑚₂𝐿2

2𝜃1̇ +𝑚₂𝐿22𝜃2̇𝜃2)̇ + 𝑚₂𝐿2

2𝜃2̇𝜃1̇ +

𝑚₂𝐿1𝐿2𝑐𝑜𝑠𝜃2(𝜃1̇𝜃2̇ + 𝜃1̇𝜃1̇) (E.7)

Same as above, the potential energy of the 2-DOF robotic arm can be represented as

𝑃𝑜𝑡𝑒𝑛𝑡𝑖𝑎𝑙𝑒𝑛𝑒𝑟𝑔𝑦 = 𝑚₁𝑔𝑙₁𝑐𝑜𝑠𝜃1 +𝑚₂𝑔𝑙₁𝑐𝑜𝑠𝜃1 +𝑚2𝑔𝑙₂ cos(𝜃1 + 𝜃2) (E.8)

Substitute equations (E.7) and (E.8) into the equation (E.5) the Lagrangian formulation of the

system in Figure 1 can be calculated as

0.5((𝑚₁ +𝑚₂)𝑙₁²𝜃1̇ +𝑚₂𝑙₂²𝜃1̇ +𝑚₂𝑙₂²𝜃2̇𝜃2)̇ + 𝑚₂𝑙₂²𝜃2̇𝜃1̇ +̇ 𝑚₂𝑙₁𝑙₂𝑐𝑜𝑠𝜃2(𝜃1̇𝜃2̇ + 𝜃1̇𝜃1̇) −

𝑚₁𝑔𝑙₁𝑐𝑜𝑠𝜃1 − (𝑚₂𝑔𝑙₁𝑐𝑜𝑠𝜃1 +𝑚₂𝑔𝑙₂ cos(𝜃1 + 𝜃2))(E.9)

We can use (E.9) the dynamic equations of motion can be expressed using Lagrange’s first principle

𝐹𝜃1,2 = 𝑑/𝑑𝑡 [𝜕Γ

𝜕𝜃1,2̇] −

𝜕Γ

𝜕𝜃1,2 (E.10)

Each respective operator substitute into equation (E.10) in the equations of motion for a 2-DOF

robot arm calculated as above

((𝑚₁ +𝑚₂)𝑙₁² +𝑚₂𝑙₂² + 2𝑚₂𝑙₁𝑙₂𝑐𝑜𝑠𝜃2)𝜃1̈ + (𝑚₂𝑙₂² +𝑚₂𝑙₁𝑙₂𝑐𝑜𝑠𝜃2)𝜃2̈ −𝑚₂𝑙₁𝑙₂𝑠𝑖𝑛𝜃2(2𝜃1̇𝜃2̇ +

𝜃22̇) − (𝑚₁𝑔𝑙₁𝑠𝑖𝑛𝜃1 +𝑚₂𝑔𝑙₁𝑠𝑖𝑛𝜃1) − 𝑚₂𝑔𝑙₂𝑠𝑖𝑛(𝜃1 + 𝜃2) = 𝐹𝜃₁ (E.11)

𝑚₂𝑙₂²𝜃1̈ +𝑚₂𝑙₁𝑙₂𝑐𝑜𝑠𝜃2𝜃1̈ +𝑚₂𝑙₂²𝜃2̈ −𝑚₂𝑙₁𝑙₂𝑠𝑖𝑛𝜃2𝜃1̇𝜃2̇ −𝑚₂𝑔𝑙₂𝑠𝑖𝑛𝜃₁ +𝑚₂𝑔𝑙₂𝑠𝑖𝑛𝜃2) = 𝐹𝜃₂

(E.11)

For a 2-DOF robot arm equations (E.10) and (E.11) can be arranged and put into the matrice with

the system equation

𝐵�̈� + 𝐶�̇� + 𝐺𝑞 = 𝐹 (E.12)

Here,

𝑞 = [𝜃1𝜃2]

Page 18: Thesis-4709354-ECTE953 PDF full

18

𝐵 = [((𝑚₁ +𝑚₂)𝑙₁² +𝑚₂𝑙₂² + 2𝑚₂𝑙₁𝑙₂𝑐𝑜𝑠𝜃2) 𝑚₂𝑙₂² +𝑚₂𝑙₁𝑙₂𝑐𝑜𝑠𝜃2

(𝑚₂𝑙₂² +𝑚2𝑙₁𝑙₂𝑐𝑜𝑠𝜃2) 𝑚₂𝑙₂²]

𝐶 = [𝑚₂𝑙₁𝑙₂𝑠𝑖𝑛𝜃2(2𝜃1̇𝜃2̇ + 𝜃2

2̇)

𝑚₂𝑙₁𝑙₂𝑠𝑖𝑛𝜃2𝜃1̇𝜃2̇]

𝐺 = [−(𝑚₁ +𝑚₂)𝑔𝑙₁𝑠𝑖𝑛𝜃1 −𝑚₂𝑔𝑙₂𝑠𝑖𝑛(𝜃1 + 𝜃2)

𝑚₂𝑔𝑙₂𝑠𝑖𝑛(𝜃1 + 𝜃2)]

𝐹 = [𝑓𝜃1𝑓𝜃2

]

[shahab, Masoud,2008].

Page 19: Thesis-4709354-ECTE953 PDF full

19

Chapter 3 – Experimental Design

3.1 Hardware

Hardware requirements are as below for the given 2-DOF robotic arm,

[1] DYNAMIXEL PRO Make H42-20-S300-R model 2 DOF Robot arm System.

Figure 3.1: DYNAMIXEL PRO Make H42-20-S300-R model

[2] 24VDC Power Supply for a DYNAMIXEL PRO Make H42-20-S300-R model 2 DOF Robot System.

Page 20: Thesis-4709354-ECTE953 PDF full

20

Figure 3.2: Dynamixel Pro Power supply circuit board

[3] USB2DXL dongle for Serial communication with PC.

It uses the RS-485 communication protocol. Here, we are required to position the switch from USB-

to-Dynamixel dongle to RS485. [Quick Start for Dynamixel Pro v1.00b, “User Manual”].

Figure 3.3: Dynamixel Pro USB2DXL dongle

Latency Time can be done as below.

Under Windows Device Manager -> Port -> USB Serial Port (right mouse click) -> properties -> Port

Setting -> Advanced -> Latency Timer (msec) -> set to 1msec.

[4] PC (Personal Computer) with MATLAB software.

3.2 Software

Lists of below softwares can be used to control 2-DOF robot arm such as C, C++, Visual basic, Java,

Labview, Python, MATLAB and so on. In this project, we use MATLAB-Simulink and Fuzzy logic

control.

Page 21: Thesis-4709354-ECTE953 PDF full

21

Figure 3.4: Lists of softwares can be used to control dynamixel Pro

[nodna.de/Dynamixel-Pro-H42-20-S300-R_1]

[1] RoboPlus – It is a standard software, which is designed by Dynamixel Pro manufacturer to

control the given 2-DOF robotic arm.

Figure 3.5: RoboPlus software

Page 22: Thesis-4709354-ECTE953 PDF full

22

[2] MATLAB – It is the basic platform on which we will run all the programs for the given project.

[2.1] Simulink – Whole task of the given project is developed on the Simulink model. In Simulink,

We can develop the logic by using the Simulink blocks for simulink library and it is an easy way to

develop the program.

Some advantages of Simulink:

1. Simulink has a simulink library. Where, we can find various logic blocks to make simulink

model.

2. We can use Graphical Interface to design and analyse the logic.

3. Simulink has an error detection tool inside.

4. Simulink allow us to use other MATLAB tools for the given project.

[2.2] Fuzzy Logic Toolbox – It is a part of MATLAB software. Most of “FLC” are consisted of closed-

loop system (feedback system). It (FLC) gives an input to the process by gathering information of

required output. “FLC” have a number of parameters and all of them are needed to configure prior

to start program, such as input membership functions, fuzzification method, output membership

functions, rule base, premises connective, inference method and defuzzification.

Figure 3.6: Block representation of Fuzzy Logic Controller

Page 23: Thesis-4709354-ECTE953 PDF full

23

Where, r (t) is kwon as the reference signal

u (t) as the input signal

and y (t) as the output signal

In above figure, we can see that there are 4 major process components of the FLC. First one is

fuzzification, it switches the crisp signal in to fuzzy signal. Second one is Rule-base, it is for making

rules, it helps in decision making process and, Inference mechanism can be able to take its decision

by using information from reference signal, output signal and Rule-base. Third one is a De-

fuzzification, It switches the fuzzy signal back to crisp signal.

Mainly, the crisp signal is like a real number, it also follows the math rules but, on the other hand,

fuzzy signal is completely different from crisp signal. Here, we can’t apply basic math operations to

it because its calculations are done by fuzzy-logic sets.

Fuzzy-logic sets

All the Math operations and calculations can’t be applicable to the fuzzy-logic. For making the

mathematical operation happen in the FLC, we need to make fuzzy-logic sets, which are based on

its Membership functions. Where, all the crisp inputs and crisp outputs are categorizing into

different sets on the basis of its Linguistic Variables and, it is known as Fuzzy-logic sets. The math

operations, which are applicable are AND, OR and NOT.

Fuzzy Intersection (AND operation) A1∩A2 = min { µA1, µA2 }

Fuzzy Union (OR operation) A1∪A2 = max { µA1, µA2 }

Fuzzy Subset µA1 ≤ µA2 ; Where, A1 is the subset of A2

Fuzzy Complement (NOT operation) µA2 = 1 - µA1 ; Where, A1 is the complement of A2

[Kevin M. Passino, Stephen Yurkovich, 1998]

Table 3.1: Table for Fuzzy logic mathematical operations

3.3 Block diagram & Specification

Block diagram of the given the 2-DOF robotic arm system in shown in figure 3.9.

Page 24: Thesis-4709354-ECTE953 PDF full

24

Figure 3.7: Block diagram of the project

Specifications of the Dynamixel Pro make H42-20-S300-R

Specifications Data Unit

Rated Voltage

24 V

No load current

0.57 A

No load speed 32.7 RPM

Continuous operation

Current 1.5 A

Speed 29.8 RPM

Torque 6.3 N.M

Resolution 303800 Step/turn

Gear ratio 304 -

Backlash 3.8 Arc/min

Interface RS485

Operating temperature 5 to 55 Degree C

Weight 20 W

Dimensions 42*42*84 mm

Table 3.2: Specification table of Dynamixel pro

[trossenrobotics.com/c/dynamixel-pro”,2016, & Quick Start “User Manual”]

Page 25: Thesis-4709354-ECTE953 PDF full

25

3.4 Features of 2-DOF robotic arm of Dynamixel Pro

[1] It has an electrical current sensing based control.

[2] It also has an internal temperature sensing capabilities.

[3] Position, speed and torque based command.

[4] Detachable reduction gear, future available options are Straight, Right Angle, and Belt.

[5] RS-485 communication physical layer, it also supports CAN, TTL, Ethercat as well.

3.5 Connection & Set up for the experiment

In this section, I will explain overall system setup including wiring, computer software package and

operating modes required to run the given 2-DOF robot manipulator. The given 2-DOF robot arm

mechanism has two servomotors connected with cylindrical rods and they make H-series dynamixel

“H42-20-S300-R” type 2–DOF robotic arm. It requires 24VDC power supply to operate. USB2DXL

can be connected to a PC through a USB dongle; now, these two servo motors are controlled

through the USB dongle as shown in below Figure, The PC and servo motors are communicated

through a serial communication (RS485 Protocol).

Page 26: Thesis-4709354-ECTE953 PDF full

26

Figure 1.8: Two Dynamixel pro servo motors connection with USB dongle

[Quick Start for Dynamixel Pro v1.00b. “User Manual”]

Here, the connection between USB and Dynamixel PRO Servo motors was successfully done

through a 4-pin cable (shown in below figure 3.9) with a 24VDC power supply to power the

servomotors as shown in Figure 4.

Figure 3.9: 4-pin connection and servomotor connection points

[Quick Start for Dynamixel Pro v1.00b. “User Manual”]

These two Dynamixel servo motors are connected in series connection. The control software of it is

called “Dynamixel Wizard” and it is used for the open loop control of the servo motor angle

position for two servomotors individually. In “Dynamixel Wizard” the servo motors goal angle is

defined by the goal position value according to below formula

𝐺𝑜𝑎𝑙𝑎𝑛𝑔𝑙𝑒(𝑖𝑛𝑑𝑒𝑔𝑟𝑒𝑒𝑠) = 𝐺𝑜𝑎𝑙𝑃𝑜𝑠𝑖𝑡𝑖𝑜𝑛𝑉𝑎𝑙𝑢𝑒 ∗ 180

151875 (18)

[Quick Start for Dynamixel Pro v1.00b. “User Manual”]

It means that the servo motor revolves -180 to 180° and its respective pulses requirements are -

151875 to 151875 as shown in below figure.

Page 27: Thesis-4709354-ECTE953 PDF full

27

Figure 3.10: Dynamixel PRO goal angle and goal position relation

On the other hand, the relationship between current and the goal torque value represented below

𝐶𝑢𝑟𝑟𝑒𝑛𝑡𝑖𝑛𝑚𝐴 = 𝑣𝑎𝑙𝑢𝑒𝑜𝑓𝑔𝑜𝑎𝑙𝑡𝑜𝑟𝑞𝑢𝑒 ∗8250

2048

[Quick Start for Dynamixel Pro v1.00b. “User Manual”].

3.5 Operation modes of 2-DOF robot arm

The given 2-DOF robotic arm can be operated in 3 different operation modes. These three

operating modes are mentioned in table below.

Operation Mode Specification

Position Mode Achieve the desired position of servomotor1 and servomotor2.

Velocity Mode Achieve the desired velocity of the servomotor1 and servomotor2.

Torque Mode Controls the output torque of the servomotor1 and servomotor2.

Table 3.3: Table for Fuzzy logic operation modes

Page 28: Thesis-4709354-ECTE953 PDF full

28

Chapter 4 - Modelling

4.1 RoboPlus modelling

RoboPlus is software developed by Dynamixel Pro manufacturer. It is one of the traditional and

easiest way to control and monitor the given 2-DOF robotic arm. Following steps explain further,

Step – 1: Connect 24VDC Power supply to Dynamixel Pro.

Step – 2: Connect USB2DXL dongle to PC.

Step – 3: Open RoboPlus in your PC.

Step – 4: Assigned COM Port to it in Device Manager of your PC.

Step – 5: Follow the Latency Time procedure path as given below,

Under Windows Device Manager -> Port -> USB Serial Port (right mouse click) -> properties -> Port

Setting -> Advanced -> Latency Timer (msec) -> set to 1msec. [Quick Start for Dynamixel Pro v1.00b.

“User Manual”].

Step – 6: Open “Dynamixel Wizard” and connect it with the desired BaudRate. Once the COM port

connection get successful, select ‘DXL 2.0’ , ‘57600,’ and ‘1000000’ and, click ‘Start Searching.’

[Quick Start for Dynamixel Pro v1.00b. “User Manual”].

Figure 4.1: Dynamixel Wizard window for COM Port connection

Page 29: Thesis-4709354-ECTE953 PDF full

29

Step – 7: Successful communication will allow you to open Parameters for both servo motors in

“Dynamixel Wizzard”.

[ID:001] Parameter window for servo motor 1.

[ID:002] Parameter window for servo motor 2.

Figure 4.2: Dynamixel Wizard Parameter Window

Step – 8: Use the mentioned parameters below to operate given 2-DOF robotic arm.

[1] Parameter – 11: Operating Mode – Operating mode can be change by using parameter 11.

[2] Parameter – 562: Torque Enable – Must apply 1 to be activated and apply 0 when changing

parameters

[3] Parameter – 600: Goal Velocity

[4] Parameter – 596: Goal Position

Page 30: Thesis-4709354-ECTE953 PDF full

30

[5] Parameters – 563,564 & 565 – For LED.

4.2 MATLAB modelling

The control and monitor of the given 2-DOF robotic arm using MATLAB software will be valuable

work for all control engineering students to learn this control technique.

Here, MATLAB can control the goal angle and goal acceleration of the servomotor at both joints.

Step – 1: Open the MATLAB in PC.

Step – 2: Connect 24VDC power supply to Power circuit of the given robotic arm.

Step – 3: Connect USB2DXL to PC.

Step – 4: Assigned COM Port and Latency time as below,

Under Windows Device Manager -> Port -> USB Serial Port (right mouse click) -> properties -> Port

Setting -> Advanced -> Latency Timer (msec) -> set to 1msec.

Step – 5: Do serial communication between MATLAB and dynamixel Pro (2-DOF robot arm) as

below coding,

s = serial('COM1');

set(s,'Baudrate',1000000);

set(s,'StopBits',1);

set(s,'DataBits',8);

set(s,'Parity','none');

fopen(s);

Step – 6: Use MATLAB m-files dynamixelm1.m and dynamixelm2.m for servo 1 and servo 2

respectively.

Where, dynamixelm1.m and dynamixelm2.m m-files are given in appendix C.

Step – 6: We can change values for goal position and goal acceleration by changing its value in the

given m-files. This is the how; we can operate given robotic arm in speed and position modes.

Step -7: MATLAB can change goal acceleration of the given 2-DOF robotic arm as below coding,

Page 31: Thesis-4709354-ECTE953 PDF full

31

servo_ID = 1;

goal_accel = 5;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_GOAL_ACCEL,goal_accel,BYTES_GOAL_ACCEL,s);

dec2hex(Instruction_Packet)

Step -8: MATLAB can change goal angle of the given 2-DOF robotic arm as below coding,

servo_ID = 1;

goal_angle = 1;

goal_pos = goal_angle*RAD2POS;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_GOAL_POS,goal_pos,BYTES_GOAL_POS,s);

dec2hex(Instruction_Packet)

Figure 4.3: Result of the servomotor-1 to an angular position at 1 radian

Step - 9: For servo ID-2 and goal angle 1 radian.

Page 32: Thesis-4709354-ECTE953 PDF full

32

Figure 4.4: Result of the servo motor-2 to an angular position of 1 radian

Step – 10: COM Port disconnection can be done by below command,

fclose(s);

4.2 Simulink modelling

The control and monitoring of the given 2-DOF robotic arm using Simulink model.

We can control the goal angle and goal acceleration of the servomotor at both joints.

Case-1: Run each servo motor individually using below simulink model.

Page 33: Thesis-4709354-ECTE953 PDF full

33

Figure 4.5: Simulink model for each servo individually

Figure 4.5.1: Function Block Parameters

Page 34: Thesis-4709354-ECTE953 PDF full

34

Here, dynamixelm2 is a dynamixelm2.m (MATLAB m-file). Dynamixelm2.m is given in appendix C.

Similarly, for dynamixelm1 can be put in MATLAB function in simulink model. Dynamixelm1.m is

also given in appendix C.

Case-2: Run both servo motor at a same time using below simulink model.

Figure 4.6: Simulink model for both servos at a same time.

Page 35: Thesis-4709354-ECTE953 PDF full

35

Figure 4.6.1: Function Block Parameters

Figure 4.6.2: Function Block Parameters

Where, dynamixelm1 and dynamixel2 are MATLAB m-files and their coding is given in appendix C.

Page 36: Thesis-4709354-ECTE953 PDF full

36

4.2 FLC modelling

Now, I am going to control the given robotic arm using Fuzzy logic control because Popularity of

the FLC has increased in the last couple of years. FLC design fo l lows the linguistic

structure and it g i v e s u s a v e r y g o o d performance for all non-linear systems.

More importantly, it follows f i v e s t e p s ,

1 I n p u t s

2 F u z z i f i c a t i o n o f t h e I / P v a r i a b l e s

3 R u l e b a s e I n f e r e n c e

4 D e f u z z i f i c a t i o n o f t h e O / P v a r i a b l e s

5 O u t p u t s

Table 4.1: FLC computational steps

To control and monitor the given 2-DOF robotic arm using fuzzy logic control follow below steps,

Step – 1: Designed Fuzzy Inference System for 2-DOF robotic arm.

Figure 4.7: Fuzzy Logic Schematic for the 2-DOF robot arm control system

Page 37: Thesis-4709354-ECTE953 PDF full

37

Step – 1: Create FIS for the given 2-DOF robotic arm.

FIS

Step – 2: Create membership functions for the given 2-DOF robotic arm.

Membership

Functions

Target: defined between [-1 1] in radian as shown below:

Input 1: E (error)

Page 38: Thesis-4709354-ECTE953 PDF full

38

Input 2: CE (change in error)

Output 1: servo1

Page 39: Thesis-4709354-ECTE953 PDF full

39

Output 2: servo2

Page 40: Thesis-4709354-ECTE953 PDF full

40

Step – 3: Prepare rule base for the given 2-DOF robotic arm.

Rules

Page 41: Thesis-4709354-ECTE953 PDF full

41

Surface

Step – 4: For changing the position of both servo motors; change the constant values in figure 4.5.

Step – 5: For changing acceleration of both servo motors; change the acceleration values in m-files.

Step – 6: Repeat the steps for changing position and acceleration of both servo motors.

Page 42: Thesis-4709354-ECTE953 PDF full

42

Chapter 5 – Results & Conclusion

5.1 Results

This chapter includes the results & conclusion of 2 – DOF robot arm using Fuzzy logic control; as

desired position and acceleration. Results are documented as below,

Case – 1: Servo motor – 1 at -1 and Servo motor – 2 at -1.

Figure 5.1: Result of the servo motor-1 at -1 and servo motor-2 at -1

Case – 2: Servo motor – 1 at -0.5 and Servo motor – 2 at -0.5.

Page 43: Thesis-4709354-ECTE953 PDF full

43

Figure 5.2: Result of the servo motor-1 at -0.5 and servo motor-2 at -0.5

Case – 3: Servo motor – 1 at 0 and Servo motor – 2 at 0.

Figure 5.3: Result of the servo motor-1 at 0 and servo motor-2 at 0

Case – 4: Servo motor – 1 at 0.5 and Servo motor – 2 at 0.5.

Page 44: Thesis-4709354-ECTE953 PDF full

44

Figure 5.4: Result of the servo motor-1 at 0.5 and servo motor-2 at 0.5

Case – 5: Servo motor – 1 at 1 and Servo motor – 2 at 1.

Figure 5.5: Result of the servo motor-1 at 1 and servo motor-2 at 1

Page 45: Thesis-4709354-ECTE953 PDF full

45

5.2 Conclusion

In conclusion, both servo motors of the 2-DOF robot manipulator are network driven. They both

can be addressed with a unique ID dynamically. In this project, I have controlled and monitored 2 –

DOF robot arm using RoboPlus, MATLAB and FLC softwares. Out of all three control techniques, it is

clear that the Fuzzy logic control is quite convenient and more computationally efficient compare to

other two control techniques of the given 2-DOF robotic arm (Dynamixel PRO servomotors) but its

tuning process is difficult and time consuming. The results of this project show that we can control

its goal position and goal acceleration effectively.

5.3 Future work

In future, 2 - DOF robotic arm (DYNAMIXEL PRO) can be control through various control techniques

mentioned below and show in figure 5.1.

[1] Dynamixel PRO is controlled using various PC software’s such as LABVIEW, C, C++, JAVA, Visual

Basic,Python and so on.

[2] Dynamixel PRO is controlled using various exclusive controllers such as CM-700, CM-530.

Figure 5.6: Dynamixel Pro control methods

[http://en.robotis.com/index/product.php?cate_code=101010]

Page 46: Thesis-4709354-ECTE953 PDF full

46

References

[1] Quick Start for Dynamixel Pro v1.00b. “User Manual”.

[2] M. Shahab, A. Masoud, “2DOF Robotic Manipulator Control Design & Simulation”, 2008.

[3] K. M. Passino, S. Yurkovich, “Fuzzy Control”, 1997-1998.

[4] H. Elaydi, I. A. Hadrous, M. Al Ashi, “Trajectory Tracking Control of A 2-DOF Robot Arm Using

Neural Networks”, 2014.

[5] B. B. Reddy, I. S. Babu, G. V. SK. Rao, “Modelling and Control of 2-DOF Robotic Manipulator

Using BLDC Motor”, 2014.

[6] M. M. Othman, A. B. Sharkawy, A. A. Khalil, “FUZZY TRACKING CONTROL OF TWO DEGREES OF

FREEDOM ROBOTIC ARM”, 2010.

[7] Z. Bingul, O. Karahan, “A Fuzzy Logic Controller tuned with PSO for 2 DOF trajectory control”,

2011.

[8] Osman, “A PI Sliding Mode Tracking Controller with application to a 3 DOF Direct-Drive Robot

Manipulator”, 1991.

[9] “International Federation of Robotics”, 2015.

[10] “http://www.trossenrobotics.com/c/dynamixel-pro”, 2016.

[11] “https://nodna.de/Dynamixel-Pro-H42-20-S300-R_1”.

[12] “http://en.robotis.com/index/product.php?cate_code=101010”.

Page 47: Thesis-4709354-ECTE953 PDF full

47

Appendix - A

Name: Kalpitkumar Thakar

Student No: 4709354

Supervisor: Prof. Fazel Naghdy

Title of Project: Trajectory control of a DYNAMIXEL PRO Make H42-20-S300-R model

(2 DOF robot arm) using Fuzzy logic control (FLC)

Project Plan & Project Specification:

Aim: The aim of the project is to study & control a DYNAMIXEL PRO Make

H42-20-S300-R model (2 DOF Robot) arm with FLC (Fuzzy logic controller).

Requirements: A DYNAMIXEL PRO Make H42-20-S300-R model (2 DOF Robot) arm, MATLAB-

Simulink, USB2DXL for Serial communication with PC (RS 485).

Brief Procedure: Take a DYNAMIXEL PRO Make H42-20-S300-R model (2 DOF Robot) arm. Study the

given robot arm and Fuzzy logic control systems to control this robot arm. I have selected fuzzy

logic control to control this given robot arm because FLC provides advantage over traditional

processes, it gives edge to all designers to model complex systems swiftly and effectively.

Moreover, the given robot arm and the PC are connected to each other through USB2DXL serial

communication (RS485).

In the next step, fuzzy tool box in Simulink- MATLAB will be used to design a controller for the given

robot arm in it. This program is created to Control and monitor the robot arm by using Fuzzy logic

control.

For this given project, use MATLAB-Simulink software:

MATLAB – MATLAB is very basic platform and we will run all the programs for the project on

MATLAB.

Page 48: Thesis-4709354-ECTE953 PDF full

48

Simulink – The full project will be prepared on the Simulink, on which it is an easy process to

develop a logic by using the Simulink blocks.

Fuzzy Logic Toolbox – It is a internal part of MATLAB software and we are using it in this given

project.

USB2DXL– USB2DXL is a communication mode between robot and PC, which is RS485.

Reasons for adopting this Project Strategy:

The expansion of the robotics and FLC in modern industries demands to develop precise and

powerful control systems for robotic arm therefore it has become a biggest reason for adopting this

project.

The goal of this project is to control a DYNAMIXEL PRO Make H42-20-S300-R model (2 DOF Robot)

arm based on Fuzzy Logic techniques. This project involves FLC instruction set and analysing its

ability to control the given robot arm.

Validation of experiment results

The entire project is based on MATLAB-Simulink and Fuzzy logic system. Fuzzy logic control is a good

software for validating, controlling and monitoring the date of a DYNAMIXEL PRO Make H42-20-

S300-R model (2 DOF Robot) arm.

Page 49: Thesis-4709354-ECTE953 PDF full

49

Gantt chart for achieving objectives:

Read Literature

Read Robot Manual

Develop FLC for Robot

System Testing

Completing Experiment

Writing Thesis

Make A1 poster

Weeks 1 2 3 4 5 6 7 8 9 10 11 12 13

Intense task

Adequate task

Page 50: Thesis-4709354-ECTE953 PDF full

50

Appendix B: Logbook Summery sheet

Page 51: Thesis-4709354-ECTE953 PDF full

51

Appendix C

Modelling for servo 1 (dynamixelm1.m)

function yy = dynamixelm1(x)

if (x>=-1)&&(x<=1)

yy=x;

s = serial('COM1');

set(s,'Baudrate',1000000);

set(s,'StopBits',1);

set(s,'DataBits',8);

set(s,'Parity','none');

fopen(s);

run('Control_Table_Constants')

servo_ID = 1;

brightness = 255;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_RED_LED,brightness,BYTES_RED_LED,s);

dec2hex(Instruction_Packet)

servo_ID = 1;

goal_accel = 5;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_GOAL_ACCEL,goal_accel,BYTES_GOAL_ACCEL,s);

dec2hex(Instruction_Packet)

servo_ID = 1;

enable = 1;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_TORQUE_ENABLE,enable,BYTES_TORQUE_ENABLE,s);

dec2hex(Instruction_Packet)

servo_ID = 1;

goal_angle = x;

goal_pos = goal_angle*RAD2POS;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_GOAL_POS,goal_pos,BYTES_GOAL_POS,s);

dec2hex(Instruction_Packet)

fclose(s);

delete(s)

clear s

else

s = serial('COM1');

set(s,'Baudrate',1000000);

Page 52: Thesis-4709354-ECTE953 PDF full

52

set(s,'StopBits',1);

set(s,'DataBits',8);

set(s,'Parity','none');

fopen(s);

run('Control_Table_Constants')

servo_ID = 1;

goal_angle = 0;

goal_pos = goal_angle*RAD2POS;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_GOAL_POS,goal_pos,BYTES_GOAL_POS,s);

dec2hex(Instruction_Packet)

fclose(s);

delete(s)

clear s

end

end

Modelling for servo 2 (dynamixelm2.m)

function yy = dynamixelm2(x)

if (x>=-1)&&(x<=1)

yy=x;

s = serial('COM1');

set(s,'Baudrate',1000000);

set(s,'StopBits',1);

set(s,'DataBits',8);

set(s,'Parity','none');

fopen(s);

run('Control_Table_Constants')

servo_ID = 2;

brightness = 255;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_RED_LED,brightness,BYTES_RED_LED,s);

dec2hex(Instruction_Packet)

servo_ID = 2;

goal_accel = 5;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_GOAL_ACCEL,goal_accel,BYTES_GOAL_ACCEL,s);

dec2hex(Instruction_Packet)

Page 53: Thesis-4709354-ECTE953 PDF full

53

servo_ID = 2;

enable = 1;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_TORQUE_ENABLE,enable,BYTES_TORQUE_ENABLE,s);

dec2hex(Instruction_Packet)

servo_ID = 2;

goal_angle = x; %[rad]

goal_pos = goal_angle*RAD2POS;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_GOAL_POS,goal_pos,BYTES_GOAL_POS,s);

dec2hex(Instruction_Packet)

fclose(s);

delete(s)

clear s

else

s = serial('COM1');

set(s,'Baudrate',1000000);

set(s,'StopBits',1);

set(s,'DataBits',8);

set(s,'Parity','none');

fopen(s);

run('Control_Table_Constants')

servo_ID = 2;

goal_angle = 0;

goal_pos = goal_angle*RAD2POS;

Instruction_Packet =

DynamixelPro_write(servo_ID,ADDRESS_GOAL_POS,goal_pos,BYTES_GOAL_POS,s);

dec2hex(Instruction_Packet)

fclose(s);

delete(s)

clear s

end

end