31
ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot Final Report Group Members: Ying Li Paul Mulcahy Joe Chapman Group Supervisor: Dr. Pan Agathoklis http://web.uvic.ca/~hexapod [email protected]

ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

Embed Size (px)

Citation preview

Page 1: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

ELEC 499 / CENG 499

Group 7: Autonomous Hexapod Robot

Final Report

Group Members: Ying Li

Paul Mulcahy Joe Chapman

Group Supervisor: Dr. Pan Agathoklis

http://web.uvic.ca/~hexapod [email protected]

Page 2: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

ii

Table of Contents 1 Introduction ......................................................................................................................... 2

1.1 The Definition of a Robot ............................................................................................. 2

1.1.1 Industrial Robots ................................................................................................... 2

1.1.2 Agriculture Robots ................................................................................................ 2

1.1.3 Telerobots ............................................................................................................. 2

1.1.4 Service Robots ..................................................................................................... 2

1.1.5 Mobile Robots ....................................................................................................... 2

1.2 Mobile Robots .............................................................................................................. 3

1.2.1 Wheeled Robots ................................................................................................... 3

1.2.2 Tracked Robots .................................................................................................... 3

1.2.3 Legged Robots ..................................................................................................... 3

1.3 Hexapod ...................................................................................................................... 4

1.4 Objectives .................................................................................................................... 5

2 Hexapod Construction......................................................................................................... 6

2.1 Servo Erector Set:........................................................................................................ 7

2.2 Servo Motor: ................................................................................................................ 7

2.3 Force Sensors: ............................................................................................................ 8

2.4 Ultrasonic Sensors ....................................................................................................... 8

2.5 Infrared Sensors: ........................................................................................................10

2.6 Arduino Mega 2560 ADK Board: .................................................................................10

2.7 SSC-32 Servo Controller: ............................................................................................10

3 Inverse Kinematic Calculations ..........................................................................................12

4 Hexapod Modelling ............................................................................................................16

5 Module Description and Design .........................................................................................18

5.1 Software Development ................................................................................................18

5.1.1 Software Development Platform...........................................................................18

5.1.2 Interfacing with Servo Controller ..........................................................................18

5.1.3 Walking Algorithm ................................................................................................18

5.1.4 Turning and Walking Backwards ..........................................................................19

5.1.5 Walking in High Mode ..........................................................................................20

5.1.6 Interfacing with Infrared Sensors ..........................................................................20

5.1.7 Interfacing with Ultrasonic Sensors ......................................................................21

5.1.8 Interfacing with Touch Sensors ............................................................................21

5.1.9 Avoiding Walking Over Cliffs ................................................................................22

6 Test Results and Problems Encountered ...........................................................................23

6.1 Inverse Kinematics Testing .........................................................................................23

6.2 Ultrasonic Sensors ......................................................................................................24

6.3 Infrared Sensors .........................................................................................................24

6.4 Force Sensors ............................................................................................................24

6.5 Power Supply ..............................................................................................................25

6.6 Analog Ports ...............................................................................................................25

6.7 Climbing over Obstacles .............................................................................................26

Page 3: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

iii

7 Future Development and Recommendations .....................................................................27

8 Conclusions .......................................................................................................................28

9 Works Cited .......................................................................................................................29

List of Tables Table 1 - Servo Channels used for Hex Sequencer ..................................................................18

Table 2 - Walking Sequence States ..........................................................................................19

List of Figures Figure 1 - A bomb manipulator of the German Army with tracks [2] ............................................ 3

Figure 2 - Toyota's monopod robot [3] ........................................................................................ 4

Figure 3 - Honda's ASIMO bipod robot [4] .................................................................................. 4

Figure 4: Hexapod ..................................................................................................................... 6

Figure 5: System Diagram.......................................................................................................... 6

Figure 6: Servo Brackets ............................................................................................................ 7

Figure 7: Hitec HS-645MG Servo ............................................................................................... 7

Figure 8: Force Sensor Construction .......................................................................................... 8

Figure 9 - Ultrasonic transmitter circuit ....................................................................................... 8

Figure 10 - Ultrasonic receiver circuit ......................................................................................... 9

Figure 11 - Ultrasonic ranging .................................................................................................... 9

Figure 12: Parallax Ultrasonic Sensor ........................................................................................ 9

Figure 13: Infrared Sensor ........................................................................................................10

Figure 14: Arduino Mega 2560 ADK ..........................................................................................10

Figure 15: Lynxmotion SSC-32 Servo Controller .......................................................................11

