OMPL
Download
Documentation
Primer
Installation
Tutorials
Demos
OMPL.app GUI
OMPL web app
Python Bindings
Available Planners
Planner Termination Conditions
Benchmarking Planners
Available State Spaces
Optimal Planning
Constrained Planning
Multilevel Planning
FAQ
External links
MoveIt
Planner Arena
ICRA 2013 Tutorial
IROS 2011 Tutorial
Gallery
OMPL Integrations
Code
API Overview
Classes
Files
Style Guide
Repositories
ompl on GitHub
omplapp on GitHub
Continuous Integration
ompl on Travis CI (Linux/macOS)
omplapp on Travis CI (Linux/macOS)
ompl on AppVeyor CI (Windows)
omplapp on AppVeyor CI (Windows)
Issues
Community
Get Support
Developers/Contributors
Submit a Contribution
Education
About
License
Citations
Acknowledgments
Blog
demos
SE2RigidBodyPlanning
SE2MultiRigidBodyPlanning.cpp
1
/*********************************************************************
2
* Rice University Software Distribution License
3
*
4
* Copyright (c) 2012, Rice University
5
* All Rights Reserved.
6
*
7
* For a full description see the file named LICENSE.
8
*
9
*********************************************************************/
10
11
/* Author: Ryan Luna */
12
13
#include <ompl/geometric/planners/rrt/RRTConnect.h>
14
#include <omplapp/apps/SE2MultiRigidBodyPlanning.h>
15
#include <omplapp/config.h>
16
17
using namespace
ompl
;
18
19
int
main()
20
{
21
// plan for two bodies in SE2
22
app::SE2MultiRigidBodyPlanning
setup(2);
23
24
// load the robot and the environment
25
std::string robot_fname = std::string(OMPLAPP_RESOURCE_DIR) +
"/2D/car1_planar_robot.dae"
;
26
std::string env_fname = std::string(OMPLAPP_RESOURCE_DIR) +
"/2D/Maze_planar_env.dae"
;
27
setup.setRobotMesh(robot_fname);
// The first mesh should use setRobotMesh.
28
setup.addRobotMesh(robot_fname);
// Subsequent robot meshes MUST use addRobotMesh!
29
setup.setEnvironmentMesh(env_fname);
30
31
// constructing start and goal states
32
base::ScopedState<base::CompoundStateSpace>
start(setup.getSpaceInformation());
33
base::ScopedState<base::CompoundStateSpace>
goal(setup.getSpaceInformation());
34
35
// define starting state for robot 1
36
auto
*start1 = start->as<
base::SE2StateSpace::StateType
>(0);
37
start1->setXY(0., 0.);
38
start1->setYaw(0.);
39
// define goal state for robot 1
40
auto
*goal1 = goal->as<
base::SE2StateSpace::StateType
>(0);
41
goal1->setXY(26., 0.);
42
goal1->setYaw(0.);
43
44
// define starting state for robot 2
45
auto
*start2 = start->as<
base::SE2StateSpace::StateType
>(1);
46
start2->setXY(26., 0.);
47
start2->setYaw(0.);
48
// define goal state for robot 2
49
auto
*goal2 = goal->as<
base::SE2StateSpace::StateType
>(1);
50
goal2->setXY(-30., 0.);
51
goal2->setYaw(0.);
52
53
// set the start & goal states
54
setup.setStartAndGoalStates(start, goal);
55
56
// use RRTConnect for planning
57
setup.setPlanner(std::make_shared<geometric::RRTConnect>(setup.getSpaceInformation()));
58
59
setup.setup();
60
setup.print(std::cout);
61
// attempt to solve the problem, and print it to screen if a solution is found
62
if
(setup.solve(60))
63
{
64
setup.simplifySolution();
65
setup.getSolutionPath().printAsMatrix(std::cout);
66
}
67
68
return
0;
69
}
ompl::base::SE2StateSpace::StateType
A state in SE(2): (x, y, yaw)
Definition:
SE2StateSpace.h:149
ompl::base::ScopedState
Definition of a scoped state.
Definition:
ScopedState.h:120
ompl::app::SE2MultiRigidBodyPlanning
Wrapper for ompl::app::RigidBodyPlanning that plans for multiple rigid bodies in SE2.
Definition:
SE2MultiRigidBodyPlanning.h:39
ompl
Main namespace. Contains everything in this library.
Definition:
AppBase.h:21