robotics 0.1 lecture 2: robot motion 0.1 see course...

30
Robotics Lecture 2: Robot Motion See course website http://www.doc.ic.ac.uk/~ajd/Robotics/ for up to date information. Andrew Davison Department of Computing Imperial College London October 17, 2017

Upload: duongdiep

Post on 06-May-2018

228 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Robotics

Lecture 2: Robot Motion

See course website

http://www.doc.ic.ac.uk/~ajd/Robotics/ for up to

date information.

Andrew DavisonDepartment of ComputingImperial College London

October 17, 2017

Page 2: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Robot Motion

• A mobile robot can move and sense, and must process informationto link these two. In this lecture we concentrate on robotmovement, or locomotion.

What are the possible goals of a robot locomotion system?

• Speed and/or acceleration of movement.

• Precision of positioning (repeatability).

• Flexibility and robustness in different conditions.

• Efficiency (low power consumption)?

Page 3: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Locomotion

• Robots might want to move in water, in the air, on land, in space...?

AUV Micro UAV Zero-G Assistant Spider Humanoid

• In this course we will concentrate on wheeled robots which move onfairly flat surfaces.

Page 4: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Motion and Coordinate Frames

R

R

R Coordinate FrameCarried With Robot

xW

W

W

y

x

y

Fixed World Coordinate Frame W

θ

World Frame W

W

R

Robot Frame R

x (forward)

Ry (left)

Rz (up)

Wx

Wy

z

2D 3D

• We define two coordinate frames: a world frame W anchored in theworld, and a robot frame R which is carried by and stays fixedrelative to the robot at all times.

• Often we are interested in knowing the robot’s location: i.e. what isthe transformation between frames W and R?

Page 5: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Degrees of Motion Freedom

• A rigid body which translates and rotates along a 1D path has 1degree of freedom (DOF): translational. Example: a train.

• A rigid body which translates and rotates on a 2D plane has 3 DOF:2 translational, 1 rotational. Example: a ground robot.

• A rigid body which translates and rotates in a 3D volume has 6DOF: 3 translational, 3 rotational. Example: a flying robot.

• A holonomic robot is one which is able to move instantaneously inany direction in the space of its degrees of freedom.

• Otherwise a robot is called non-holonomic.

Page 6: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

A Holonomic Ground Robot

• Holonomic robots do exist, but need many motors or unusualdesigns and are often impractical.

• Ground-based holonomic robots can be made using omnidirectionalwheels; e.g.http://www.youtube.com/watch?v=HkhGr7qfeT0

Page 7: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Exotic Wheeled Robots

Segway RMP Mars Rover

• Segway platform with dynamic balance gives good height with smallfootprint and high acceleration. Self-balancing Lego Robots built byDoC students in 2008:http://www.youtube.com/watch?v=fQQctJz7ap4

• Mars Rover has wheels on stalks to tackle large obstacles.

Page 8: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Standard Wheel Configurations

Rack and Pinion Differential Drive Skid-Steer Synchro Drive

• Simple, reliable, robust mechanisms suitable for robots whichessentially move in a plane.

• All of these robots are non-holonomic (each uses two motors, buthas three degrees of movement freedom). For instance, a car-likerobot can’t instantaneously move sideways.

Page 9: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Differential Drive

• Two motors, one per wheel: steering achieved by setting differentspeeds.

• Wheels run at equal speeds for straight-line motion.

• Wheels run at equal and opposite speeds to turn on the spot.

• Other combinations of speeds lead to motion in a circular arc.

Page 10: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Circular Path of a Differential Drive Robot

R

W

∆θ

We define the wheel velocities of the left and right wheels respectively tobe vL and vR (linear velocities of the wheels over the ground: e.g.vL = rLωL, where rL is the radius of the wheel and ωL is its angularvelocity). The width between the wheels of the differential drive robot isW .

• Straight line motion if vL = vR

• Turns on the spot if vL = −vR• More general case: moves in a circular arc.

Page 11: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Circular Path of a Differential Drive RobotTo find radius R of curved path: consider a period of motion ∆t wherethe robot moves along a circular arc through angle ∆θ.

• Left wheel: distance moved = vL∆t; radius of arc = R − W2 .

• Right wheel: distance moved = vR∆t; radius of arc = R + W2 .

• Both wheel arcs subtend the same angle ∆θ so:

∆θ =vL∆t

