OpenDESimpleSetup.h
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2010, Rice University
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of the Rice University nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34 
35 /* Author: Ioan Sucan */
36 
37 #ifndef OMPL_EXTENSION_OPENDE_SIMPLE_SETUP_
38 #define OMPL_EXTENSION_OPENDE_SIMPLE_SETUP_
39 
40 #include "ompl/control/SimpleSetup.h"
41 #include "ompl/extensions/opende/OpenDEStateValidityChecker.h"
42 #include "ompl/extensions/opende/OpenDEStatePropagator.h"
43 #include "ompl/extensions/opende/OpenDEControlSpace.h"
44 
45 namespace ompl
46 {
47  namespace control
48  {
52  {
53  public:
55  explicit OpenDESimpleSetup(const ControlSpacePtr &space);
56 
58  explicit OpenDESimpleSetup(const base::StateSpacePtr &space);
59 
64  explicit OpenDESimpleSetup(const OpenDEEnvironmentPtr &env);
65 
66  ~OpenDESimpleSetup() override = default;
67 
70  {
72  }
73 
76 
78  void setCurrentState(const base::ScopedState<> &state);
79 
81  void setCurrentState(const base::State *state);
82 
85  {
87  }
88 
91  {
93  }
94 
97  {
99  }
100 
105  void playPath(const base::PathPtr &path, double timeFactor = 1.0) const;
106 
108  void playSolutionPath(double timeFactor = 1.0) const;
109 
113  base::PathPtr simulateControl(const double *control, unsigned int steps) const;
114 
118  base::PathPtr simulateControl(const Control *control, unsigned int steps) const;
119 
124  base::PathPtr simulate(unsigned int steps) const;
125 
126  void setup() override;
127 
128  private:
129  void useEnvParams();
130  };
131  }
132 }
133 #endif
const OpenDEEnvironmentPtr & getEnvironment() const
Get the OpenDE environment associated to the state and control spaces.
base::ScopedState< OpenDEStateSpace > getCurrentState() const
Get the current OpenDE state (read parameters from OpenDE bodies)
base::PathPtr simulate(unsigned int steps) const
Simulate the OpenDE environment forward for steps simulation steps, using the null control (ompl::con...
Create the set of classes typically needed to solve a control problem when forward propagation is com...
void setup() override
This method will create the necessary classes for planning. The solve() method will call this functio...
Definition of a scoped state.
Definition: ScopedState.h:56
Definition of an abstract control.
Definition: Control.h:47
A shared pointer wrapper for ompl::base::StateSpace.
void setAngularVelocityBounds(const base::RealVectorBounds &bounds)
Set the bounds for the angular velocity.
base::PathPtr simulateControl(const double *control, unsigned int steps) const
Simulate the OpenDE environment forward for steps simulation steps, using the control control...
Create the set of classes typically needed to solve a control problem.
Definition: SimpleSetup.h:63
const base::StateSpacePtr & getStateSpace() const
Get the current instance of the state space.
Definition: SimpleSetup.h:87
A shared pointer wrapper for ompl::control::ControlSpace.
Main namespace. Contains everything in this library.
Definition: AppBase.h:21
State space representing OpenDE states.
void playPath(const base::PathPtr &path, double timeFactor=1.0) const
Set the OpenDE world to the states that are contained in a given path, sequentially. Using timeFactor, the speed at which this sequence is iterated through is altered.
OpenDESimpleSetup(const ControlSpacePtr &space)
Constructor needs the control space needed for planning.
Definition of an abstract state.
Definition: State.h:49
void setVolumeBounds(const base::RealVectorBounds &bounds)
Set the bounds for the planning volume.
void setCurrentState(const base::ScopedState<> &state)
Set the current OpenDE state (set parameters for OpenDE bodies)
The lower and upper bounds for an Rn space.
void playSolutionPath(double timeFactor=1.0) const
Call playPath() on the solution path, if one is available.
A shared pointer wrapper for ompl::base::Path.
A shared pointer wrapper for ompl::control::OpenDEEnvironment.
void setLinearVelocityBounds(const base::RealVectorBounds &bounds)
Set the bounds for the linear velocity.