68
Mechanical M2 RoboCAD designs [FINAL REPORT – ENGI 8926 ]

New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

Mechanical M2

RoboCAD designs

[FINAL REPORT – ENGI 8926 ]

Page 2: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

1

Executive Summary

This report concludes the work done this term, Winter 2013, for the group M2, RoboCAD Designs. The

introduction briefly outlines the peripherals of each section. From this is the introduction of the initial

phases of the design process, namely, the discussion of important topics necessary for the functioning of

an actively-controlled biped robot. This includes design constraints, objectives, research, and design

considerations. Furthermore, several concepts are provided in this report from which the final design is

derived from. Also included is the work performed on the modelling process; from the CAD designs to

the construction of the robot, and to the simulations.

Following the introduction and planning stages of the production of the robot, the analysis of its

functionality was investigated. Research was performed on the stability and support phases of a walking

robot, as well as the walking swing phase. In conjunction with this, in more detail, is research regarding

the foot of the robot, as well as the comparison between the human and our robot’s gait. The analysis

concludes with calculations of various dynamic aspects; namely the position, velocities, accelerations,

and forces of the leg and joints of the machine.

Finally, concluding remarks of the project are presented, as well as some future suggestions for work.

Page 3: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

2

Table of Contents

1 Introduction .......................................................................................................................................... 5

2 Problem Statement ............................................................................................................................... 6

3 Design Constraints ................................................................................................................................ 6

4 Design Objectives .................................................................................................................................. 7

4.1 Energy and Cost Efficiency ............................................................................................................ 8

4.2 Self-Balancing ................................................................................................................................ 9

4.3 Durability ....................................................................................................................................... 9

4.4 User Friendly Controls................................................................................................................... 9

5 Research .............................................................................................................................................. 10

5.1 Stability and Support ................................................................................................................... 10

5.2 Walking Phase ............................................................................................................................. 12

6 Concept Generation ............................................................................................................................ 14

6.1 Concept 1 .................................................................................................................................... 14

6.2 Concept 2 .................................................................................................................................... 15

7 Design Considerations......................................................................................................................... 16

7.1 The Foot ...................................................................................................................................... 17

7.2 Gait and Gait Selection ............................................................................................................... 19

8 Final Concept ...................................................................................................................................... 20

8.1 Leg Design ................................................................................................................................... 21

8.2 Frame .......................................................................................................................................... 23

8.3 Steering ....................................................................................................................................... 23

8.4 Control System ............................................................................................................................ 24

9 Modelling ............................................................................................................................................ 27

9.1 Developing References through capture of human leg locomotion .......................................... 28

9.2 Ground and Collision Simulation (Simulink) ............................................................................... 30

10 Analysis ........................................................................................................................................... 31

10.1 Foot Locus of Leg Linkages .......................................................................................................... 31

10.1.1 Vector Loops ....................................................................................................................... 34

10.1.2 Quality ................................................................................................................................. 37

10.2 Gait Selection .............................................................................................................................. 39

Page 4: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

3

10.3 Pin Forces .................................................................................................................................... 39

11 Conclusions ..................................................................................................................................... 40

12 Appendix A – Motion Analysis (Hand Calculations) ........................................................................ 42

13 Appendix B – Inverse Dynamics (Hand Calculations) ...................................................................... 46

14 Appendix C – Motion Analysis Code (MATLAB) .............................................................................. 49

15 Appendix D – C++ code ................................................................................................................... 55

Page 5: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

4

Figure 5-1: Example of Organization of Perception and Control of a Walker ............................................ 11

Figure 5-2 Human Gait Cycle....................................................................................................................... 12

Figure 5-3 Percentile Breakdown of Time Spent in Each Walking Phase ................................................... 14

Figure 6-1 Concept 1 ................................................................................................................................... 15

Figure 6-2 Concept 2 ................................................................................................................................... 16

Figure 7-1 Illustration of motion of foot with respect to crank rotation .................................................... 17

Figure 7-2 Theoretical Foot Locus (shown by bold black line) .................................................................... 18

Figure 8-1 Final Design Concept.................................................................................................................. 20

Figure 8-2 sideview of final concept with labeled links .............................................................................. 22

Figure 8-3 Progression of the frame ........................................................................................................... 23

Figure 8-4 Top view of steering mechanism capabilities ............................................................................ 24

Figure 8-5 Control logic for CARL ................................................................................................................ 25

Figure 8-6 Atmega644p & L293D chips showing pin connections .............................................................. 26

Figure 8-7 Controller board ........................................................................................................................ 27

Figure 9-1 SLR camera ................................................................................................................................. 29

Figure 9-2 positions of the hip, knee, and ankle joints during walking ...................................................... 29

Figure 9-3 Current ground model accounting for position and velocity .................................................... 31

Figure 10-1 Theo Jansen Mechanism Linkages ........................................................................................... 32

Figure 10-2 MATLAB foot position .............................................................................................................. 37

Figure 10-3 Gait Diagram ............................................................................................................................ 39

Page 6: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

5

1 Introduction

A lot of research has been put forth into the development of humanoid robots. They are used as a

research tool in several areas such as in biomechanics, human cognition, and personal assistance. With

regards to biomechanics, a humanoid robot may be used to have a better understanding of the human

structure. There have also been advancements in human sensory and its relation to perceptual and

motor skills, which are used to develop computational models. A humanoid robot may be able to

perform human tasks as well, such as work in hazardous environments, assembly lines, and help the

physically disadvantaged.

There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled walker. A

passive-dynamic walker is able to function without the use of any motors, and is generally capable of

manoeuvring slopes in a manner similar to that of humans. An actively-controlled walker, however, rely

on actuators and motors to produce and control joint torques for locomotion. In general, biped robots

have better mobility than conventional wheeled robots; however, they are also unstable as they are

more susceptible to tipping, which are, in part, due to the alternating leg during motion. . In order for

bipedal robots to be able to walk stably in various environments, such as on rough terrain, on inclines

and declines, or in environments that contain obstacles, it is necessary for the robot to adapt to the

ground conditions with a foot motion and maintain its stability with a torso motion in a manner similar

to humans. Research has been conducted to study human locomotion by observing people as they walk,

measuring joint angles, ground reaction forces and the complete walking cycle parameters.

For our term project, we are focusing on the capabilities of an actively-controlled bipedal system which

will be able to walk, turn, and traverse various terrains. We will research existing information on

bipedalism, with the focus held on the human gait which includes the balancing and control of robotic

locomotion.

Page 7: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

6

Since the propse of the project is to design a remote controlled robot, we should be wary of the

complications of having too many input signals. Thus, an important goal is to simplify the design and as a

result, we developed a concept that will only rely on two motors. Of course, the robot will be remote

controlled, but it will also be capable of using a rechargeable battery.

Along the vein of developing a simple machine, we’ve determined that the robot be energy and cost

efficient, possess user friendly controls, be durable and self-balancing. All of this, keeping in mind the

ease and safety of construction, as well as any waste material created in the process.

