Beruflich Dokumente
Kultur Dokumente
1. Modify the main.m file provided and implement a 2D probablistic roadmap for a point robot
based on the pseudocode discussed in class. Generate the roadmap with a fixed number of
numRoadmapPts=100 vertices and only connect vertices that satisfy the ArePointsNear condition
(as opposed to connecting all vertices). The graph data structure G used by the code has only two
fields: vertices G.V and edges G.E that are accessed for the i-th vertex using the curly brackets
(i.e., G.V{i} gives the configuration (i.e., 2D position) of vertex i and G.E{i} gives the indices of
the vertices to which vertex i is connected to (i.e., the edges). The graph is initialized with the
robot start position as the first vertex and the goal as the second vertex and no edges.
% start
G.V{1} = params.robotCenter;
G.E{1} = [];
% goal
G.V{2} = params.goalCenter;
G.E{2} = [];
The i-th vertex configuration qSample can be added by defining G.V{i}=qSample and the edges
that are connect to that vertex are identified by index number in G.E{i}. For example, if the i-th
vertex is connected to both the start and the goal then we would define
2. Run your code three times each for three different numRoadmapPts settings. Make sure to turn
off plotting during the execution of your code. Complete the following table based on the output
(printed to the MATLAB command window). In a short paragraph, describe and explain the trend
you observed. What would happen if more trials were used?
1
CSC 576 Introduction To Robotics, Fall 2017 2
• status = IsCollisionFree(params, q)
• status = IsSegmentCollisionFree(params,q1,q2)
% Checks if the straight line segment between q1 and q2 is in collision with the
% obstacles defined in params.
%
% Input q1 : a 2D column vector q1 = [x y]’ specifying the robot’s configuration
% at one endpoint of the line segment
% q2 : a 2D column vector q2 = [x y]’ specifying the robot’s configuration
% at the other endpoint of the line segment
% params : a structure containing the x,y coordinates of the obstacles
%
% Output status : boolian flag equal to 1 if configuration the segment is collision free
% equal to 0 otherwise (if there is a collision)
• PlotEdges( G, vid );
% Plots in the current figure window the location of the vertex/node specified by G.V{vid}
% Also plots straight line segments indicated all edges of vid given by G.E{vid}. This function
% be called everytime a new vertex and set of edges is added to the graph to show how
% the graph is growing with time.
%
% Input G : the graph data structured with vertices G.V and edges G.E
% vid : the index (vertex ID) indicating the vertex whose edges are to be plotted
%
% Output (none) the current figure window is updated with the desired plot