This tutorial shows how to plan for a rigid body in 3D. We show how to do this in two ways: with and without the ompl::geometric::SimpleSetup class. The main difference is that in the latter case ompl::base::SpaceInformation and ompl::base::ProblemDefinition need to be explicitly instantiated. Furthermore, the planner to be used must be explicitly instantiated as well. The recommended approach is using ompl::geometric::SimpleSetup as this is less bug prone and does not limit the functionality of the code in any way.

Setting up geometric planning for a rigid body in 3D requires the following steps:

- identify the space we are planning in: SE(3)
- select a corresponding state space from the available ones, or implement one. For SE(3), the ompl::base::SE3StateSpace is appropriate.
- since SE(3) contains an R
^{3}component, we need to define bounds. - define the notion of state validity.
- define start states and a goal representation.

Once these steps are complete, the specification of the problem is conceptually done. The set of classes that allow the instantiation of this specification is shown below.

# Using the ompl::geometric::SimpleSetup Class

Assuming the following namespace definitions:

And a state validity checking function defined like this:

We first create an instance of the state space we are planning in.

We then set the bounds for the R^{3} component of this state space:

Create an instance of ompl::geometric::SimpleSetup. Instances of ompl::base::SpaceInformation, and ompl::base::ProblemDefinition are created internally.

Set the state validity checker

Create a random start state:

And a random goal state:

Set these states as start and goal for SimpleSetup.

We can now try to solve the problem. This will also trigger a call to ompl::geometric::SimpleSetup::setup() and create a default instance of a planner, since we have not specified one. Furthermore, ompl::base::Planner::setup() is called, which in turn calls ompl::base::SpaceInformation::setup(). This chain of calls will lead to computation of runtime parameters such as the state validity checking resolution. This call returns a value from ompl::base::PlannerStatus which describes whether a solution has been found within the specified amount of time (in seconds). If this value can be cast to true, a solution was found.

If a solution has been found, we can optionally simplify it and the display it

# Without ompl::geometric::SimpleSetup

Assuming the following namespace definitions:

And a state validity checking function defined like this:

We first create an instance of the state space we are planning in.

We then set the bounds for the R^{3} component of this state space:

Create an instance of ompl::base::SpaceInformation for the state space

Set the state validity checker

Create a random start state:

And a random goal state:

Create an instance of ompl::base::ProblemDefinition

Set the start and goal states for the problem definition.

Create an instance of a planner

Tell the planner which problem we are interested in solving

Make sure all the settings for the space and planner are in order. This will also lead to the runtime computation of the state validity checking resolution.

We can now try to solve the problem. This call returns a value from ompl::base::PlannerStatus which describes whether a solution has been found within the specified amount of time (in seconds). If this value can be cast to true, a solution was found.

If a solution has been found, we display it. Simplification could be done, but we would need to create an instance of ompl::geometric::PathSimplifier.

**Definition:**GeneticSearch.h:77

**Definition:**ConstrainedSpaceInformation.h:84

**Definition:**SimpleSetup.h:124

**Definition:**PlannerStatus.h:109

**Definition:**RealVectorBounds.h:108