62 views

Uploaded by tdit84

matlab example

- Matlad Code of Nr Method
- 6.3 Transfer Func
- M S 15 Distance Between Processes
- GPS-based Navigated Autonomous Robot
- Avl Tree
- Modeling in Transportation Logistics Assignment.docx
- Let the Schools Decide
- Draft MT 461 Path Planning in Mobile Robots
- PID7745234
- Teller 10
- Bubble Sort Example
- Pose estimation, path planing and object avoidance for autonomous racing drones
- Alberto Elfes
- Topics for Presentations 2011
- Motive8rs VITUniversity Evolution''12
- Table of Contents 2 2009
- op ed
- Books Advert.pdf
- Geometry Report
- EE 333 Assignment One

You are on page 1of 14

This example demonstrates how to compute an obstacle free path

between two locations on a given map using the Probabilistic Roadmap (PRM) path planner. PRM path planner

constructs a roadmap in the free space of a given map using randomly sampled nodes in the free space and connecting

them with each other. Once the roadmap has been constructed, you can query for a path from a given start location to a

given end location on the map.

In this example, the map is represented as an occupancy grid map using imported data. When sampling nodes in the

free space of a map, PRM uses this binary occupancy grid representation to deduce free space. Furthermore, PRM

does not take into account the robot dimension while computing an obstacle free path on a map. Hence, you should

inflate the map by the dimension of the robot, in order to allow computation of an obstacle free path that accounts for

the robot's size and ensures collision avoidance for the actual robot. Define start and end locations on the map for the

PRM path planner to find an obstacle free path.

filePath = fullfile(fileparts(which('PathPlanningExample')),'data','exampleMaps.mat');

load(filePath)

The imported maps are : simpleMap, complexMap and ternaryMap. This searches for variables containing the

string 'Map' in the variable name.

whos *Map*

simpleMap 26x27 702 logical

ternaryMap 501x501 2008008 double

Use the imported simpleMap data and construct an occupancy grid representation using the

robotics.BinaryOccupancyGrid class. Set the resolution to 2 cells per meter for this map.

map = robotics.BinaryOccupancyGrid(simpleMap, 2)

map =

Resolution: 2

XWorldLimits: [0 13.5000]

YWorldLimits: [0 13]

GridLocationInWorld: [0 0]

Display the map using the show function on the robotics.BinaryOccupancyGrid object

show(map)

To ensure that the robot does not collide with any obstacles, you should inflate the map by the dimension of the robot

before supplying it to the PRM path planner.

Here the dimension of the robot can be assumed to be a circle with radius of 0.2 meters. You can then inflate the map

by this dimension using the robotics.BinaryOccupancyGrid.inflate function.

robotRadius = 0.2;

As mentioned before, PRM does not account for the dimension of the robot, and hence providing an inflated map to the

PRM takes into account the robot dimension. Create a copy of the map before using the inflate function to preserve

the original map.

mapInflated = copy(map);

inflate(mapInflated,robotRadius);

show(mapInflated)

Now you need to define a path planner. Create a robotics.PRM object and define the associated attributes.

prm = robotics.PRM

prm =

NumNodes: 50

ConnectionDistance: Inf

prm.Map = mapInflated;

Define the number of PRM nodes to be used during PRM construction. PRM constructs a roadmap using a given

number of nodes on the given map. Based on the dimension and the complexity of the input map, this is one of the

primary attributes to tune in order to get a solution between two points on the map. A large number of nodes create a

dense roadmap and increases the probability of finding a path. However, having more nodes increases the computation

time for both creating the roadmap and finding a solution.

prm.NumNodes = 50;

Define the maximum allowed distance between two connected nodes on the map. PRM connects all nodes separated

by this distance (or less) on the map. This is another attribute to tune in the case of larger and/or complicated input

maps. A large connection distance increases the connectivity between nodes to find a path easier, but can increase the

computation time of roadmap creation.

prm.ConnectionDistance = 5;

Define start and end locations on the map for the path planner to use.

startLocation = [2 1];

endLocation = [12 10];

Search for a path between start and end locations using the robotics.PRM.findpath function. The solution is a set

of waypoints from start location to the end location. Note that the path will be different due to probabilistic nature of the

PRM algorithm.

path =

2.0000 1.0000

1.9569 1.0546

1.8369 2.3856

3.2389 6.6106

7.8260 8.1330

11.4632 10.5857

12.0000 10.0000

show(prm)

Use PRM for a large and complicated map

Use the imported complexMap data, which represents a large and complicated floor plan, and construct a binary

occupancy grid representation with a given resolution (1 cell per meter)

map = robotics.BinaryOccupancyGrid(complexMap, 1)

map =

Resolution: 1

XWorldLimits: [0 52]