At the end of this project, we have developed a prototype of our actively-controlled biped robot.

2 Problem Statement

The purpose of this project is to design a remote controlled bipedal robot. The proposed design should

only make use of two motors to turn and propel it, and should be fully capable of maintaining its

balance during motion as it traverses a level horizontal plane. Although not part of the main scope of

the project, the robot’s performance on sloped terrains will also be assessed in order to determine the

versatility of the final design. The final design will incorporate aspects of an idealized biomechanical

system; the musculoskeletal system of a bipedal animal will be lumped into a pair of limbs and feet.

3 Design Constraints

Design Constraints

The project general restrictions are as follows;

Page 8: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

7

I. The system must only use two motors to produce motion

II. The system will not use any sensors to guide its motion or adjust limb positions

III. The system should be designed to be an untethered remote controlled robot

IV. The system design should incorporate a power supply that is rechargeable

V. The power supply should be detachable from the main body of the robot

VI. The design should be safe to operate

VII. The system should not require any assembly before use, the end product should be one whole,

fully assembled device

VIII. The following performance restrictions have been set in order to guide design;

IX. The system should be capable of turning left and right

X. The system should be able to walk along any prescribed course over a level horizontal plane

As the project advances into in-depth design phase and prototype creation phase, more constraints will

be introduced. These constraints will mostly relate to the geometric features of the prototype being

developed.

4 Design Objectives

The primary aim of this project is to develop a mechanism that allows for the movement of a bipedal

vehicle over a variety of terrains. To facilitate the process of creating this vehicle, the following design

objectives have been set. The robot should be:

I. Energy and Cost Efficient

II. Self-balancing

III. Durable

Page 9: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

8

IV. User-friendly

4.1 Energy and Cost Efficiency

Under the specific constraints outlined in the previous section, it is important to make use of and be

efficient with the available resources, specifically with the cost and power requirements.

Movement is provided solely through the input of two motors. These, along with a receiver, will be

powered with a battery on the system itself. The addition of a battery increases the net weight of the

system dramatically, as it is the heaviest component, and will increase the load required by the motor.

In conjunction with this aspect is the walking dynamics of the system. Take into consideration a

multispeed bicycle. Each gear setting dictates the number of rotations a pedal must undergo to

complete one rotation of the rear wheel. In a case where the bicycle is moving uphill, the easiest

method for a rider to traverse the incline is to increase the number of pedal rotations per wheel

rotation. In a similar manner, with an increased load, due to the torques, friction, and inertia of the

parts, the power requirements of a motor increase as well.

In addition to the motor requirements is the gait of the machine, which includes variables such as the

step distance and weight distribution.

Ideally, the design should incorporate lightweight, strong parts that are able to withstand typical forces

encountered during the human gait while easing the load on the motor (and ultimately reduce the

power costs). Associated with those qualities, however, are the costs of the materials as well as the time

required to produce and modify the parts. For instance, it would not be ideal to have parts that need to

be machined, and if so, could be done easily and readily. The design should incorporate mostly

inexpensive materials, and the overall cost of producing the scaled prototype should not exceed

$450.00.

Page 10: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

9

4.2 Self-Balancing

To ensure that the machine does not tip, it will be designed to ensure that its center of mass always falls

inside its base of support. This will ensure that the vehicle is not prone to falling over regardless of what

phase of walking the vehicle is currently in. This is especially important because the center of mass is

constantly shifting over each leg, much like the human body.

4.3 Durability

Any joints, hinges or linkages must be designed to withstand stresses of irregular terrain. The vehicle will

primarily be traversing level terrain, however, even level terrain will have irregularities on the surface

and as such the design must incorporate a sufficiently high design safety factor in order to ensure that

deformation or failure of any part does not occur.

4.4 User Friendly Controls

The vehicle is required to be remotely controlled. It is important that the controls are simple and require

little training to learn. The system response to the controls should be quick, as close to a real-time

response as possible to ensure that the vehicle can be effectively steered to avoid unpredicted obstacles

and make impulsive turns. Essentially, the vehicle should be able to change course at the user’s whim.

Page 11: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

10

5 Research

5.1 Stability and Support

The main principle of stability and control explains that as long as the center of pressure remains within

the polygon of the stance foot, the foot will remain firmly planted on the ground. Satisfaction of this

principle ensures that dynamical degrees of freedom remain fully actuated at all times, and thus control

design can be performed systematically using standard tools in robotics. However, the motions which

are achievable are highly conservative, inefficient and look unnatural. Most robots forgo full actuation

and allow gravity and the natural dynamics to play a large part in the generation of motion. A possible

organizational structure for the perception and control of a dynamic walker on rough terrain is depicted

in Figure [5-1] wherein the main components are:

I. Terrain Perception: fusion of sensors such as vision, radar and laser, perhaps combined with

predefined maps, generating a model of the terrain ahead.

II. Motion Planning: uses the terrain map, current robot state, and a model of the robot’s dynamics

to plan a finite-horizon feasible sequence of footstep locations and joint trajectories. Slow time-

scale: motion plan might be updated once per footstep.

III. Motion Control: feedback control to stabilize the planned motion in the face of inaccurate

modeling, disturbances, time delays, etc.

IV. Robot State Sensing: optical encoders, accelerometers, gyros and foot pressure sensing.

Page 12: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

11

Figure 5-1: Example of Organization of Perception and Control of a Walker

Commonly, bipedal robots include the addition of hip joint actuation, upper body, flat feet and linear

spring-based compliance on ankle joints. These aim for adaptive bipedal locomotion with optimization

based controller. The model consists of an upper body (point mass added stick) that rotates around the

hip joint, a point mass representing the pelvis, two legs with knee joints, and ankle joints and two mass

added flat feet.

The mass of each leg is simplified as point masses added on the Centre of Mass of the shank and the

thigh respectively. A kinematic coupling is often used to keep the body midway between the two legs. In

addition, most models involve added compliance in ankle joints. Specifically, the ankle joints are

modeled as passive joints that are constrained by linear springs. Static balance walking is often achieved

along a horizontal plane although numerous terrain orientations can be derived. The definition of static

equilibrium is equivalent to the condition that the center of mass should be located within the polygon

of support. On this basis, the defined margin of static stability, at any instant, is the shortest distance

between the vertical projection of the biped’s center of gravity and the boundary of the support

polygon.

It is important to note that the proposed design will be remote controlled and therefore will not require

terrain perception. Typically, the control systems generate walking motions by modifying the nominal

walking pattern suitable to the terrain sensed ahead. However, adaptive gait control would not be

Page 13: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

12

possible without sensors and as such, the final design will rely on the physical characteristics of the

robot’s structural material to adjust for terrestrial irregularities.

5.2 Walking Phase

Double support occurs when both feet are on the ground and single support when only one limb is on

the ground. During single support phases whilst walking along a straight path, the projection of the

biped’s center of gravity must be between the two extremities of the stance foot. During double support

phases, the projection of the biped’s center of gravity must be between the tip of the forward foot and