Figure 16: Leg Schematic (XY-Plane) .......................................................................................12

Figure 17: Case 1 Leg Schematic (XZ-Plane) ...........................................................................12

Figure 18: Case 2 Leg Schematic (XZ-plane) ...........................................................................13

Figure 19: Servo Leg Joints ......................................................................................................16

Figure 20: Modelling Leg Rotation.............................................................................................16

Figure 21 - Walking Motion using Hexapod Sequencer .............................................................19

Figure 22: Infrared Sensor Schematics .....................................................................................21

Figure 23: Force Sensor Indicator Schematics ..........................................................................22

Figure 24: Actual Leg Position ..................................................................................................23

Figure 25: Modelled Leg Position ..............................................................................................23

Figure 26: Resistance vs. Force ................................................................................................25

Page 4: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

2

1 Introduction In today’s technological society, people have grown accustomed to daily use of several kinds of technology from personal computers to supercomputers, from personal vehicles to commercial airplanes, from mobile phones to communicating through the Internet and everything in between. As such, the use of robots has also become increasingly common. Robots can be used to complete repeated tasks, increase manufacturing production, carry extra weight and many other common tasks that humans do.

1.1 The Definition of a Robot

The first thing that might come to mind when thinking of a robot is a humanoid machine from the Terminator or Battlestar Galactica series. In reality, we aren’t quite at the level that Hollywood likes to project us to be. However, robots today do increase the average quality of life of most people. According to the Merriam-Webster Dictionary, a robot is either “a device that automatically performs complicated often repetitive tasks” or “a mechanism guided by automatic controls.” [1] There are several types of robots which will be described in the following sections. Some robots could be described by more than one category.

1.1.1 Industrial Robots

These robots are used in industry and are typically designed to do one task at an incredible

speed. Some examples include pick and place machines for large circuit boards with many

components to welding robots used in an assembly line in the auto industry.

1.1.2 Agriculture Robots

Most agriculture robots are still in their design phase, but some simple ones such as using

global positioning systems to map out and guide a combine to harvest crops do assist farmers

today.

1.1.3 Telerobots

Telerobots are pieces of equipment such as a set of arms which are controlled by an operator at

a distance. This is helpful in situations where it is hazardous for a human such as in a nuclear

power plant setting or where a person of importance can’t physically be where they need to be

such as a specialist surgeon.

1.1.4 Service Robots

Service robots are ones which are used outside of industry such as for domestic or military use.

1.1.5 Mobile Robots

Mobile robots are also known as Automated Guided Vehicles (AGV) and they do not remain

stationary. They can move around wither with the help of an operator or completely

autonomously. This is the type of robot that we are looking to build and will be the focus of the

rest of this report.

Page 5: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

3

1.2 Mobile Robots

As stated in Section 1.1.5, AVG’s are able to move from place to place and can be classified by

the environments in which they are designed to move such as ground, water, air or space as

well as by the method with which they move such as legs, wheels, tracks, propeller, or rocket.

The scope of this project and report is in the domain of legged robots which shall be discussed

further.

1.2.1 Wheeled Robots

Wheeled robots are great for smooth terrain such as asphalt, concrete, or even gravel roads.

These are among the fastest mobile robots and the easiest to implement movement. They can

be completely electric for smaller scale or even run on combustion engines on a larger scale.

1.2.2 Tracked Robots

Tracked robots typically move slower than wheeled robots but are useful in many situations

where damage to the wheels is expected. One such example is police bomb disposal robots

where a potential explosion could blow the tires. A track system does not require rubber tires

and are therefore more robust in these situations.

Figure 1 - A bomb manipulator of the German Army with tracks [2]

1.2.3 Legged Robots

The advantages of legged robots become apparent when terrain becomes uneven and

unpredictable. As stated previously, wheeled or tracked robots excel on flat surfaces such as

asphalt or concrete roads and can reach much higher velocities than legged ones. However, a

legged robot is much more robust in rocky and uneven terrain because it has the ability to climb

over obstacles by lifting its legs and pulling itself up.

Page 6: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

4

1.2.3.1 One-Legged Robots

Toyota developed a one legged robot in 2006 which was revolutionary in that it was able to hop

up and down and land stable. This is attributed to the active joint in the toe as well as in the

knee and the hip. The 1m tall robot is able to jump 4cm into the air. [3]

Figure 2 - Toyota's monopod robot [3]

1.2.3.2 Two-Legged Robots

Two-Legged robots are also known as humanoid robots because humans also walk on two feet