YWorldLimits: [0 41]

GridLocationInWorld: [0 0]

show(map)

Inflate the map based on robot dimension

Copy and inflate the map to factor in the robot's size for obstacle avoidance

mapInflated = copy(map);

inflate(mapInflated, robotRadius);

show(mapInflated)

Associate the existing PRM object with the new map and set parameters

Update PRM object with the newly inflated map and define other attributes.

prm.Map = mapInflated;

prm.NumNodes = 20;

prm.ConnectionDistance = 15;

show(prm)

Find a feasible path on the constructed PRM

Define start and end location on the map to find an obstacle free path.

startLocation = [3 3];

endLocation = [45 35];

Search for a solution between start and end location. For complex maps, there may not be a feasible path for a given

number of nodes (returns an empty path).

path =

[]

Since you are planning a path on a large and complicated map, larger number of nodes may be required. However,

often it is not clear how many nodes will be sufficient. Tune the number of nodes to make sure there is a feasible path

between the start and end location.

while isempty(path)

% No feasible path found yet, increase the number of nodes

prm.NumNodes = prm.NumNodes + 10;

% Use the |update| function to re-create the PRM roadmap with the changed

% attribute

update(prm);

path = findpath(prm, startLocation, endLocation);

end

% Display path

path

path =

3.0000 3.0000

4.2287 4.2628

7.7686 5.6520

6.8570 8.2389

19.5613 8.4030

33.1838 8.7614

31.3248 16.3874

41.3317 17.5090

48.3017 25.8527

49.4926 36.8804

44.3936 34.8592

45.0000 35.0000

show(prm)

Use PRM with probabilistic occupancy grid

Construct a robotics.OccupancyGrid object using the imported ternaryMap data. The ternaryMap represents

an environment using probabilities, where the probability of occupancy for free space is 0, for occupied space is 1 and

for unknown space is 0.5. Here, the resolution of 20 cells per meter is used.

map =

OccupiedThreshold: 0.6500

FreeThreshold: 0.2000

ProbabilitySaturation: [0.0010 0.9990]

GridSize: [501 501]

Resolution: 20

XWorldLimits: [0 25.0500]

YWorldLimits: [0 25.0500]

GridLocationInWorld: [0 0]

show(map)

Inflate the map based on robot dimension

Copy and inflate the map to factor in the robot's size for obstacle avoidance

mapInflated = copy(map);

inflate(mapInflated, robotRadius);

show(mapInflated)

Associate the existing PRM object with the new map and set parameters

Update PRM object with the newly inflated map and define other attributes. PRM uses FreeThreshold on the

OccupancyGrid object to determine the obstacle free space and computes a path within this obstacle free space. The

value of unknown cells in the ternaryMap is 0.5, while the default FreeThreshold on OccupancyGrid object

mapInflated is 0.2. As a result the PRM will not plan a path in the unknown region.

prm.Map = mapInflated;

prm.NumNodes = 60;

prm.ConnectionDistance = 5;

show(prm)

Find a feasible path on the constructed PRM

Define start and end location on the map to find an obstacle free path.

startLocation = [7 22];

endLocation = [15 5];

path = findpath(prm, startLocation, endLocation);

while isempty(path)

prm.NumNodes = prm.NumNodes + 10;

update(prm);

path = findpath(prm, startLocation, endLocation);

end

% Display path

path

path =

7.0000 22.0000

7.9059 22.1722

10.6881 22.3734

11.7508 19.3716

13.7982 17.1659

17.5826 14.6769

16.8227 9.9964

15.1329 8.3100

14.9489 5.7648

15.0000 5.0000

show(prm)

See Also

Path Following for a Differential Drive Robot

Mapping With Known Poses

- Matlad Code of Nr MethodUploaded bySwagat Pradhan
- 6.3 Transfer FuncUploaded bydev1712
- M S 15 Distance Between ProcessesUploaded byBomezzZ Enterprises
- GPS-based Navigated Autonomous RobotUploaded byeditor3854
- Avl TreeUploaded byGustama Cahya N
- Modeling in Transportation Logistics Assignment.docxUploaded byYasith Weerasinghe
- Let the Schools DecideUploaded byHafiy Iman
- Draft MT 461 Path Planning in Mobile RobotsUploaded byUmair Aziz
- PID7745234Uploaded bymihaipaulescu
- Teller 10Uploaded byAbhishek141986
- Bubble Sort ExampleUploaded bynur_anis_8
- Pose estimation, path planing and object avoidance for autonomous racing dronesUploaded byNazarRozkvas
- Alberto ElfesUploaded byMurillo Germano
- Topics for Presentations 2011Uploaded byCiubotariu Alexandru
- Motive8rs VITUniversity Evolution''12Uploaded byDevansh Gupta
- Table of Contents 2 2009Uploaded byReidar Mosvold
- op edUploaded byAndrew Martini
- Books Advert.pdfUploaded byGeoff
- Geometry ReportUploaded byUsama Mehmood
- EE 333 Assignment OneUploaded bycdavila2
- Algebra for Grade IIUploaded byAnonymous y8Kj75tq
- Data Structure ProgramsUploaded byPrayushGupta
- Maths Mock Exam Correction_2017Uploaded byThe Student
- unit planner spedUploaded byapi-243710906
- beginning of undergraduate recordUploaded byapi-301236399
- Copy of PsyCog Sheet 02 (Udah Dijawab)Uploaded byFarraz Akbar
- edu 431 - blog 1Uploaded byapi-307300542
- Consumer Math 11 - Lessons 1-30Uploaded byLacs
- SCRIPT Directions for Completing Grade 3 FSA Mathematics FINAL 2018Uploaded byoroman
- MathUploaded bylobesak

