Loading...
Searching...
No Matches
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
43namespace ompl
44{
45 namespace base
46 {
49 {
50 public:
53 class StateType : public CompoundStateSpace::StateType
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
127 StateSamplerPtr allocStateSampler() const override;
128
129 protected:
132 };
133 }
134}
135
136#endif
ompl::base::CompoundState StateType
Define the type of state allocated by this state space.
Definition StateSpace.h:577
CompoundStateSpace()
Construct an empty compound state space.
A shared pointer wrapper for ompl::base::MorseEnvironment.
StateSamplerPtr allocDefaultStateSampler() const override
Allocate an instance of the default uniform state sampler for this space.
bool satisfiesBounds(const State *state) const override
This function checks whether a state satisfies its bounds.
StateSamplerPtr allocStateSampler() const override
Allocate an instance of the state sampler for this space. This sampler will be allocated with the sam...
unsigned int getNrBodies() const
Get the number of bodies this state space represents.
void readState(State *state) const
Read the parameters of the MORSE bodies and store them in state.
void setLinearVelocityBounds(const RealVectorBounds &bounds)
Set the bounds for each of the linear velocity subspaces.
void writeState(const State *state) const
Set the parameters of the MORSE bodies to be the ones read from state.
void setBounds()
Set the bounds given by the MorseEnvironment.
const MorseEnvironmentPtr & getEnvironment() const
Get the MORSE environment this state space corresponds to.
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.
void copyState(State *destination, const State *source) const override
Copy a state to another. The memory of source and destination should NOT overlap.
MorseEnvironmentPtr env_
Representation of the MORSE parameters OMPL needs to plan.
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....
void freeState(State *state) const override
Free the memory of the allocated state.
void setPositionBounds(const RealVectorBounds &bounds)
Set the bounds for each of the position subspaces.
void setAngularVelocityBounds(const RealVectorBounds &bounds)
Set the bounds for each of the angular velocity subspaces.
State * allocState() const override
Allocate a state that can store a point in the described space.
The lower and upper bounds for an Rn space.
A shared pointer wrapper for ompl::base::StateSampler.
Definition of an abstract state.
Definition State.h:50
This namespace contains sampling based planning routines shared by both planning under geometric cons...
Main namespace. Contains everything in this library.