and are usually the most human-like. The most famous humanoid robot is probably Honda’s

ASIMO which first appeared in 2000. It can walk, run, and turn corners all on only two feet. It

has been used to encourage students to pursue careers in Science and Engineering. [4]

Figure 3 - Honda's ASIMO bipod robot [4]

1.2.3.3 Three or More Legged Robots

For better stability over rougher terrain, multiple legs can be used (usually in multiples of 2).

Four-legged robots will mimic movements of most mammals while six or more will move more

like insects or arachnids. The advantages to these robots over a bipod is that they are statically

stable and do not require balancing mechanisms to keep from falling over.

1.3 Hexapod

The hexapod robot has, by definition, six legs and is inspired by insects such as ants and

crickets. This gives it the ability to move flexibly across various terrains and, as stated in Section

1.2.3.3, does not require any balancing mechanisms to stand upright. The main purpose for

building this robot is to study the motions and movements of an insect. Applications for such a

Page 7: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

5

robot include environment exploration, search and rescue, and as a computer numerical control

machine.

1.4 Objectives

The objectives for this 3-month term from January to March 2012 are provided in the following

list.

1. Design the body and legs.

2. Determine appropriate parts and hardware to order.

3. Build the robot.

4. Calculate inverse kinematics for the leg movements.

5. Program walking functions

6. Program a rising function.

7. Program a climbing function.

8. Test and redesign where appropriate.

Page 8: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

6

2 Hexapod Construction

Figure 4: Hexapod

Our team designed the hexapod as shown in Figure 4. The hexapod is controlled by an Arduino

Mega 2560 ADK microcontroller. The microcontroller is serial linked to the servo controller

which sends commands to control the servo motors. The front of the robot has two infrared

sensors which rotate 90 degrees from straight ahead to their respective sides to scan the front

area for obstacles. The front ultrasonic sensor is positioned to detect the height of the hexapod

when the robot is standing up. Force sensors are installed on the tip of each leg to let the robot

know when its feet are touching something. Two Li-Po batteries are used to supply power to the

servo motors. An additional Ni-MH battery is used to power the microcontroller and the servo

controller. The system diagram is shown in Figure 5 and detailed parts selection is explained in

the rest of this section.

Figure 5: System Diagram

Page 9: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

7

2.1 Servo Erector Set:

Due to the limited time available for this design project, our team decided to build the hexapod

using a pre-fabricated servo erector set from Lynxmotion. The erector set offers a variety of

components to construct any mechanical arrangement possible. The components are made

from a high quality aluminum alloy which offers light weight, precision assembly and durability.

The erector set allows us to build the hexapod based on our own specifications. The leg of the

hexapod can easily be adjusted by changing the position of the servo horns. Burned out servos

can be replaced easily without taking apart of the entire leg assembly.

Figure 6: Servo Brackets

2.2 Servo Motor:

The hexapod requires 24 servos on its leg construction. It was decided to use Hitec HS-645MG

ultra torque (9.6Kg-cm) servos on all leg joints. The servo draws 450mA when running

continuously. The alumite gear construction offers an un-breakable gear train and fits the need

of high torque demand. The servo motor has three connectors. The red and black connectors

are for power and ground. The yellow connector is connected to a digital pin which needs to

have PWM ability to send out pulsed signals to control the servo motor.

Figure 7: Hitec HS-645MG Servo

Page 10: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

8

2.3 Force Sensors:

The Force Sensing Resistors (FSR) are made of a polymer of thick film which reacts as a

variable resistor. The FSR decreases in resistance when forces are applied to the active area.

The regular touch sensors only have a binary response as high and low. The FSR sensor is

able to return analog readings based on the force applied. The FSR can be used to adjust the

sensitivity of each leg when the robot is standing up. When the robot is climbing over obstacles,

it is crucial that when the leg lands on top of the obstacle, it should be able to stop the leg by

using this force sensor. The characteristics of this force sensor allow us to adjust the sensitivity

on each leg based on different terrain. The Force Sensors are connected in series with an LED

light to indicate how much pressure is being applied to each one in real time.

Figure 8: Force Sensor Construction

2.4 Ultrasonic Sensors

For the ultrasonic sensors, Arexx Engineering’s Ultrasonic Kit for their Arsuro robot was chosen.

This kit came with all the components required for the circuit which needed to be put together and

soldered onto a PCB board. Figure 9 shows the circuit for the transmitter while

Figure 10 shows the circuit for the receiver.