the end of the rear foot. For a biped in single support on a flat floor, the velocity and acceleration of the

generalized coordinates of biped are zero, the projection of the inertia center and the contact pressure

center between the sole and the ground are merged. The gait cycle is the time between successive foot

contacts of the same limbs, thus one gait cycle begins when the reference foot contacts the ground and

ends with subsequent floor contact of the same foot, visually presented in figure [5-2].

Figure 5-2 Human Gait Cycle

Page 14: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

13

The human gait has a double support phase in which the body weight is supported by both legs. The

durations of stance phases are longer than swing phases throughout a neutral walk animation. The

stance to swing ratio is 3:2 on average. As the walking speed increases, the swing phase gets longer and

the stance phase gets shorter. In running the stance/swing ratio reverses and double support phases

disappear.

Double support occurs for two periods of 12% of the gait cycle in a normal walk. Double support occurs

between heel strike of the limb and toe off of the contra-lateral limb. In general, as walking speed

increases, double support time is reduced until it is eliminated and the gait changes to running. During

running the gait cycle for each leg is composed of a single support phase and a float or airborne phase.

Single limb support occurs for two periods of 38% of the gait cycle in a normal walk.

To summarize the stance phase of gait can be divided into three periods:

I. Contact period, when the heel strikes the ground going on to the foot flat period.

II. The mid-stance period of the stance phase when the foot is flat on the ground moving on to

heel lift.

III. The propulsive period of the stance phase when the heel is lifted off the ground and the toe off

position is taken.

The time percent analysis of walking is shown in Figure [5-3].

Page 15: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

14

Figure 5-3 Percentile Breakdown of Time Spent in Each Walking Phase

6 Concept Generation

6.1 Concept 1

For this concept, turning involves the use of solenoids and torsional springs to turn the robot. The design

of the leg motion has not been developed for this idea. To initiate a turn, either the left or right

solenoid on each foot will be engaged to disengage the gear (left solenoid to turn right, right solenoid to

turn left). The motor will continue to rotate and the leg coupled with the gear still engaged will continue

to take steps and the robot will pivot around the disengaged leg. The torsional spring (located in each of

the ankles) will tighten in the disengaged leg as the robot turns. This allows the foot to re-align to a

forward position when the robot finishes the turn, the disengaged leg re-engages, and takes its next

step.

Page 16: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

15

Forward motion will be the result of motor rotating the connected gear which will in turn rotate the two

connected gears and in doing so lift the leg and project it forward to take a step. The gears are aligned in

such a manner as to ensure that the legs are out of phase by 180⁰. Balance would be maintained by

using a gear with an unbalanced mass as the main driving gear. This would shift the weight from side to

side as the robot walks. This concept is shown in figure [6-1].

Figure 6-1 Concept 1

6.2 Concept 2

This concept employs a modified Theo – Jansen Mechanism as its leg linkage design as shown in figure

[6-2]. It utilizes two motors; one to rotate the shaft that couples legs 1 & 2 and the other to change the

angular orientation of the legs to facilitate a turn.

Page 17: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

16

The turning mechanism employed in this concept is similar to that employed in car steering wheels. It

relies heavily on the Cardan universal joint to transfer the rotation of the primary shaft to the crank that

drives the legs whilst allowing the direction in which the legs are pointing in to be changed. The second

motor is used to adjust the direction of the legs by simply rotating in one direction or the other.

Balancing will be facilitated by sliding a mass back and forth to shift the center of mass and this

movement will be the result of the mass being attached to scotch yoke mechanism coupled to the main

shaft using a series of gears.

Figure 6-2 Concept 2

7 Design Considerations

A crank based walking mechanism refers to a mechanism with a linkage that has a point that moves

along a circular path. This circular movement results in a planar translation elsewhere in the linkage or

attached linkages. In the case of this project, the crank mechanism will be driven by one of two motors.

This section of the report will discuss aspects of the vehicle leg design

Page 18: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

17

7.1 The Foot

The foot is the part of the vehicle that comes into contact with the ground or surface. As the vehicle

walks, the foot moves in a cyclical path relative to the main body of the walker. This path is known as

the locus and consists of four parts; support, lift, return, and lower phases. Note that the lift, return, and

lower phases can be lumped into one phase, the transfer phase. During the support phase, the foot is in

contact with the ground providing support to the vehicle. During the lift phase, the foot is moving up

towards the maximum height of the locus. During the return phase, the foot has reached the maximum

height of the locus and is moving in the same direction of the vehicle. During the lower phase, the foot

lowers until it reaches the ground. A theoretical foot locus is shown in Figure [7-1] below;

Figure 7-1 Illustration of motion of foot with respect to crank rotation

Page 19: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

18

Figure 7-2 Theoretical Foot Locus (shown by bold black line)

These locus phases, as shown in figure [7-2] will be important in the leg design as they will dictate the

walking traits the vehicle exhibits. To meet the design objectives set for this project the following

conditions should be incorporated into the leg design;

I. The ratio of time spent in the support phase to the overall duration of the full locus

should be equal to or greater than 0.5. This maximizes the amount of time the foot

spends in contact with the ground and thus increases the stability of the vehicle

throughout the gait.

II. The lift phase of one leg should be paired with the lower phase of the other as this will

minimize the net forces of on the crank and increase energy efficiency

III. The length of the stride, the length of space traversed during the support phase, should

be long relative to the dimensions of the vehicle. This will ensure that the vehicle moves

further with each locomotive cycle and thus increases the systems energy efficiency.

IV. The step height should be sufficient enough to prevent the feet from dragging. This will

improve the vehicle stability as it would reduce the forces on the foot that could cause

Page 20: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

19

the vehicle to tip whilst preventing the gait from being affected by the irregularities of

the terrain surface. Preventing dragging will also reduce energy losses in the system.

V. The loci of both legs should be identical

7.2 Gait and Gait Selection

A gait refers to positions of the legs of a multi-legged system during a full locomotive cycle. Gait

selection refers to a process of adjusting features of the crank-based mechanism in order to assign each

leg of the vehicle to a prescribed position during each point of the locomotive cycle. This is important as

the system energy efficiency can be maximized by adjusting the relative phase of each leg such that the

torque on the crank is minimized. The system stability can be maximized by sequencing the steps of

each leg to ensure that the gait is statically stable over most of the locomotive cycle. The following

aspects of the vehicle gait must be analyzed during the design and optimization phase;

I. Placing Event: This refers to the movement from the transfer phase to the support

phase

II. Lifting Event: The movement from support phase to the transfer phase

III. Duty Factor (βi): This is a ratio of the duration of support phase to the cycle time. This is

typically >0.5 for human walking gaits.

IV. Leg Phase: This is the fraction of the locomotive cycle by which leg 2’s placing event lags

behind leg 1’s placing event

For a bipedal vehicle, the gait selection is limited to wave gaits and equal phase gaits. A wave uses a

wave function to determine the leg phase as a function of the duty factor. It is commonly used by many

