MorseStateSpace.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 /* Authors: Caleb Voss */
36 
37 #ifndef OMPL_EXTENSION_MORSE_STATE_SPACE_
38 #define OMPL_EXTENSION_MORSE_STATE_SPACE_
39 
40 #include "ompl/base/StateSpace.h"
41 #include "ompl/extensions/morse/MorseEnvironment.h"
42 
43 namespace ompl
44 {
45  namespace base
46  {
49  {
50  public:
54  {
55  public:
57  {
58  }
59  };
60 
79  MorseStateSpace(const MorseEnvironmentPtr &env, double positionWeight = 1.0, double linVelWeight = 0.5,
80  double angVelWeight = 0.5, double orientationWeight = 1.0);
81 
82  virtual ~MorseStateSpace()
83  {
84  }
85 
88  {
89  return env_;
90  }
91 
93  unsigned int getNrBodies() const
94  {
95  return env_->rigidBodies_;
96  }
97 
99  void setBounds();
100 
102  void setPositionBounds(const RealVectorBounds &bounds);
103 
105  void setLinearVelocityBounds(const RealVectorBounds &bounds);
106 
108  void setAngularVelocityBounds(const RealVectorBounds &bounds);
109 
112  void readState(State *state) const;
113 
116  void writeState(const State *state) const;
117 
119  bool satisfiesBounds(const State *state) const override;
120 
121  State *allocState() const override;
122  void freeState(State *state) const override;
123  void copyState(State *destination, const State *source) const override;
124  void interpolate(const State *from, const State *to, double t, State *state) const override;
125 
126  StateSamplerPtr allocDefaultStateSampler() const override;
127  StateSamplerPtr allocStateSampler() const override;
128 
129  protected:
132  };
133  }
134 }
135 
136 #endif
MORSE State. This is a compound state that allows accessing the properties of the bodies the state sp...
Definition of a compound state.
Definition: State.h:86
State space representing MORSE states.
A shared pointer wrapper for ompl::base::StateSampler.
void freeState(State *state) const override
Free the memory of the allocated state.
Main namespace. Contains everything in this library.
Definition: AppBase.h:21
StateSamplerPtr allocStateSampler() const override
Allocate an instance of the state sampler for this space. This sampler will be allocated with the sam...
void readState(State *state) const
Read the parameters of the MORSE bodies and store them in state.
ompl::base::CompoundState StateType
Define the type of state allocated by this state space.
Definition: StateSpace.h:577
A space to allow the composition of state spaces.
Definition: StateSpace.h:573
void writeState(const State *state) const
Set the parameters of the MORSE bodies to be the ones read from state.
const MorseEnvironmentPtr & getEnvironment() const
Get the MORSE environment this state space corresponds to.
unsigned int getNrBodies() const
Get the number of bodies this state space represents.
bool satisfiesBounds(const State *state) const override
This function checks whether a state satisfies its bounds.
StateSamplerPtr allocDefaultStateSampler() const override
Allocate an instance of the default uniform state sampler for this space.
void copyState(State *destination, const State *source) const override
Copy a state to another. The memory of source and destination should NOT overlap. ...
void setBounds()
Set the bounds given by the MorseEnvironment.
Definition of an abstract state.
Definition: State.h:49
void interpolate(const State *from, const State *to, double t, State *state) const override
Computes the state that lies at time t in [0, 1] on the segment that connects from state to to state...
MorseEnvironmentPtr env_
Representation of the MORSE parameters OMPL needs to plan.
The lower and upper bounds for an Rn space.
State * allocState() const override
Allocate a state that can store a point in the described space.
void setLinearVelocityBounds(const RealVectorBounds &bounds)
Set the bounds for each of the linear velocity subspaces.
void setPositionBounds(const RealVectorBounds &bounds)
Set the bounds for each of the position subspaces.
A shared pointer wrapper for ompl::base::MorseEnvironment.
void setAngularVelocityBounds(const RealVectorBounds &bounds)
Set the bounds for each of the angular velocity subspaces.
MorseStateSpace(const MorseEnvironmentPtr &env, double positionWeight=1.0, double linVelWeight=0.5, double angVelWeight=0.5, double orientationWeight=1.0)
Construct a state space representing MORSE states.