Figure 9 - Ultrasonic transmitter circuit

Page 11: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

9

Figure 10 - Ultrasonic receiver circuit

By programming the Arduino to send a small pulse signal through the transmitter, a reflected

signal could be detected at the receiver. The delay between the transmitted and received

signals can be measured and the distance to the object using the known speed of sound can be

calculated as shown in Figure 11.

Figure 11 - Ultrasonic ranging

Unfortunately our group could not get the designed ultrasonic sensor to work (most likely due to

an error in the soldering of the board), an alternate ultrasonic sensor kit was ordered from

parallax. This sensor kit is configured for easy programming, streamlined integration into

Arduino microcontrollers, and the readings are accurate with a distance range of 1cm to 30cm.

Figure 12: Parallax Ultrasonic Sensor

Page 12: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

10

2.5 Infrared Sensors:

The infrared sensors were selected from Sharp (Model: GP2D120). The sensor is widely used

for range detection purposes. The infrared sensor takes a continuous distance reading and

reports the distance as an analog voltage with a distance range of 4cm to 30cm.

Figure 13: Infrared Sensor

2.6 Arduino Mega 2560 ADK Board:

The Arduino ADK is an ATmega2560 microcontroller board that is able to interface with Android

based phones. The microcontroller has 54 digital input/output pins, 14 of the digital pins have

PWM outputs which can be used to control servo motors. The board also has 16 analog inputs,

4 UARTS and 16MHz crystal oscillator. The reason this microcontroller board was chosen is

because the sensors requires a lot of analog input pins which other Arduino boards (such as

their popular Uno board) are unable to supply.

Figure 14: Arduino Mega 2560 ADK

2.7 SSC-32 Servo Controller:

The SSC-32 Servo Controller is able to control 32 servo motors simultaneously. The controller

offers accurate positioning and smooth movement. The servo controller is able to control the

servo motor up to the resolution of 1µs. The analog servo motor can rotate with a range from

500µs to 2500µs. The digital servo motor can rotate with a range from 900µs to 2100µs. The

servo controller is able to control the speed and time of the servo motion. The “Group Move”

command is available which allows multiple servo motors to move simultaneously. We are able

to use this command to create complex walking gaits. To provide continuous current draw, the

servo controller is able to connect to two power supplies which power 16 servo motors each. A

12 servo hexapod sequencer is also built in and allows us to easily configure the servo motors

and walking in a tripod gait.

Page 13: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

11

Figure 15: Lynxmotion SSC-32 Servo Controller

Page 14: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

12

3 Inverse Kinematic Calculations

The inverse kinematics is calculated based on the geometric relationship between each leg

joint. The inverse kinematics computes the values of the joint variables which will achieve a

desired position and orientation of the end-effector. The position of the end-effector is defined

as . The angle of each joint to reach the position of the end-effector is calculated

using the derived inverse kinematics equations. The D joint angle is calculated as follows:

Figure 16: Leg Schematic (XY-Plane)

Figure 17: Case 1 Leg Schematic (XZ-Plane)

Page 15: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

13

Figure 18: Case 2 Leg Schematic (XZ-plane)

Two cases of finding coordinates of joint P1 are considered in our calculation.

Case 1: when Pz is greater than , this indicates that joint P1 is below X-axis. The

coordinates of joint P1 is represented below:

Case 2: when Pz is less than , this indicates that joint P1 is above the X-axis. The

coordinates of joint P1 are represented below:

(Same as Case 1)

The distance between joint P1 and joint P3 is found as follows:

The law of cosines for the triangle defined by the segments with lengths L13, L12 and L23,

states that:

Page 16: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

14

The angle 2 can be found by re-arranging the above formula:

The formula for finding 2 applies for both cases.

The angle 3 consists of angle and angle for Case 1. In Case 2, additional 90 degrees need

to be included in finding angle 3.

The angle 3 is found by following formula:

Case 1:

Case 2:

The angle is also needed in order to determine the position of the servo motor at joint P1.

Case 1:

Case 2:

Page 17: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

15

After we determined the angles of each leg joints, we need to convert the joint angles to servo

positions. The servo controller only takes servo position readings, so we derived the following

equations to convert the servo angles:

The analog servo rotates 180 by its rotation range from 500µs to 2500µs. If the calculated

servo position is not within this range then the servo will switch into an idle state in which the

position can be random. When the robot is in walking mode, the bad servo position data will

cause the robot to collapse suddenly. Therefore we need to set a limit in the program to make

sure servo is within the desired range.

