M-File Help: RandomPath

M-File Help: RandomPath | View code for RandomPath

# RandomPath

Vehicle driver class

Create a "driver" object capable of steering a Vehicle object through random waypoints within a rectangular region and at constant speed.

The driver object is connected to a Vehicle object by the latter's add_driver() method. The driver's demand() method is invoked on every call to the Vehicle's step() method.

## Methods

init | reset the random number generator
demand | return speed and steer angle to next waypoint
display | display the state and parameters in human readable form
char | convert to string

## Properties

goal | current goal/waypoint coordinate
veh | the Vehicle object being controlled
dim | dimensions of the work space (2x1) [m]
speed | speed of travel [m/s]
closeenough | proximity to waypoint at which next is chosen [m]

## Example

    veh = Vehicle(V);
    veh.add_driver( RandomPath(20, 2) );

## Notes

- It is possible in some cases for the vehicle to move outside the desired region, for instance if moving to a waypoint near the edge, the limited turning circle may cause the vehicle to temporarily move outside.
- The vehicle chooses a new waypoint when it is closer than property closeenough to the current waypoint.
- Uses its own random number stream so as to not influence the performance of other randomized algorithms such as path planning.

## Reference

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

## See also

Vehicle

# RandomPath.RandomPath

Create a driver object

d = RandomPath(dim, options) returns a "driver" object capable of driving a Vehicle object through random waypoints. The waypoints are positioned inside a rectangular region bounded by +/- dim in the x- and y-directions.

## Options

'speed', S | Speed along path (default 1m/s).
'dthresh', D | Distance from goal at which next goal is chosen.

## See also

Vehicle

# RandomPath.char

Convert to string

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

# RandomPath.demand

Compute speed and heading to waypoint

[speed,steer] = R.demand() returns the speed and steer angle to drive the vehicle toward the next waypoint. When the vehicle is within R.closeenough a new waypoint is chosen.

## See also

Vehicle

# RandomPath.display

Display driver parameters and state

R.display() displays driver parameters and state in compact human readable form.

## See also

RandomPath.char

# RandomPath.init

Reset random number generator

R.init() resets the random number generator used to create the waypoints. This enables the sequence of random waypoints to be repeated.

## See also

randstream

© 1990-2014 Peter Corke.