- Thomas Dittmann - AIAA Paper.pdfUploaded bytdit84
- Path Following for a Differential Drive Robot - MATLAB & Simulink ExampleUploaded bytdit84
- 021214_man_droneUploaded bytdit84
- Wing MomentUploaded bytdit84
- Single-Arm Robot | robdobson.comUploaded bytdit84
- Baudrate Serial ArduinoUploaded bytdit84
- Modeling Inverse Kinematics in a Robotic Arm - MATLAB & Simulink ExampleUploaded bytdit84
- Beam Design Formulas With Shear and MomentUploaded byMuhammad Saqib Abrar
- FS16 ATA GeomForMeshingBestPractisesUploaded bytdit84
- Report - Design of a Personal Aerial VehicleUploaded bytdit84
- ARkit ExamplesUploaded bytdit84
- 55Uploaded bytdit84
- Thomas Dittmann - AIAA Paper.pdfUploaded bytdit84
- Student Guide 103Uploaded bytdit84
- FlowchartUploaded bytdit84
- Challanges of Launching Multiple PayloadsUploaded bytdit84
- NumbersUploaded bytdit84
- Model Aircraft Structure ArticleUploaded bytdit84
- arjomandiUploaded bytdit84
- NX Graphics Window ImageUploaded bytdit84
- NX Graphics Window ImageUploaded bytdit84
- rapidUploaded bycadnium1

- Convolution BackgroundUploaded bysajedali
- book_exercises.pdfUploaded byFabiola Chacha
- cpmintroUploaded bykapilkumargupta
- (Lecture Notes in Mathematics 1133) Krzysztof C. Kiwiel (Auth.)-Methods of Descent for Nondifferentiable Optimization-Springer-Verlag Berlin Heidelberg (1985)Uploaded byTifroute Mohamed
- Monkey and BananaUploaded bytrupti.kodinariya9810
- dsp projectUploaded bysoumya0324416
- Controlling the Solution of Linear Systems - FenicsprojectUploaded byXu Moran
- An Analysis and Study of HAAR Wavelet Based Method for 2D Image CompressionUploaded byEditor IJTSRD
- Optimal - GA MultiobjectiveUploaded byafrimi1
- Cl ValidUploaded byAshwini Kumar Pal
- עיבוד תמונה- הרצאות | Point OperationsUploaded byRon
- Motion Control ReportUploaded byJuan Camilo Pérez Muñoz
- komp_matinf1100_h2010Uploaded byper66
- Thesis on Fir FilterUploaded bygannoju423
- Fast Fourier TransformUploaded byfm_temp
- Lab 6Uploaded bychusmanullah
- QUIZ-7-1Uploaded byBob Hwkns
- Dip Practical FileUploaded byansh_123
- Polynomials DivisionUploaded byNanay Gi
- An Overview of JPEG-2000Uploaded bytrieulh
- Digital Signal Processing by J.S. Katre (Tech Max)-wikiforu.com.pdfUploaded bykifle hailu
- Emath12 - Second Term ExaminationUploaded byJune Costales
- ps3, ENGR 62, StanfordUploaded bysuudsfiin
- A New Morphology Method for Enhancing Power Quality Monitoring SystemUploaded byBernardMight
- Evidence 2Uploaded byLorraine Lam
- Lab 6 DFTUploaded byRv Abejo Angagan
- Wiener Filter 1Uploaded byVanidevi Mani
- Stein J.Y. Digital Signal Processing - A Computer Science Perspective (Wiley, 2000)(T)(869s)Uploaded byjoseivanmu
- Performance Analysis of Different Types of Analog to Digital ConvertersUploaded byInternational Journal for Scientific Research and Development - IJSRD
- What is Simons DecisionUploaded bysp_sanasam