Page 18: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

16

4 Hexapod Modelling The robot leg was modelled in 2D using AutoCAD drafting software. The dimension is drawn in

the actual scale based on leg dimension measured from the hexapod. We can use the AutoCAD

model to verify our inverse kinematics results and configure the physical rotation limit of each

leg joint.

Figure 19: Servo Leg Joints

The result of the inverse kinematics (IK) calculations is compared with the AutoCAD model. The

measurement results in AutoCAD should match the results from our IK equations. First of all,

the coordinates of the end effector is measured in AutoCAD. The coordinates are then entered

into the calculation program and the program returns the angle of each leg joint.

Figure 20: Modelling Leg Rotation

Page 19: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

17

Next, go back to the AutoCAD model and measure the angle of each leg joint to compare with

the calculation results. If both measurements match, the calculation has performed correctly in

the program.

Due to the physical constraint of the leg construction, it was noticed that there are coordinates where the legs are not able to reach but the program still returns calculated leg joint angles. In this case the calculated results will be incorrect. Limits need to be set in the program to prevent such errors from occurring.

Multiple leg positions are drawn in the 2D model to reflect the physical limit on each leg joint. By

looking at the 2D model, limits can be set on the servo positions to prevent each leg from

reaching false positions.

Page 20: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

18

5 Module Description and Design

5.1 Software Development

5.1.1 Software Development Platform

The Arduino platform was selected as the controller board. Arduino uses the open-source Wiring platform. Programs are written in a simplified C++ dialect, with two main functions. setup() - a function run once at the beginning of program execution. It is meant to setup program functionality. loop() - the forever repeated function that is run after setup(). The Arduino platform was selected because of its vast popularity and relative ease of use.

5.1.2 Interfacing with Servo Controller

The SSC-32 Servo Controller is interfaced to the Arduino board using the serial port.

5.1.2.1 Hexapod Sequencer

The Servo Hexapod Sequencer commands provide a programmer friendly way for developing hexapod robots with two servos (a horizontal servo and vertical servo) for each leg.

Table 1 - Servo Channels used for Hex Sequencer

0 Right Rear Vertical 16 Left Rear Vertical

1 Right Rear Horizontal 17 Left Rear Horizontal

2 Right Center Vertical 18 Left Center Vertical

3 Right Center Horizontal 19 Left Center Horizontal

4 Right Front Vertical 20 Left Front Vertical

5 Right Front Horizontal 21 Left Front Horizontal

5.1.3 Walking Algorithm

The Servo Controller documentation described a walking algorithm for a hexapod robot using two motors per leg. This dual-tripod algorithm was revised and adapted to support the project's four motors per leg design through the inverse kinematics calculations and to allow other project goals. The algorithm consists of 8 leg states. Implementation consisted of sending initial and ending [X, Y, Z] coordinates for each tripod to a walkState() function. This walkState function would split the walkState into a predefined number of sub-states. Inputs from the touch sensors were measured at every sub-state. This allowed overriding a descending leg onto an obstacle from

Page 21: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

19

pushing the entire robot over. As the rest of the tripod ascended above the obstacle, the affected leg would begin moving again. The initial and ending [X, Y, Z] coordinates for each tripod were sent to a function dedicated to calculating the inverse kinematics. This function calculated the servo values to be given to each servo in the legs of that tripod for that particular sub-state.

Figure 21 - Walking Motion using Hexapod Sequencer

Table 2 - Walking Sequence States

Tripod A Tripod B

State Vertical Horizontal Vertical Horizontal

0 Low Front to Center Mid to High Rear to Center

1 Low Center to Rear High to Mid Center to Front

2 Low Rear Mid to Low Front

3 Low to Mid Rear Low Front

4 Mid to High Rear to Center Low Front to Center

5 High to Mid Center to Front Low Center to Rear

6 Mid to Low Front Low Rear

7 Low Front Low to Mid Rear

5.1.4 Turning and Walking Backwards

Between each state the robot adjusts two infrared sensors attached to servos on its front and takes readings. After all eight states, it has readings for many angles in front of it. At this point the program examines the readings.

Page 22: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

20