insects and animals. An equal phase gait is one in which the lifting and placing events are evenly

distributed throughout the locomotive cycle. This selection has the benefit of being energy efficient as it

Page 21: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

20

minimized the torque on the crank shaft. There are two categories of equal phase gaits; half cycle equal

phase gait and full cycle equal phase gait. Half cycle equal phase gaits are the result of equally

distributing the placing events of the feet on one side of the walker over a span of half of the locomotive

cycle. Full cycle equal phase gaits, on the other hand, are the result of equally distributing the placing

events of the feet on one side of the walker over a span of the full locomotive cycle.

8 Final Concept

Figure 8-1 Final Design Concept

It was important that the final concept meet all of the design requirements set in the research and

concept development phase. This concept employs a modified version of the Theo-Jensen mechanism as

its leg design.

Page 22: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

21

This concept utilizes only two motors; one to turn the machine as introduced in section [6.2], and the

other motor to provide forward locomotion. The design is shown in figure [8-1].

The current design of CARL involved a process of creating a three-dimensional model in SolidWorks

based on the proportions needed to create the desired motion and gait according to Theo-Jensen’s

mechanism.

The turning mechanism employed in this concept is similar to that employed in car steering wheels. It

relies heavily on the Cardan universal joint to transfer the rotation of the primary shaft to the crank that

drives the legs whilst allowing the direction in which the legs are pointing in to be changed. The second

motor is used to adjust the direction of the legs by simply rotating in one direction or the other.

Balancing will be facilitated by sliding a mass back and forth to shift the center of mass and this

movement will be the result of the mass being attached to scotch yoke mechanism coupled to the main

shaft using a series of gears.

8.1 Leg Design

The design for CARL’s legs came from the design of Theo Jansen’s mechanism, called the Strandbeest.

Jansen’s mechanism is comprised of a collection of 11 linkages and is capable of moving on its own with

only natural forces acting upon it. Only the leg design was used for our purpose. Jansen came up with

his design with the intent of modeling an ideal walking gait, with the least amount of time of the “foot”

in the air. The shape made by the walking foot looks like a triangle with rounded corners and with the

longest, horizontal part being the base of the step.

As it takes a step, the foot moves through the top two, short sides quickly, while the other foot is on the

horizontal step. Jansen used a computer program to find the ideal ratio of linkages to get as close to the

ideal step as possible (rounded triangle). The ideal link ratios are as follows in table [8-1]:

Page 23: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

22

Link # Link #

A 38 G 36.7

B 41.5 H 65.7

C 39.3 I 49

D 40.1 J 50

E 55.8 K 61.9

F 39.4 L 7.8

M 15

Table 8-1

Figure 8-2 sideview of final concept with labeled links

For CARL’s leg dimensions, the ratios were divided by ten and given imperial units. The material chosen

for the linkages was acrylic plastic (Plexiglas). This will provide a strong material as well as ease the

speed of production with the use of a laser cutter.

Page 24: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

23

8.2 Frame

Initially, the only requirements set for the frame were the dimensions between the attachments for link

M and link BDE. The center of the frame was removed to save money by reducing the amount of the

material used in construction. As motors were selected and the steering design was refined, the framed

started to take a more practical shape. Material was added in some areas for motor support and

redundant material was removed for cost efficiency. Small holes were extruded through the side to

create attachment points for the controller board, or any other accessories.

When the size and arrangement of leg linkages were determined, the frame was designed according to

the dimensions of the selected motors, the controller boards, the steering design, and the layout of the

motors.

Figure 8-3 Progression of the frame

8.3 Steering

The steering was designed with the idea of car steering in mind. A motor coupled with a 14 ½°, 24 pitch

rack and 24 pitch spur gear are located in the front of the frame. As the motor is engaged, the rack

translates the rack and pushes the front part of the legs (Link BDE) to one side (see figure [8-4]). A

universal joint connects the drive shaft to Link M, which ensures that the link is able to rotate even

when not aligned perpendicular to the frame.

Page 25: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

24

Figure 8-4 Top view of steering mechanism capabilities

8.4 Control System

The control system employed for the purpose of this project is fairly simple. It consists of an Atmel

Atmega644P microcontroller, an L293D H-bridge circuit driver and the transmitting and receiving radios.

Any set of transmitting and receiving devices may be employed for this purpose; the possibility of

transmitting over a Bluetooth device was accessed and found to be plausible with not change to the

code required.

The atmega644P microcontroller is essentially the brain of the system. Its main function is to relay what

pins on the H-bridge circuit should be set high or low and in doing so dictates what motors are on and

what direction the current is flowing through each motor. The controller is also programmed to

communicate with the radio. In this specific application, the device has been programmed to get data

from the radio and executes case statements based on input data. Due to familiarity with the language,

the device was programmed in C++.

Page 26: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

25

Given that the controller would be communicating with radios and such communication is based on

Serial Periphal Interface protocol it was necessary to write code specifically to facilitate this

communication. The code developed is shown in Appendix D under “nordic.c”. The control logic behind

the code is as follows; when the robot is powered on it begins walking forward and continues to do so

until the transmitting radio sends a different signal and the robot adjusts accordingly. This logic is

depicted in the flowchart as shown in Figure [8-5].

Figure 8-5 Control logic for CARL

Page 27: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

26

The L293D is a half H-bridge driver for DC electric motors. They can provide bi-directional control, and

isolate the motor power supply from the logic driver, the Atmega644P microprocessor. The schematic

for connecting the motor to the L293D and the L293D to the microcontroller is shown in Figure [8-6]. An

image of the board is shown in Figure [8-7] with the Atmega644p taken out to show the decoupling

capacitor that protects the microcontroller in the event that the motors draw too much current.

Figure 8-6 Atmega644p & L293D chips showing pin connections

Page 28: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

27

Figure 8-7 Controller board

9 Modelling

RoboCAD decided to use SimMechanics to model and simulate the mechanical system that will be

incorporated into the design of CARL. The advantage of such simulation environments is that they

employ familiar block diagram-oriented modeling paradigms that simulate motion and analyze the

results without deriving the mathematical equations governing the system.

SimMechanics eliminates these by simulating the model’s rigid motion by integrating the multiple

bodies and joints whilst universally lumping the geometric constraints and multiple local coordinate

systems that are inherent to the motion of walking using a mechanized bipedal walker. RoboCAD’s

SimMechanics simulation has incorporated analysis of human leg locomotion as well as the forward

dynamic analysis of CARL’s legs taking into careful consideration force, torque, acceleration, velocity

and finally and most importantly the position of specific points on the legs.

Page 29: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

28

9.1 Developing References through capture of human leg locomotion

The reference trajectory for CARL is based on observing the kinetic motion of human locomotion.

Ultimately, this reference is the basis of the desired trajectory of slow controlled movement that CARL

will undergo. To accomplish this LED diode were attached to central areas located on the hip, knee and

ankle joints of the human leg when viewed from a side profile.

Each LED diode emits a different colour in order to eliminate confusion when analyzing the trajectories

