M-File Help: Vehicle View code for Vehicle

Vehicle

Car-like vehicle class

This class models the kinematics of a car-like vehicle (bicycle model). For given steering and velocity inputs it updates the true vehicle state and returns noise-corrupted odometry readings. veh = Vehicle object with odometry covariance v, where v is a 2x2 matrix corresponding to the odometry vector [dx dtheta].

Methods

init initialize vehicle state
f predict next state based on odometry
step move one time step and return noisy odometry
control generate the control inputs for the vehicle
update update the vehicle state
run run for multiple time steps
Fx Jacobian of f wrt x
Fv Jacobian of f wrt odometry noise
gstep like step() but displays vehicle
plot plot/animate vehicle on current figure
plot_xy plot the true path of the vehicle
add_driver attach a driver object to this vehicle
display display state/parameters in human readable form
char convert state/parameters to human readable string

Properties (read/write)

x true vehicle state 3x1
V odometry covariance
odometry distance moved in the last interval
dim dimension of the robot's world
robotdim 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, init() sets x := x0

Examples

Create a vehicle with odometry covariance
v = Vehicle( 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.update([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 will show an animation of the vehicle moving between randomly selected wayoints.

Reference

Robotics, Vision & Control, Peter Corke, Springer 2011

See also

RandomPath, EKF


Vehicle.Fv

Jacobian df/dv

J = V.Vehicle.F, Vehicle.Fx


Vehicle.Fx

Jacobian df/dx

J = V.Vehicle.F, Vehicle.Fv


Vehicle.Vehicle

Vehicle object constructor

v = Vehicle object with actual odometry covariance vact, where vact is a 2x2 matrix corresponding to the odometry vector [dx dtheta]. Default parameters are:
alphalim 0.5
maxspeed 5
L 1
robotdim 0.2
x0 (0,0,0)
and can be overridden by assigning properties after the object has been created.

Vehicle.add_driver

Add a driver for the vehicle

V.demand(); that returns a speed and steer angle.

See also

RandomPath


Vehicle.char

Convert vehicle parameters and state to a string

s = V.

Vehicle.control

Compute the control input to vehicle

u = V.control input (speed,steer) based on provided controls speed,steer to which speed and steering angle limits have been applied. u = V.control input (speed,steer) from a "driver" if one is attached, the driver's DEMAND() method is invoked. If no driver is attached then speed and steer angle are assumed to be zero.

See also

RandomPath


Vehicle.display

Display vehicle parameters and state

V.display vehicle parameters and state in compact human readable form.

See also

Vehicle.char


Vehicle.f

Predict next state based on odometry

xn = V.f(x, odo, w) predict next state xn based on current state x, odometry odo, and odometry noise w.

Vehicle.init

Reset state of vehicle object

V.

Vehicle.plot

Plot vehicle

V.

Vehicle.plot_xy

Plot true path followed by vehicle

V.plot_xy(ls) as above but the line style arguments ls are passed to plot.

Vehicle.run

Run the vehicle simulation

V.run the vehicle simulation for n timesteps. p = V.run the vehicle simulation for n timesteps and return the state history as an Nx3 matrix.

See also

Vehicle.step


Vehicle.step

Move the vehicle model ahead one time step

odo = V.step() updates the vehicle state for one timestep of motion and returns noisy odometry. If a "driver" is attached then its DEMAND() method is invoked to compute speed and steer angle. If no driver is attached then speed and steer angle are assumed to be zero.

See also

Vehicle.control, Vehicle.update, Vehicle.add_driver


Vehicle.update

Update the vehicle state

odo = V.  

© 1990-2011 Peter Corke.