If at least one of the readings of the left infrared sensor is determined to be high but none are found by the right infrared sensor, then the robot is programmed to turn right. If at least one of the readings of the right infrared sensor is determined to be high but none are found by the left infrared sensor, then the robot is programmed to turn left. If at least one high reading is found by both infrared sensors, the robot is programmed to rise up into a high mode. Once in high mode, the robot takes new infrared sensor readings. These readings are to determine if the obstacle directly in front of the robot can be stepped over. If any of the readings return high, the robot lowers down to Low mode and is programmed to walk backwards. The robot is programmed to turned left, right, or walk backwards by altering the horizontal values given to the tripod legs in each walk state. To turn left or right, one of the tripods horizontal values are reversed while the others are kept the same. To walk backwards, both horizontal values are reversed for the walk states. In order to effectively turn or walk backwards, the robot must keep turning/reversing for more than one cycle of states. For this reason, a 'turning' variable is assigned a number of walking state cycles to go through before the walking mode is reset to walking forwards. Infrared inputs are ignored while the robot is turning or walking backwards.

5.1.5 Walking in High Mode

As stated previously, if at least one high reading is found by both infrared sensors, the robot is programmed to rise up into a high mode. New infrared sensor readings are taken to determine if the obstacle directly in front of the robot can be stepped over. If no readings return high, the robot begins walking forward in high mode. Two ultrasonic sensors are attached to the robot, one in the front and one in the back. These sensors point directly towards the floor. When in high mode, if there are no obstacles beneath them, the sensors should read above 15cm. When walking forward in high mode, the front sensor first detects the obstacle going underneath. When the obstacle is detected under the rear sensor and then is not detected and nothing is detected by the front sensor, the robot lowers down to low mode.

5.1.6 Interfacing with Infrared Sensors

The value of the infrared sensor is read into the program using the Arduino analogRead(pin

number) function. Pin number refers to which analog pin of the Arduino the sensor is attached

to. The analog-to-digital converter converts the voltage reading, 0 – 5V, to a value between 0

and 1023.

A low value refers to an infrared reading that is far away. A high value refers to an infrared

reading that is very close. For the project, a detection of objects closer than or equal to 10cm

was desired. Through experimentation, it was determined that values returned greater than or

equal to 120 are closer than or equal to 10cm. This was a rough estimate as the infrared signal

returned depended heavily on the colour of the object it was bouncing off of.

Page 23: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

21

The infrared sensor is connected to the Arduino Mega board using the configuration shown in

Figure 22.

Figure 22: Infrared Sensor Schematics

5.1.7 Interfacing with Ultrasonic Sensors

The ultrasonic sensor detects a range from several cm to several meters. It sends an

ultrasonic pulse and then listens for the reflective sound off a nearby object.

The pin mode of the ultrasonic pin is first change to output through pinmode(ultrasonic pin,

OUTPUT). digitalWrite(ultrasonic pin, Low Pulse) pulses preceed and follow a

digitalWrite(ultrasonic pin, High Pulse) pulse to ensure a clean high pulse. Ultrasonic pin refers

to the digital pin that ultrasonic sensor is connected to. Low Pulse and High Pulse refer to built-

in LOW and HIGH Arduino constants.

Next, the pin mode of the ultrasonic pin is change to input through pinmode(ultrasonic pin,

INPUT). The duration in microseconds is found through the Arduino function, pulseIn(ultrasonic

pin, High Pulse). Sound travels approximately 340m/s or 29 microseconds per cm. To find the

number of cm travelled, we divide the number of microseconds once by 29, and then once

again by 2 because the distance has been travelled twice.

5.1.8 Interfacing with Touch Sensors

The force sensor is connected using the configuration as shown in Figure 23. This connection

takes an analog reading from the analog pins. We can use this analog value to set the

sensitivity on each leg. The analog readings are also converted to a PWM range of 0 to 255.

The signal is then sent out of the digital PWM pin and it will determine how bright the LED will

be. Therefore we can visually inspect the force sensors to see if it is operating correctly.

Page 24: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

22

Figure 23: Force Sensor Indicator Schematics

The main purpose of the touch sensors in current design is to keep legs touching obstacles from tipping over the robot. By ignoring all vertical (Z) servo movements that are below the obstacle when the touch sensor is activated, the robot stays in the correct stance. The LEDs were extremely useful for finding errors in the implementation.

5.1.9 Avoiding Walking Over Cliffs

When in low mode, the front ultrasonic sensor should never sense a distance of greater than 15cm. If a distance of greater than 15cm is detected, it is recognized as a cliff and the robot is programmed to walk backwards and turn slightly to one direction.

Page 25: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

23

6 Test Results and Problems Encountered

6.1 Inverse Kinematics Testing

Figure 24: Actual Leg Position

Figure 25: Modelled Leg Position

The result of the Inverse Kinematics Calculation is compared with the AutoCAD model as