R − W2

=vR∆t

R + W2

⇒ W

2(vL + vR) = R(vR − vL)

⇒ R =W (vR + vL)

2(vR − vL)∆θ =

(vR − vL)∆t

W

These equations are the basis for odometry: given certain control inputs,how does the robot move?

Page 12: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Car/Tricycle/Rack and Pinion Drive

Car Tricycle

• Two motors: one to drive, one to steer.

• Cannot normally turn on the spot.

• With a fixed speed and steering angle, it will follow a circular path.

• With four wheels, need rear differential and variable (‘Ackerman’)linkage for steering wheels.

Page 13: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Circular Path of a Car-Like Tricycle RobotThis is a robot configuration which has a single steerable and drivablewheel at the back. The front wheels are free running.

L

d

s

R

R

s

Robot Centre

∆θ

Assuming no sideways wheel slip, we intersect the axes of the front andback wheels to form a right-angle triangle, and obtain:

R =L

tan s.

The radius of the path that the rear driving wheel moves in is:

Rd =L

sin s.

Page 14: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Circular Path of a Car-Like Tricycle Robot

L

d

s

R

R

s

Robot Centre

∆θ

In time ∆t the distance along its circular arc moved by the drive wheel isv∆t, so the angle ∆θ through which the robot rotates is:

∆θ =v∆t

Rd=

v∆t sin s

L.

R =L

tan s∆θ =

v∆t sin s

L

Page 15: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Actuation of Driving Wheels: DC Motors

• Most common motors, available in all sizes and types.

• Simple control with voltage or Pulse Width Modulation (PWM).

• For precision, encoders and feedback can be used for servo control(the NXT motors have built-in encoders).

Page 16: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Gearing

• DC motors tend to offer high speed and low torque, so gearing isnearly always required to drive a robot

If Gear 1 is driven with torque t1, it exerts tangential force:

F =t1r1

on Gear 2. The torque in Gear 2 is therefore:

t2 = r2F =r2r1t1 .

Page 17: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Gearing

The change in angular velocity between Gear 1 and Gear 2 is calculatedby considering velocity at the point where they meet:

v = ω1r1 = ω2r2

⇒ ω2 =r1r2ω1

• When a small gear drives a bigger gear, the second gear has highertorque and lower angular velocity in proportion to the ratio of teeth.

• Gears can be chained together to achieve compound effects.

Page 18: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Motor Control — Open Loop

Pu yx

• Let P be a Single-Input-Single-Output (SISO) dynamic system (e.g.Lego Mindstorms geared DC motor). It is described by:

• an input u,here: voltage V or corresponding PWM value,

• internal states x, whose dynamics follow differential equations,here: x = [x1, x2]> = [ω, ϕ]>, with rotation speed ω and angle ϕ,

• an output y as a function of x,here: angle ϕ, i.e. y = x2.

• Qualitative open-loop response on input (voltage) step:

u=V y=

t

Page 19: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Motor Control — Closed Loop

• How about we want to accurately reach and keep a reference angle?

→ Closed-loop control!

• Let C be a controller, possibly with internal states:

Pu yx

Cer-

• r is a reference (desired) output, and• e is the error between reference and actual output.

Page 20: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Motor Control — PID

• PID (Proportional-Integral-Differential): a simple controller:

C : u(t) = kpe(t) + ki

∫ t

t0

e(τ)dτ + kdde(t)

dt,

• with kp: proportional gain, reduces the error,• ki : integral gain, removes steady-state error,• and kd : differential gain, can reduce settling time.

• Qualitative closed-loop system response to reference step(well-tuned controller):

r,u

t

• Simple (heuristic) tuning rule: Ziegler-Nichols:• set ki and kd to zero. Increase kp until the system starts oscillating

with period Pu (in seconds) — remember this gain as ku;• set kp = 0.6ku, ki = 2kp/Pu, and kd = kpPu/8.

Page 21: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Motor Control — Additional Tweaks

• Reference filtering: respect physical limits already in the reference:

r,rf

tcons

t. spe

ed

max. acceleration

• Anti-Reset-Windup: stops integrating the error for the I-part, whenu is at its physical limit.

• Dead-band compensation: add offset to u to compensate friction.

• Feed-forward controller Cf : uf (t) = kfdr(t)dt ,

reduces “work” for the feed-back controller:

Pyx

Cer-

u

Cf

