M-File Help: Bicycle View code for Bicycle

Bicycle

Car-like vehicle class

This concrete class models the kinematics of a car-like vehicle (bicycle or Ackerman model) on a plane. For given steering and velocity inputs it updates the true vehicle state and returns noise-corrupted odometry readings.

Methods

Bicycle constructor
add_driver attach a driver object to this vehicle
control generate the control inputs for the vehicle
deriv derivative of state given inputs
init initialize vehicle state
f predict next state based on odometry
Fx Jacobian of f wrt x
Fv Jacobian of f wrt odometry noise
update update the vehicle state
run run for multiple time steps
step move one time step and return noisy odometry

Plotting/display methods

char convert to string
display display state/parameters in human readable form
plot plot/animate vehicle on current figure
plot_xy plot the true path of the vehicle
Vehicle.plotv plot/animate a pose on current figure

Properties (read/write)

x true vehicle state: x, y, theta (3x1)
V odometry covariance (2x2)
odometry distance moved in the last interval (2x1)
rdim dimension of the robot (for drawing)
L length of the vehicle (wheelbase)
alphalim steering wheel limit
maxspeed maximum vehicle speed
T sample interval
verbose verbosity
x_hist history of true vehicle state (Nx3)
driver reference to the driver object
x0 initial state, restored on init()

Examples

Odometry covariance (per timstep) is

V = diag([0.02, 0.5*pi/180].^2);

Create a vehicle with this noisy odometry

v = Bicycle( 'covar', diag([0.1 0.01].^2 );

and display its initial state

v

now apply a speed (0.2m/s) and steer angle (0.1rad) for 1 time step

odo = v.step(0.2, 0.1)

where odo is the noisy odometry estimate, and the new true vehicle state

v

We can add a driver object

v.add_driver( RandomPath(10) )

which will move the vehicle within the region -10<x<10, -10<y<10 which we can see by

v.run(1000)

which shows an animation of the vehicle moving for 1000 time steps between randomly selected wayoints.

Notes

Reference

Robotics, Vision & Control, Chap 6 Peter Corke, Springer 2011

See also

RandomPath, EKF


Bicycle.Bicycle

Vehicle object constructor

v = Bicycle(options) creates a Bicycle object with the kinematics of a bicycle (or Ackerman) vehicle.

Options

'steermax', M Maximu steer angle [rad] (default 0.5)
'accelmax', M Maximum acceleration [m/s2] (default Inf)
'covar', C specify odometry covariance (2x2) (default 0)
'speedmax', S Maximum speed (default 1m/s)
'L', L Wheel base (default 1m)
'x0', x0 Initial state (default (0,0,0) )
'dt', T Time interval (default 0.1)
'rdim', R Robot size as fraction of plot window (default 0.2)
'verbose' Be verbose

Notes

Notes


Bicycle.char

Convert to a string

s = V.char() is a string showing vehicle parameters and state in a compact human readable format.

See also

Bicycle.display


Bicycle.deriv

Time derivative of state

dx = V.deriv(T, x, u) is the time derivative of state (3x1) at the state x (3x1) with input u (2x1).

Notes


Bicycle.f

Predict next state based on odometry

xn = V.f(x, odo) is the predicted next state xn (1x3) based on current state x (1x3) and odometry odo (1x2) = [distance, heading_change].

xn = V.f(x, odo, w) as above but with odometry noise w.

Notes


Bicycle.Fv

Jacobian df/dv

J = V.Fv(x, odo) is the Jacobian df/dv (3x2) at the state x, for odometry input odo (1x2) = [distance, heading_change].

See also

Bicycle.F, Vehicle.Fx


Bicycle.Fx

Jacobian df/dx

J = V.Fx(x, odo) is the Jacobian df/dx (3x3) at the state x, for odometry input odo (1x2) = [distance, heading_change].

See also

Bicycle.f, Vehicle.Fv


Bicycle.update

Update the vehicle state

odo = V.update(u) is the true odometry value for motion with u=[speed,steer].

Notes


 

© 1990-2014 Peter Corke.