shown in Figure 24 and Figure 25. The actual leg position is close to the 2D model. We are

satisfied with the calculation results. The servo joints on the left side is directly opposite from the

right side. When placing the left side servo joint at 0 degrees, the right side joints to set the

joints at 180 degrees in order to match the left side. There were offsets between leg joints on

the right side. The right side servo joints rotate over 180 degrees. Since the servos we used are

not digital servo motors, we cannot calibrate the servo position internally. The only way to get rid

of the offset is manually adjust the servo horn positions to eliminate the offset.

Page 26: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

24

6.2 Ultrasonic Sensors

Ultrasonic sensors proved to be more accurate than the infrared sensors in range detection.

When a flat surfaced obstacle is placed directly in front of the sensor, the sensor is able to

return accurate readings. But when a flat surface obstacle is placed at an angle, the sensor will

return false readings, and the angled surface bounces off the ultrasonic pulse so it takes longer

to return back to the receiver. Therefore the reading becomes inaccurate. To acquire accurate

data, we decide to rotate the ultrasonic sensor horizontally and scan the front area. During the

scanning, we will take 6 readings from the ultrasonic sensor. The reading which returns the

shortest distance to the obstacle is determined to be the accurate reading.

6.3 Infrared Sensors

The infrared sensors are very sensitive to the surrounding lights. We tested the infrared sensor

on different surface materials and concluded that the infrared cannot detect black surfaces and

the detection is not accurate when obstacles do not have flat surfaces. The infrared sensor is

also taking interference from other infrared readings. The sensor on the left side could receive

the reflected infrared beam sent from the right side, and causing both sensors to detect

obstacles at the same time. In order for the robot to turn left or right, only one sensor is

supposed to detect obstacles. If both sensors are mistakenly detecting obstacles at the same

time, hexapod will walk backwards. We placed a divider between the sensors to eliminate the

interference, but the both sensors still experience inaccurate readings. In a bright light

environment the infrared sensors appear to be more accurate than in low light environment.

6.4 Force Sensors

The force sensor functions as an infinite resistor when no force is applied. The FSR sensor

becomes finite resistive when forces are applied to the sensor pad. The resistance is linear to

the amount of forces applied. The sensor worked very well at the beginning of the experiment.

After several weeks of testing, we noticed the sensor pads started wearing out. The response

time of the sensors begin to decrease and eventually stopped working. The sensor is crucial to

detect the landing position of each leg when walking over obstacles. Without the force sensors,

we cannot make the leg stop if it steps on an obstacle. We should select a more durable sensor

instead. Our group then decided to mount touch buttons on the bottom of each leg to act as

touch sensors. This touch sensor is used as a temporary solution for walking over obstacles.

This effectively changed our analog inputs to digital binary ones.

Page 27: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

25

Figure 26: Resistance vs. Force

6.5 Power Supply

When all servos are running simultaneously, the robot will draw over 10A of current. The test

bench power supply provided is not able to provide more than 6A of supply current. A

workaround was to only use half of the servos to complete stand up movement. When using

batteries to power the robot, two battery packs are included to supply power to the servos. Each

battery pack is sufficient to handle half of the servo motor loads. The Li-Po battery is rated at

7.4V and the servo motor is operating between 5V to 6V. A voltage regulator is used to step

down each battery pack to 6V in order to power servo motor safely and without damaging the

servo motors.

6.6 Analog Ports

The Arduino Uno Controller does not supply enough analog ports. The force sensors require 6

analog ports and the obstacle detection sensors require analog ports as well. The Arduino Uno

can only provide 6 analog ports. This is not enough for our project requirements.

Two methods were proposed to expand the I/O ports. One method is to use a multiplexer chip

to generate analog ports by using 4 digital ports and 1 analog port. The problem with this design

is the generated analog ports cannot receive data simultaneously. This will create an

undetermined delay for the programming board to receive data to all analog ports. The second

option is to use I2C communication between programming boards. This would require an

additional programming board assigned as a slave to send analog feedback signals back to the

Master Arduino board. The final solution was to replace the Arduino Uno with the Arduino ADK. The Arduino ADK is based on the ATmega2560 and provides 16 analog ports. This is enough for our project requirements.

Page 28: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

26

6.7 Climbing over Obstacles

Our group programmed the hexapod to be walking in tripod gait. This walking method allowed

the hexapod to walk faster than the wave gait. When the robot detect obstacles and decide to

climb over the obstacle, it will rise up its body and walk over the obstacles. We tested the