of the LED diodes. Due to the difference in size of the reference model and CARL a scaling ratio was used

to approximate the respective dimensions of the robot. The length of the human leg measuring

approximately one metre and CARL’s legs measuring 13 inches, therefore the ratio is 1:3. Most

importantly, the trajectories shown below are relative to a fixed point on the earth whose simulation in

SimMechanics is detailed further on.

Human gait analysis was accomplished using an ordinary digital SLR camera (figure [9-1]) for image

capture and the movement analysis software was provided by the International Society of Biomechanics

for the 2-D kinematic analysis of movement and rigid body position analysis. Two dimensional analysis is

easier, faster and sometimes more accurate than three dimensional analysis. However, the most

dominant error that were encountered during the two dimensional analysis to motion with out-of-plane

components included system noise due to irregular movement of the inter-segmental joints of the leg

therefore producing noise on the plots of position. This occurs because when walking the human leg

adjusts itself marginally in real-time to ensure balance which is an anthropometric characteristic

inherent to human legs.

Page 30: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

29

Figure 9-1 SLR camera

In the study and research of human locomotion analysis most sources included measurable parameters

and their interpretation which included temporal and spatial analysis of speed, pitch, and dynamic

electromyography, which studies muscle activity during gait. These have not been covered in our scope

because CARL’s system was not designed to consider these aspects, which would incorporate springs

and dampers.

Figure 9-2 positions of the hip, knee, and ankle joints during walking

Page 31: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

30

These graphs, as shown in figure [9-2] show plots of position in the horizontal direction or sagittal plane

(X axis) and the vertical direction or caudal plane (Y axis). Note that the foot position in this figure

follows the foot position shown in figure [7-1].

9.2 Ground and Collision Simulation (Simulink)

According to the Physical Therapy Dictionary website, "ground reaction force" is simply defined as the

reaction to the force the body exerts on the ground. This force is measurable by incorporating

biomechanics and physics equations to allow an athlete or therapy patient feedback on the amount of

force he or she must apply to the ground in order to execute a particular movement. In SimMechanics,

the ground refers to a body of infinite mass that acts as a reference frame at rest for a whole

machine and as a fixed base for attaching machine components. Although this enables the

specification of the degrees of freedom of our system relative to its surroundings, RoboCAD has

sought to eliminate this analysis as it requires syndicated knowledge and analysis study that is

currently out of our scope. The machine environment incorporates a feature in which there is a

dynamic interaction between the feet and the ground during walking. The dynamic analysis,

kinematic analysis and control of CARL are important research areas that will be expanded in

more detail in the next report with real-time analysis of the built model. The elasticity in

conventionally built walking robots is an undesired effect that needs to be eliminated. This

complex phenomenon encompasses energy transmittal with the ground and this creates control

difficulty and this includes the influence of friction which will not be covered in our study and tests.

The linearization model of the ground is shown below and evaluates the model on a level

ground surface with a physically, realistic interaction model based on analyzing the vertical

ground reaction forces that are approximated by nonlinear spring-damper interaction. CARL’s body

Page 32: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

31

dynamics contribute to the stability, energy efficiency and responsive diversity of legged

locomotion that can be adjusted and improved by adjusting the speed of the motor that drives

the robot.

Figure 9-3 Current ground model accounting for position and velocity

10 Analysis

10.1 Foot Locus of Leg Linkages

To determine the motion of the foot relative to the rotating crank arm, executing a motion analysis of

the entire Theo Jansen Mechanism is necessary. The mechanism is shown below in figure [10-1].

Page 33: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

32

Figure 10-1 Theo Jansen Mechanism Linkages

The entire body of the robot is in translation along the y-axis as a result of the rotation of the crank arm,

“m”. To facilitate the motion analysis, any linkages that only move along the same path as the

translating body of the robot can be treated as stationary. Essentially, any movement in the y-axis can

be ignored so long as the magnitude of its velocity is the same as the overall velocity of the translating

body (Rideout, 2013).

Using this assumption, links “a” and “e” in Figure [10-1] can be treated as a stationary base and is crucial

in developing the kinematic equations. It is also assumed that the motor rotates the crank arm at a

constant angular velocity and as such the angular acceleration of the crank arm is zero. To determine

Page 34: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

33

the position of each link along with its angular velocities and accelerations as the crank arm rotates, only

three sets of equations are necessary and they are based on the three sets of vector loops.

Page 35: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

34

10.1.1 Vector Loops

Page 36: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

35

Page 37: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

36

For equations (1) – (9), the lengths of each link are known. These lengths are denoted as “rn” and are

