M-File Help: RRT | View code for RRT

# RRT

Class for rapidly-exploring random tree navigation

A concrete subclass of the abstract Navigation class that implements the rapidly exploring random tree (RRT) algorithm. This is a kinodynamic planner that takes into account the motion constraints of the vehicle.

## Methods

plan | Compute the tree
path | Compute a path
plot | Display the tree
display | Display the parameters in human readable form
char | Convert to string

## Example

    goal = [0,0,0];
    start = [0,2,0];
    veh = Vehicle([], 'stlim', 1.2);
    rrt = RRT([], veh, 'goal', goal, 'range', 5);
    rrt.plan()             % create navigation tree
    rrt.path(start, goal)  % animate path from this start location

Robotics, Vision & Control compatability mode:

    goal = [0,0,0];
    start = [0,2,0];
    rrt = RRT();           % create navigation object
    rrt.plan()             % create navigation tree
    rrt.path(start, goal)  % animate path from this start location

## References

- Randomized kinodynamic planning, S. LaValle and J. Kuffner, International Journal of Robotics Research vol. 20, pp. 378-400, May 2001.
- Probabilistic roadmaps for path planning in high dimensional configuration spaces, L. Kavraki, P. Svestka, J. Latombe, and M. Overmars, IEEE Transactions on Robotics and Automation, vol. 12, pp. 566-580, Aug 1996.
- Robotics, Vision & Control, Section 5.2.5, P. Corke, Springer 2011.

## See also

Navigation, PRM, DXform, Dstar, PGraph

# RRT.RRT

Create an RRT navigation object

R = RRT.RRT(map, veh, options) is a rapidly exploring tree navigation object for a region with obstacles defined by the map object map.

R = RRT.RRT() as above but internally creates a Vehicle class object and does not support any map or options. For compatibility with RVC book.

## Options

'npoints', N | Number of nodes in the tree (default 500)
'time', T | Interval over which to simulate dynamic model toward random point (default 0.5s)
'range', R | Specify rectangular bounds

- R scalar; X: -R to +R, Y: -R to +R
- R (1x2); X: -R(1) to +R(1), Y: -R(2) to +R(2)
- R (1x4); X: R(1) to R(2), Y: R(3) to R(4)

'goal', P | Goal position (1x2) or pose (1x3) in workspace
'speed', S | Speed of vehicle [m/s] (default 1)
'steermax', S | Steering angle of vehicle in the range -S to +S [rad] (default 1.2)

## Notes

- Does not (yet) support obstacles, ie. MAP is ignored but must be given.
- 'steermax' selects the range of steering angles that the vehicle will be asked to track. If not given the steering angle range of the vehicle object will be used.
- There is no check that the steering range or speed is within the limits of the vehicle object.

## Reference

- Robotics, Vision & Control Peter Corke, Springer 2011. p102.

## See also

Vehicle

# RRT.char

Convert to string

R.char() is a string representing the state of the RRT object in human-readable form.

# RRT.path

Find a path between two points

x = R.path(start, goal) finds a path (Nx3) from state start (1x3) to the goal (1x3).

R.path(start, goal) as above but plots the path in 3D. The nodes are shown as circles and the line segments are blue for forward motion and red for backward motion.

## Notes

- The path starts at the vertex closest to the START state, and ends at the vertex closest to the GOAL state. If the tree is sparse this might be a poor approximation to the desired start and end.

## See also

RRT.plot

# RRT.plan

Create a rapidly exploring tree

R.plan(options) creates the tree roadmap by driving the vehicle model toward random goal points. The resulting graph is kept within the object.

## Options

'goal', P | Goal pose (1x3)
'ntrials', N | Number of path trials (default 50)
'noprogress' | Don't show the progress bar
'samples' | Show progress in a plot of the workspace

- '.' for each random point x_rand
- 'o' for the nearest point which is added to the tree
- red line for the best path

## Notes

- At each iteration we need to find a vehicle path/control that moves it from a random point towards a point on the graph. We sample ntrials of random steer angles and velocities and choose the one that gets us closest (computationally slow, since each path has to be integrated over time).

# RRT.plot

Visualize navigation environment

R.plot() displays the navigation tree in 3D.

© 1990-2014 Peter Corke.