hexapod to climb over obstacles and concluded that tripod gait does not work well when the

hexapod body is raised up. With tripod gait, there are only three legs on the ground to support

the body of the hexapod. Due to the heavy construction of its body, the hexapod failed to climb

over the obstacles and collapsed on the ground. The hexapod should use wave gait to climb

over obstacles which move only one leg at time. There will always be five legs on the ground

supporting the body. The wave gait walking method was not created due to time restraints but

would be something worth adding in the future.

Page 29: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

27

7 Future Development and Recommendations Currently, the hexapod only walks with tripod gait. It is our recommendation to include a wave

gait walking method in the program. The hexapod should be able to distinguish even and

uneven terrain. On even terrain, it should use tripod gait for walking and on uneven terrain, it

should use wave gait. More testing on the infrared sensor is needed to find out the accurate

range of the infrared sensors and prevent interferences for other sources. Alternately, the

infrared sensor can be replaced by ultrasonic sensor because we found this type of sensor is

more reliable over infrared sensors.

Additionally, it has come to our attention that the servo motors need to provide more torque to

support the hexapod chassis. The current servo motor has 10Kg·cm of torque and it is

recommended to increase the torque to 30kg·cm. The 30kg·cm servos will draw more current

than the previous servos. The battery packs will need to be able to supply 20A of continuous

current in order for those servos to operate properly.

When the hexapod is climbing over obstacles, the front body is tilting upwards. A gyro sensor

can be installed on to the hexapod to determine the tilting levels and maintain a balanced body

position.

The Arduino Mega ADK board is able to interface with Android phones. The hexapod can be

controlled from an android phone or from a laptop via Bluetooth or Wi-Fi. The hexapod is

designed to walk on rough terrain and it can be used as a SARbot (Search and Rescue Robot),

remote technical repair bot, and mobile military vehicle. A higher level of obstacle detection can

be developed using camera instead of infrared sensors. This will require high level of image

processing to detect obstacle and faster microcontroller to reduce image processing time.

Page 30: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

28

8 Conclusions Our team has built an autonomous 6 legged robotics walker (Hexapod Robot). The robot is

used to study and simulate the walking motion of a 6 legged insect. The hexapod robot consists

of 6 legs with 4 degrees of freedom on each leg to allow for better mobility and exceptional

range of movement. To achieve autonomous functionalities, we used infrared sensors and

ultrasonic sensors for range detection and utilized touch sensors for close obstacle detection.

The inverse kinematics calculations were derived to find the angles of each leg joint. A 2D

AutoCAD model was created to compare the results with the inverse kinematics calculation. The

leg position was measured to match the 2D AutoCAD model and the inverse kinematics system

proved to be successful.

The hexapod was tested to be able to avoid head-on obstacles by constantly scanning the front

area using infrared sensors. The hexapod was able to lift up its body and scan the height of the

obstacle to determine if it was able to climb over the obstacle or not. The tripod gait walking

method works great on even terrain. Unfortunately, the robot was having trouble climbing over

obstacles due to instability when in high mode and underrated servo torques.

The force sensors did not perform well and stopped working due to long term usage.

Overall, the hexapod has achieved its main objective to autonomously walk and differentiate the

size of obstacles to either avoid or climb over. For that reason, this project has been deemed a

success.

Page 31: ELEC 499 / CENG 499 Group 7: Autonomous Hexapod Robot ...hexapod/documentation/UVic Hexapod 2012.pdf · Group 7: Autonomous Hexapod Robot Final Report ... The first thing that might

29

9 Works Cited

[1] Meriam-Webster Inc., "Robot - Deffinition and more from the free Merriam-Webster

Dictionary," 2012. [Online]. Available: http://mw1.merriam-webster.com/dictionary/robot.

[Accessed 20 March 2012].

[2] RaBoe/Wikipedia, "Bundeswehr Manipulator," 24 March 2012. [Online]. Available:

http://commons.wikimedia.org/wiki/File:Bundeswehr_manipulator_04.jpg. [Accessed 3 April

2012].

[3] PROSPECTOR, "Robot Gossip: Jumping Robot Leg," 13 September 2006. [Online].

Available: http://robotgossip.blogspot.ca/2006/09/jumping-robot-leg.html. [Accessed 4 April

2012].

[4] Wikimedia Foundation Inc., "ASIMO," 28 March 2012. [Online]. Available:

http://en.wikipedia.org/wiki/ASIMO. [Accessed 4 April 2012].