based on scaled versions of the dimensions specified by Theo Jansen, the mechanism`s designer. The

crank arm is treated as the input arm, and as such, its position, angular velocity and angular acceleration

have been predetermined. The equations are used to determine the angular positions of each link as the

crank arm rotates as well as their angular velocities and accelerations. The main intention of solving

Page 38: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

37

these equations is to determine the position of link 8 along with its angular velocity and acceleration as

this would determine the motion of foot relative to the rotation of the crank arm.

Equations (1) – (9) were rewritten and solved using Matlab to yield the locus of the foot seen in Figure

[10-2]. The rewritten equations are shown in Appendix A, “Motion Analysis”. The Matlab code used in

producing Figure [10-2] can be seen in Appendix B, “Motion Analysis Matlab Code”.

Figure 10-2 MATLAB foot position

10.1.2 Quality

Figure [10-2] shows the locus of the Theo Jansen mechanism generated using Matlab code. It provides

information about the stride of the robot based on the current design specifications. Using the above

Page 39: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

38

plot it is possible to determine the stride length and the step height of the leg linkage. The stride length

can be determined by calculating the difference between the minimum and maximum values of position

on the x-axis. Similarly, the step height can be determined by calculating the difference between the

maximum and minimum position values on the y-axis. The resulting values are shown in Table [10-1]

Stride Length (inches) 1.5

Step Height (inches) 5.5

Table 10-1

The information in the table above shows that the stride length is 1.5 inches which represents

approximately 12.5% of the robot’s overall height. The robot is 9.31 inches in width and as such, the

stride represents 16.1 % of this value. This meets the design requirements set in the design objectives

listed in the research and concept development report.

Table [10-1] also shows that the step height is 5.5 inches. This height should be significant enough to

traverse any irregularities on the terrain’s surface. As mentioned in the design objectives, this will

reduce the forces on the foot that cause tipping and improve the robot’s stability in its stride. The step

height is also sufficient enough to prevent the feet from dragging and minimize energy loss.

Figure [10-2] suggests that the placing event time is approximately the same duration of time as the

lifting event. This is because the plot shows that the both sets of events occur one above the other; the

upper half of the locus, the lifting event, and the lower half of the locus, the placing event, stretch over

the same space in the x-axis. This indicates a duty factor of approximately 0.5, this is in-line with the

design objectives set for this project.

Page 40: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

39

Given that both legs follow the exact same design specifications and are merely offset by a phase angle

of 180 degrees, it stands to reason the loci of both legs should be exactly the same barring minor

differences that could arise due to manufacturing tolerances.

10.2 Gait Selection

Given that the robot is essentially a two legged walker, gait selection is limited to equal cycle phase

gaits. Since only one motor will be driving the crank arm of both feet and there are only two feet, the

only possible gait that can be employed is a full cycle equal phase gait. The second leg is offset by 180

degrees. A gait diagram is shown below (figure [10-3]) to illustrate the motion of the robot as it walks

along in the direction shown.

Figure 10-3 Gait Diagram

10.3 Pin Forces

In order to determine the torque required to create the desired motion it becomes necessary to take

the information obtained from the acceleration analysis to generate and the mass properties of Plexiglas

to solve for the forces acting on each pin as well as the torque required at the crank arm. This exercise

should provide a minimum motor size requirement and by proxy provide an indication as to the battery

size required to power said motor.

At this stage in the project, the equations have been developed to solve for the forces and they can be

seen in Appendix B “Inverse Dynamics Hand Calculations”.

Page 41: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

40

11 Conclusions

Starting from a few concepts, with research into the available resources concerning humanoid robotics,

a prototype of CARL, our actively controlled biped robot has been created. Taken into consideration the

energy and costs of the project, various objectives were met; the machine is self-balancing, durable, and

is user friendly. This task was met through extensive research in the stability and walking motion of

humans and in robotics. The stability phase of the project consisted of the leg design based from Theo-

Jensens’ Strandbeest, which aims to mimic the foot locus of humans, and the weight distributions

provided by the shifting center of mass; from the unstable leg to the stable. To verify the validity of the

simulations, we’ve also taken the opportunity to perform analytical hand calculations of the position,

velocities, and accelerations of the major links and joints in the system.

We did not, however, in the end, manage to meet one major goal, which was to have the prototype

function. Due to a deficiency of time and resources, we were not able to install the gears necessary for

the coupling motion of the legs with the weight balancing mechanism provided by the scotch-yoke

concept outlined in this report. We did, however, construct the legs, foot, and the control system for the

machine.

Considerations for improvements are wide. One of the major issues encountered during the completion

of the term was the fact that during the research component of the project, many sources have lumped

the varying human components of the leg into large segmented polygons so simplify the movement of

their models. The issue, however, with this is the fact that the adaptability that humans have on various

terrain cannot be remodelled as a simple system of 2-3 polygons. As a suggestion, further time and

resources should be put into the prototype such that the robot legs mimic the human leg as much as

possible.

Page 42: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

41

Another consideration was the construction phase of the project. Due to the limitations of the tools

used to create the pieces of the robot, there were variations and alterations of the part dimensions. This

meant that a lot of time had gone to make reparations of these errors. Since the processes were done

by hand, instead of with the laser cutter and the rapid prototyping machine, the robot, CARL, was

susceptible to dimensional inconsistencies.

Page 43: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

42

12 Appendix A – Motion Analysis (Hand Calculations)

Page 44: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

43

Page 45: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

44

Page 46: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

45

Page 47: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

46

13 Appendix B – Inverse Dynamics (Hand Calculations)

Page 48: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

47

Page 49: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

48

Page 50: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

49

14 Appendix C – Motion Analysis Code (MATLAB) close all

clear all

a = 3.80

b = 4.15

c = 3.93

d = 4.01

e = 5.58

f = 3.94

g = 3.67

h = 6.57

ilink = 4.90

j = 5.00

k = 6.19

l = 0.78

m = 1.50

r1 = sqrt((a^2 )+(e^2))

r2 = m

r3 = j

r4a = b

r4b = d

r5 = k

r6 = c

r7 = f

Page 51: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

50

r8a = g

%

n = 400;

t = linspace(0,10,n);

theta2dot = 1;

theta1 = pi;

%

% Position analysis

%

% Loop 1

for i=1:n

theta2(i) = theta2dot*t(i);

a(i) = 2*r2*r4a*cos(theta2(i)) - 2*r1*r4a*cos(theta1);

b(i) = 2*r2*r4a*sin(theta2(i)) - 2*r1*r4a*sin(theta1);

c(i) = (r1^2) + (r2^2) + (r4a^2) - (r3^2) -(2*r1*r2*((cos(theta1)*cos(theta2(i))) +

(sin(theta1)*sin(theta2(i)))));

theta4a(i) = 2*atan((-b(i)-sqrt(b(i)^2 - c(i)^2+a(i)^2))/(c(i)-a(i)));

theta4b(i) = theta4a(i) - ((90*pi)/180);

theta3(i) = acos(((r1*cos(theta1))-(r2*cos(theta2(i)))-(r4a*cos(theta4a(i))))/r3);

end;

% Loop 2

for i = 1:n

a2(i) = 2*r3*r6*cos(theta3(i)) + 2*r4a*r6*cos(theta4a(i));

b2(i) = 2*r3*r6*sin(theta3(i)) + 2*r4a*r6*sin(theta4a(i));

c2(i) = r3^2 + r6^2 + r4a^2 - r5^2 +

2*r3*r4a*((cos(theta3(i))*cos(theta4a(i))) +

Page 52: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

51

(sin(theta3(i))*sin(theta4a(i))));

theta6(i) = 2*atan((-b2(i)-sqrt(b2(i)^2 - c2(i)^2+a2(i)^2))/(c2(i)-a2(i)));

theta5(i) =

acos(((r3*cos(theta3(i)))+(r6*cos(theta6(i)))+(r4a*cos(theta4a(i))))/r5);

end;

% Loop 3

for i = 1:n

a3(i) = 2*r7*r6*cos(theta6(i)) - 2*r4b*r6*cos(theta4b(i));

b3(i) = 2*r7*r6*sin(theta6(i)) - 2*r4b*r6*sin(theta4b(i));

c3(i) = r7^2 + r6^2 + r4b^2 - r8a^2 +

2*r6*r4b*((cos(theta6(i))*cos(theta4b(i))) +

(sin(theta6(i))*sin(theta4b(i))));

theta7(i) = 2*atan((-b3(i)-sqrt(b3(i)^2 - c3(i)^2+a3(i)^2))/(c3(i)-a3(i)));

theta8a(i) = acos(((r7*cos(theta7(i)))+(r6*cos(theta6(i)))-(r4b*cos(theta4b(i))))/(-r8a));

end;

for i = 1:n

rGx(i) = (r2*cos(theta2(i))+ r5*cos(theta5(i))+

ilink*cos(theta8a(i)+(pi/2)));

rGy(i) = (r2*sin(theta2(i))+ r5*sin(theta5(i))+

ilink*sin(theta8a(i)+(pi/2)));

end;

for i = 1:n

%first loop

A = [-r3*sin(theta3(i)) (-r4a*sin(theta4a(i))); (r3*cos(theta3(i)))

r4a*cos(theta4a(i))];

Page 53: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

52

bv = [r2*theta2dot*sin(theta2(i)) ; -r2*theta2dot*cos(theta2(i))];

vel = inv(A)*bv;

th3dot(i) = vel(1);

th4dot(i) = vel(2);

%second loop

A = [-r5*sin(theta5(i)) r6*sin(theta6(i)); r5*cos(theta5(i)) -r6*cos(theta6(i))];

bv = [((-r4a*th4dot(i)*sin(theta4a(i)))-(r3*th3dot(i)*sin(theta3(i)))) ;

((r4a*th4dot(i)*cos(theta4a(i)))+(r3*th3dot(i)*cos(theta3(i))))];

vel2 = inv(A)*bv;

th5dot(i) = vel2(1);

th6dot(i) = vel2(2);

%

%third loop

A = [-r8a*sin(theta8a(i)) -r7*sin(theta7(i)); r8a*cos(theta8a(i)) -r7*cos(theta7(i))];

bv = [((-r4b*th4dot(i)*sin(theta4b(i)))-(r6*th6dot(i)*sin(theta6(i)))) ;

((r4b*th4dot(i)*cos(theta4b(i)))+(r6*th6dot(i)*cos(theta6(i))))];

vel3 = inv(A)*bv;

th8dot(i) = vel3(1);

th7dot(i) = vel3(2);

end;

%

for i = 1:n

%first loop

A = [ r3*sin(theta3(i)) (r4a*sin(theta4a(i)));(-r3*cos(theta3(i))) -r4a*cos(theta4a(i))];

Page 54: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

53

bv = [((-r4a*th4dot(i)^2*cos(theta4a(i))) - (r3*th3dot(i)^2*cos(theta3(i))) -

(r2*theta2dot^2*cos(theta2(i)))) ; ((-r4a*th4dot(i)^2*sin(theta4a(i))) -(r3*th3dot(i)^2*sin(theta3(i))) -

(r2*theta2dot^2*sin(theta2(i)))) ];

acl = inv(A)*bv;

th3dbldot(i) = acl(1);

th4dbldot(i) = acl(2);

%second loop

A = [-r5*sin(theta5(i)) r6*sin(theta6(i));r5*cos(theta5(i)) (-r6*cos(theta6(i)))];

bv = [((r5*th5dot(i)^2*cos(theta5(i)))- (r3*th3dot(i)^2*cos(theta3(i))) -(r4a*th4dot(i)^2*cos(theta4a(i)))-

(r6*th6dot(i)^2*cos(theta6(i))) -(r3*th3dbldot(i)*sin(theta3(i)))-(r4a*th4dbldot(i)*sin(theta4a(i)))) ;

((r5*th5dot(i)^2*sin(theta5(i)))- (r3*th3dot(i)^2*sin(theta3(i))) -(r4a*th4dot(i)^2*sin(theta4a(i)))-

(r6*th6dot(i)^2*sin(theta6(i))) +

(r3*th3dbldot(i)*cos(theta3(i)))+(r4a*th4dbldot(i)*cos(theta4a(i))))];

acl2 = inv(A)*bv;

th5dbldot(i) = acl2(1);

th6dbldot(i) = acl2(2);

%third loop

A = [-r8a*sin(theta8a(i)) r7*sin(theta6(i));r8a*cos(theta8a(i)) (-r7*cos(theta7(i)))];

bv = [((r8a*th8dot(i)^2*cos(theta8a(i)))- (r6*th6dot(i)^2*cos(theta6(i))) -

(r4b*th4dot(i)^2*cos(theta4b(i)))- (r7*th7dot(i)^2*cos(theta7(i))) -(r6*th6dbldot(i)*sin(theta6(i)))-

(r4b*th4dbldot(i)*sin(theta4b(i)))) ;

((r8a*th8dot(i)^2*sin(theta8a(i)))- (r6*th6dot(i)^2*sin(theta6(i))) -(r4b*th4dot(i)^2*sin(theta4b(i)))-

(r7*th7dot(i)^2*sin(theta7(i))) +

(r6*th6dbldot(i)*cos(theta6(i)))+(r4b*th4dbldot(i)*cos(theta4b(i))))];

acl3 = inv(A)*bv;

th8dbldot(i) = acl3(1);

th7dbldot(i) = acl3(2);

end;

Page 55: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

54

% Plots

%

figure(1)

plot(rGx,rGy);

ylabel('Step Height w.r.t Time');

xlabel('Horizontal Position');

Page 56: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

55

15 Appendix D – C++ code Walker.c #include <avr/io.h> #include<avr/sleep.h> #include<avr/interrupt.h> #include <avr/power.h> #include <avr/wdt.h> #include <util/delay.h> #include "nordic-nRF24L01.c" #define TRUE 1; #define FALSE 0; char old_index; int8_t running = FALSE; // define functions void init(void); void timer2_pwm_init(void); void handle_key(char key); char getkey(void); void timer2_pwm_init(void) {

Page 57: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

56

// set fast PWM, NON-INVERTING OUTPUT TCCR2A = _BV(COM2A1)|_BV(COM2B1)|_BV(WGM21)|_BV(WGM20); TCCR2B = 0; // timer stopped OCR2A = 0; OCR2B = 0; DDRD |= _BV(PD6)|_BV(PD7); // enable interrupts - for sleep TIMSK2 = _BV(TOIE2); //set 8-bit Timer/Counter2 Overflow Interrupt Enable // TIMSK2 = _BV(OCIE2A); // set interrupt mask to overflow TIFR2=0; //clear any pending timer interrupts } void init(void) { // disable watchdog timer MCUSR = 0; wdt_disable(); timer2_pwm_init(); init_nRF_pins();

Page 58: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

57

// set sleep mode to wait out interrupts set_sleep_mode(SLEEP_MODE_IDLE); } ISR(TIMER2_OVF_vect) // for ATMega644 { } char getkey() { char rxkey; uint8_t incoming, index; incoming = rx_send_byte(0xFF); // read status register if (incoming == 0xFF) return(0); // receiver not installed if (!(incoming & 0x40)) return(0); // no data received // otherwise we got data receive_data(); index = data_array[2]; // if (index == old_index) return(0); // old_index = index; rxkey = data_array[0] & 0x1F; // assumes low order 5 bits only used return(rxkey);

Page 59: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

58

} int main( void ) { char key; init(); PORTC = 0x00; // all off DDRC = 0x3F; // show byte in leds DDRD |= 0xFE; // port D has timer and control, usart output (PD0 is RxD0) PORTD = 0; // motor is in braking configure_receiver(); sei(); // enable interrupts PORTD |= _BV(PD2); PORTD &= ~(_BV(PD3) | _BV(PD4) | _BV(PD5)) // PORTD &= ~(_BV(PD2) | _BV(PD3) | _BV(PD4) | _BV(PD5)); OCR2A = 150; OCR2B = 150; // start timer // TCCR2B = _BV(CS22)|_BV(CS20); // update approx. 244 times per sec. at 8 MHz TCCR2B = _BV(CS21); // update approx. 488 times per sec. at 1 MHz // start control loop while ( 1 ) { key = getkey(); if (key) { PORTC = key; handle_key(key); } sleep_mode(); // sleep until timer interrupt // _delay_ms(5); } return 0; } void handle_key(char key) { switch (key) // center key { case 0x0F: // stop - center key PORTD &= ~(_BV(PD2) | _BV(PD3) | _BV(PD4) | _BV(PD5)); OCR2A = 0; OCR2B = 0; running = FALSE; break;

Page 60: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

59

case 0x1D: // forward or speed up - top key PORTD |= _BV(PD2); PORTD &= ~(_BV(PD3) | _BV(PD4) | _BV(PD5)); OCR2A = 100; OCR2B = 100; running = TRUE; break; case 0x1E: // backward or slow down - bottom key PORTD |= _BV(PD3); PORTD &= ~(_BV(PD2) | _BV(PD4) | _BV(PD5)); OCR2A = 100; OCR2B = 100; running = TRUE; break; case 0x17: // implement left turn - left button PORTD |= _BV(PD2)| _BV(PD4); PORTD &= ~(_BV(PD3) | _BV(PD5)); OCR2A = 100; OCR2B = 100; running = TRUE; break; case 0x1B: // implement right turn PORTD |= _BV(PD2)| _BV(PD5); PORTD &= ~(_BV(PD3) | _BV(PD4)); OCR2A = 100; OCR2B = 100; running = TRUE; break; default: break; } }

Page 61: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

60

Nordic. C // NRF24l01 transceiver code // adapted from original Sparkfun code // uses a 4 byte payload, to match the SF Nordic fob #define RX_PORT PORTB #define RX_PORT_PIN PINB #define RX_PORT_DD DDRB #define RX_CE 3 //Output #define RX_CSN 4 //Output #define RX_SCK 7 //Output #define RX_MOSI 5 //Output #define RX_MISO 6 //Input uint8_t data_array[4]; #define sbi(var, mask) ((var) |= (uint8_t)(1 << mask)) #define cbi(var, mask) ((var) &= (uint8_t)~(1 << mask)) uint8_t rx_address[5] = {0XE7, 0XE7, 0XE7, 0XE7, 0XE7}; // default uint8_t rx_channel = 2; // default //2.4G Configuration - Receiver

Page 62: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

61

void configure_receiver(void); //Sends one byte to nRF uint8_t rx_send_byte(uint8_t cmd); //Sends command to nRF uint8_t rx_send_command(uint8_t cmd, uint8_t data); //Set RX address - stored in eeprom void rx_send_rx_address(void); //Sends the 4 bytes of payload void rx_send_payload(uint8_t cmd); //Basic SPI to nRF uint8_t rx_spi_byte(uint8_t outgoing); void init_nRF_pins(void) { volatile char IOReg; //1 = Output, 0 = Input RX_PORT_DD |= (1<<RX_CE) | (1<<RX_MOSI) | (1<<RX_CSN) | (1<<RX_SCK); // Enable pull-up resistors RX_PORT = 0b11111110; // enable SPI in Master Mode with SCK = CK/4 // SPR1, SPR0 = 00 - divide by 4. 01 - by 16, 10 - by 64, 11 by 128 SPCR = (1<<SPE)|(1<<MSTR); // CK/4

Page 63: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

62

// SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR0); // CK/16 // SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1); // CK/64 IOReg = SPSR; // clear SPIF bit in SPSR IOReg = SPDR; cbi(RX_PORT, RX_CE); //Stand by mode } //RX Functions //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= //Reads the current RX buffer into the data array //Forces an RX buffer flush void receive_data(void) { cbi(RX_PORT, RX_CSN); //Stand by mode rx_spi_byte(0x61); //Read RX Payload data_array[0] = rx_spi_byte(0xFF); data_array[1] = rx_spi_byte(0xFF); data_array[2] = rx_spi_byte(0xFF); data_array[3] = rx_spi_byte(0xFF); sbi(RX_PORT, RX_CSN); rx_send_byte(0xE2); //Flush RX FIFO

Page 64: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

63

rx_send_command(0x27, 0x40); //Clear RF FIFO interrupt sbi(RX_PORT, RX_CE); //Go back to receiving! } //2.4G Configuration - Receiver //This setups up a RF-24G for receiving at 1mbps void configure_receiver(void) { uint8_t channel; cbi(RX_PORT, RX_CE); //Go into standby mode rx_send_command(0x20, 0x39); //Enable RX IRQ, CRC Enabled, be a receiver rx_send_command(0x21, 0x00); //Disable auto-acknowledge rx_send_command(0x23, 0x03); //Set address width to 5bytes (default, not really needed) rx_send_command(0x26, 0x07); //Air data rate 1Mbit, 0dBm, Setup LNA rx_send_command(0x31, 0x04); //4 byte receive payload

Page 65: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

64

channel = rx_channel; if (channel < 84) // channels 84-127 are illegal { rx_send_command(0x25, channel); } else { rx_send_command(0x25, 0x02); //RF Channel 2 (default, not really needed) } rx_send_rx_address(); //Set RX address rx_send_command(0x20, 0x3B); //RX interrupt, power up, be a receiver sbi(RX_PORT, RX_CE); //Start receiving! } //Sends the 4 bytes of payload void rx_send_payload(uint8_t cmd) { uint8_t i; cbi(RX_PORT, RX_CSN); //Select chip rx_spi_byte(cmd);

Page 66: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

65

for(i = 0 ; i < 4 ; i++) rx_spi_byte(data_array[i]); sbi(RX_PORT, RX_CSN); //Deselect chip } void rx_send_rx_address() //Set RX address - stored in eeprom { uint8_t i,address; cbi(RX_PORT, RX_CSN); // Select chip rx_spi_byte(0x2A); // pipe 0 read address for(i = 0 ; i < 5 ; i++) { address = rx_address[i]; rx_spi_byte(address); } sbi(RX_PORT, RX_CSN); //Deselect chip } //Sends command to nRF

Page 67: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

66

uint8_t rx_send_command(uint8_t cmd, uint8_t data) { uint8_t status; cbi(RX_PORT, RX_CE); //Stand by mode cbi(RX_PORT, RX_CSN); //Select chip rx_spi_byte(cmd); status = rx_spi_byte(data); sbi(RX_PORT, RX_CSN); //Deselect chip return(status); } //Sends one byte to nRF uint8_t rx_send_byte(uint8_t cmd) { uint8_t status; cbi(RX_PORT, RX_CSN); //Select chip status = rx_spi_byte(cmd); sbi(RX_PORT, RX_CSN); //Deselect chip return(status);

Page 68: New Final report – engi 8926 · 2015. 5. 13. · Figure 10-1 Theo Jansen Mechanism Linkages ... There are two possible bipedal walkers; a passive-dynamic walker and an actively-controlled

67

} //Basic hardware SPI uint8_t rx_spi_byte(uint8_t byte) { SPDR = byte; // send Character while (!(SPSR & (1<<SPIF))); // wait until Char is sent return (uint8_t) SPDR; }