M-File Help: RandomPath | View code for 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.
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 |
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] |
veh = Vehicle(V); veh.add_driver( RandomPath(20, 2) );
Robotics, Vision & Control, Chap 6, Peter Corke, Springer 2011
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.
'speed', S | Speed along path (default 1m/s). |
'dthresh', D | Distance from goal at which next goal is chosen. |
Convert to string
s = R.char() is a string showing driver parameters and state in in a compact human readable format.
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.
Display driver parameters and state
R.display() displays driver parameters and state in compact human readable form.
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.
© 1990-2014 Peter Corke.