Lab07 - Randomized Sampling-based Motion Planning contd.

Motivations and Goals
Become familiar with advanced methods of randomized sampling-based motion planning
Be able to plan the path using the framework of the Open Motion Planning Library
Tasks (teacher)
Implement the RRT-based planning approach using the OMPL framework
Lab resources

Open Motion Planning Library

The Open Motion Planning Library contains implementations of many sampling-based algorithms such as PRM, RRT, EST, SBL, KPIECE, SyCLOP, and several variants of these. Below is a simple annotated example of motion planning in continuous space:

import matplotlib.pyplot as plt
from ompl import base as ob
from ompl import geometric as og
def plot_points(points, specs):
	x_val = [x[0] for x in points]
	y_val = [x[1] for x in points]
	plt.plot(x_val, y_val, specs)
def isStateValid(state):
	#method for collision detection checking
	return (state[0] >= state[1])
def plan(start, goal):
	#set dimensions of the problem to be solved
	stateSpace = ob.RealVectorStateSpace()  #set state space
	stateSpace.addDimension(0.0, 10.0) #set width
	stateSpace.addDimension(0.0, 10.0) #set height
	#create a simple setup object
	task = og.SimpleSetup(stateSpace)
	#set methods for collision detection and resolution of the checking 
	#setting start and goal positions
	start_pose = ob.State(task.getStateSpace())   
	goal_pose = ob.State(task.getStateSpace())
	start_pose()[0] = start[0]
	start_pose()[1] = start[1]
	goal_pose()[0] = goal[0]
	goal_pose()[1] = goal[1]
	task.setStartAndGoalStates(start_pose, goal_pose)
	#setting particular planner from the supported planners
	info = task.getSpaceInformation()
	planner = og.RRT(info)   # RRT, RRTConnect, FMT, ...
	#find the solution
	solution = task.solve()
	#simplify the solution
	if solution:
	#retrieve found path
	plan = task.getSolutionPath()
	#extract path and plot it
	path = []
	for i in range(plan.getStateCount()):
		path.append((plan.getState(i)[0], plan.getState(i)[1]))
if __name__ == "__main__":
	plan([0, 0], [10, 10])

Besides the setup of the planner, the programmer needs to deliver the validity checking function. In the problem of robotic motion planning this function usually consists of collision checking which can be based on different approaches, e.g., 1) 2).

Further information of the planner can be obtained using access through PlannerData object as demonstrated below.

	#retrieve planner data
	plannerdata = ob.PlannerData(info)
	#getting vertices
	nv = plannerdata.numVertices()
	g = []
	for i in range(0, nv):
		vert = plannerdata.getVertex(i)
		g.append((vert.getState()[0], vert.getState()[1]))
	#getting edges
	e = []
	for i in range(0, nv):
		for j in range(0, nv):
			if plannerdata.edgeExists(i, j):
				e.append((g[i], g[j]))
	#show edges

Motion planning benchmarking

A set of motion planning benchmarking examples available online.

courses/b4m36uir/labs/lab07.txt ยท Last modified: 2018/10/01 01:39 by cizekpe6