uf

+

Page 22: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Mapping Wheel Rotation Speed to Velocity

• What is the robot speed, when the wheels turn?

ωv=rwω

• In principle, we could measure the radius of each wheel rw to turnangular velocity into linear motion. However, in practice (due tohard to model factors, such as surface slip and tyre softness) it ismuch better to calibrate such things empirically. i.e., viaexperiments (guided trial and error), work out the scaling betweenthe motor reference angle and distance travelled over the ground.

Page 23: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Motion and State on a 2D Plane

• If we assume that a robot is confined to moving on a plane, itslocation can be defined with a state vector x consisting of threeparameters:

x =

xyθ

• x and y specify the location of the pre-defined ‘robot centre’ point

in the world frame.

• θ specifies the rotation angle between the two coordinate frames(the angle between the xW and xR axes).

• The two coordinate frame coincide when the robot is at the origin,and x = y = θ = 0.

Page 24: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Integrating Motion in 2D• 2D motion on a plane: three degrees of positional freedom,

represented by (x , y , θ) with −π < θ <= π.• Consider a robot which only drives ahead or turns on the spot:

R

R

R Coordinate FrameCarried With Robot

xW

W

W

y

x

y

Fixed World Coordinate Frame W

θ

• During a straight-line period of motion of distance D: xnewynewθnew

=

x + D cos θy + D sin θ

θ

• During a pure rotation of angle angle α: xnew

ynewθnew

=

xy

θ + α

Page 25: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Integrating Circular Motion Estimates in 2D

y

θR

∆θ θ

y

x x new

new

new

In the cases of both differential drive and the tricycle robot, we were ableto obtain expressions for R and ∆θ for periods of constant circularmotion. Given these: xnew

ynewθnew

=

x + R(sin(∆θ + θ)− sin θ)y − R(cos(∆θ + θ)− cos θ)

θ + ∆θ

Page 26: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Position-Based Path Planning

x

y

θ

Assuming that a robot has localisation, and knows where it is relative toa fixed coordinate frame, then position-based path planning enables it tomove in a precise way along a sequence of pre-defined waypoints. Pathsof various curved shapes could be planned, aiming to optimise criteriasuch as overall time or power usage. Here we will consider the specific,simple case where we assume that:

• Our robot’s movements are composed by straight-line segmentsseparated by turns on the spot.

• The robot aims to minimise total distance travelled, so it alwaysturns immediately to face the next waypoint and drives straighttowards it.

Page 27: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Position-Based Path Planning

In one step of path planning, assume that the robot’s current pose is(x , y , θ) and the next waypoint to travel to is at (Wx ,Wy ).

• It must first rotate to point towards the waypoint. The vectordirection it must point in is:(

dxdy

)=

(Wx − xWy − y

)The absolute angular orientation α the robot must drive in istherefore given by:

α = tan−1 dydx

Care must be taken to make sure that α is in the correct quadrant of−π < α ≤ π. A standard tan−1 function will return a value in the range−π/2 < α <= π/2. This can be also achieved directly with anatan2(dy, dx) function (available in Python’s math module).

Page 28: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Position-Based Path Planning

• The angle the robot must rotate through is therefore β = α− θ. Ifthe robot is to move as efficiently as possible, care should be takento shift this angle by adding or subtracting 2π so make sure that−π < β ≤ π.

• The robot should then drive forward in a straight line through

distance d =√d2x + d2

y .

Page 29: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Lego Mindstorms NXT and BrickPi

• Please READ THE WHOLE PRACTICAL SHEET CAREFULLY.

• Lab location: teaching lab 219, one floor down.

• Organise yourselves into groups and come to us to fill in a form andget a kit.

Page 30: Robotics 0.1 Lecture 2: Robot Motion 0.1 See course ...ajd/Robotics/RoboticsResources/lecture2.pdf · Rack and Pinion Di erential Drive Skid-Steer Synchro Drive ... encoders and feedback

Week 2 Practical: Locomotion, Calibration and AccurateMotion

xW

Wy

Fixed World Coordinate Frame W

40cm

40cm

• Today’s practical is on accurate robot motion. How well is it reallypossible to estimate robot motion from wheel odometry?

• Everyone should read the practical sheet fully!

• This is an ASSESSED practical: we will assess your achievementnext week at the start of next week’s practical. Your whole groupshould be there to demonstrate and discuss your robot.