VanaOwenStateSpace.cpp
73 VanaOwenStateSpace::VanaOwenStateSpace(double turningRadius, std::pair<double, double> pitchRange)
74 : rho_(turningRadius), minPitch_(pitchRange.first), maxPitch_(pitchRange.second), dubinsSpace_(turningRadius)
129 DubinsStateSpace::StateType *VanaOwenStateSpace::get2DPose(double x, double y, double yaw) const
137 bool VanaOwenStateSpace::isValid(DubinsStateSpace::DubinsPath const &path, StateType const *state) const
144 (path.type_->at(0) == DubinsStateSpace::DUBINS_RIGHT && state->pitch() - path.length_[0] < minPitch_) ||
145 (path.type_->at(0) == DubinsStateSpace::DUBINS_LEFT && state->pitch() + path.length_[0] > maxPitch_))
153 bool VanaOwenStateSpace::decoupled(const StateType *from, const StateType *to, double radius, PathType &result,
164 // can't change altitude if vertical turning radius is infinite, but that's ok if we don't need a vertical turn
220 result.numTurns_ = std::floor((std::abs((result.deltaZ_ - turnZ) / tanPitch) - len + turnS) / (twopi * radius));
251 return (std::abs(phi) + dubinsSpace_.dubins(zi, to).length()) * radius * std::abs(tanPitch) - std::abs(result.deltaZ_);
258 auto root = boost::math::tools::bracket_and_solve_root(phiFun, result.phi_, 2., true, TOLERANCE, iter);
268 auto root = boost::math::tools::bracket_and_solve_root(phiFun, result.phi_, 2., true, TOLERANCE, iter);
285 std::optional<VanaOwenStateSpace::PathType> VanaOwenStateSpace::getPath(const State *state1, const State *state2) const
314 if (decoupled(from, to, rho_ * radiusMultiplier2, path2, scratch) && (length = path2.length()) < minLength)
337 unsigned int VanaOwenStateSpace::validSegmentCount(const State *state1, const State *state2) const
342 void VanaOwenStateSpace::interpolate(const State *from, const State *to, const double t, State *state) const
351 void VanaOwenStateSpace::interpolate(const State *from, const State *to, const double t, PathType &path,
407 dubinsSpace_.interpolate(s, path.pathXY_, (dist - lengthTurn) / lengthPath, state, path.horizontalRadius_);
422 getSubspace(1)->enforceBounds(state->as<CompoundStateSpace::StateType>()->as<SO2StateSpace::StateType>(1));
451 VanaOwenStateSpace::PathType &VanaOwenStateSpace::PathType::operator=(const VanaOwenStateSpace::PathType &path)
495 << "\n\tXY = " << path.pathXY_ << "\n\tSZ = " << path.pathSZ_ << "\n\trh = " << path.horizontalRadius_
std::optional< PathType > getPath(const State *state1, const State *state2) const
Compute a 3D Dubins path using the model and algorithm proposed by VanaOwen et al.
Definition: VanaOwenStateSpace.cpp:285
std::ostream & operator<<(std::ostream &stream, Cost c)
Output operator for Cost.
Definition: Cost.cpp:39
State * allocState() const override
Allocate a state that can store a point in the described space.
Definition: SE2StateSpace.cpp:41
static const std::vector< std::vector< DubinsPathSegmentType > > dubinsPathType
Dubins path types.
Definition: DubinsStateSpace.h:170
Representation of a space in which planning can be performed. Topology specific sampling,...
Definition: StateSpace.h:134
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....
Definition: DubinsStateSpace.cpp:744
const T * as(unsigned int index) const
Cast a component of this instance to a desired type.
Definition: State.h:159
An R^4 x SO(2) state space where distance is measured by the length of a type of Dubins airplane curv...
Definition: VanaOwenStateSpace.h:90
const StateSpacePtr & getSubspace(unsigned int index) const
Get a specific subspace from the compound state space.
Definition: StateSpace.cpp:915
This namespace contains sampling based planning routines shared by both planning under geometric cons...
Definition: ConstrainedSpaceInformation.h:86
bool isValid(DubinsStateSpace::DubinsPath const &path, StateType const *state) const
Whether a path in SZ space satisfies Dubins path type and pitch constraints.
Definition: VanaOwenStateSpace.cpp:137
unsigned int validSegmentCount(const State *state1, const State *state2) const override
Count how many segments of the "longest valid length" fit on the motion from state1 to state2.
Definition: VanaOwenStateSpace.cpp:337
unsigned int getDimension() const override
Get the dimension of the space (not the dimension of the surrounding ambient space)
Definition: StateSpace.cpp:994
bool decoupled(const StateType *state1, const StateType *state2, double radius, PathType &path, std::array< DubinsStateSpace::StateType *, 3 > &scratch) const
Helper function used by getPath.
Definition: VanaOwenStateSpace.cpp:153
void printState(const State *state, std::ostream &out) const override
Print a state to a stream.
Definition: StateSpace.cpp:1201
const RealVectorBounds & getBounds() const
Get the bounds for this state space.
Definition: VanaOwenStateSpace.h:228
void registerDefaultProjection(const ProjectionEvaluatorPtr &projection)
Register the default projection for this state space.
Definition: StateSpace.cpp:752
DubinsStateSpace dubinsSpace_
Definition: VanaOwenStateSpace.h:314
The definition of a state in Rn
Definition: RealVectorStateSpace.h:141
double getMaximumExtent() const override
Get the maximum value a call to distance() can return (or an upper bound). For unbounded state spaces...
Definition: StateSpace.cpp:1002
void copyState(State *destination, const State *source) const override
Copy a state to another. The memory of source and destination should NOT overlap.
Definition: StateSpace.cpp:1036
Abstract definition for a class computing projections to Rn. Implicit integer grids are imposed on th...
Definition: ProjectionEvaluator.h:194
An SE(2) state space where distance is measured by the length of Dubins curves.
Definition: DubinsStateSpace.h:126
double distance(const State *state1, const State *state2) const override
Computes distance between two states. This function satisfies the properties of a metric if isMetricS...
Definition: VanaOwenStateSpace.cpp:330
void registerProjections() override
Register the projections for this state space. Usually, this is at least the default projection....
Definition: VanaOwenStateSpace.cpp:95
The definition of a state in SO(2)
Definition: SO2StateSpace.h:131
static const double PROJECTION_DIMENSION_SPLITS
When the cell sizes for a projection are automatically computed, this value defines the number of par...
Definition: MagicConstants.h:119
void allocStateComponents(CompoundState *state) const
Allocate the state components. Called by allocState(). Usually called by derived state spaces.
Definition: StateSpace.cpp:1153
ompl::base::CompoundState StateType
Define the type of state allocated by this state space.
Definition: StateSpace.h:641
Complete description of a Dubins path.
Definition: DubinsStateSpace.h:172
DubinsStateSpace::StateType * get2DPose(double x, double y, double yaw) const
Allocate a DubinsSpace state and initialize it.
Definition: VanaOwenStateSpace.cpp:129
DubinsPath dubins(const State *state1, const State *state2) const
Return a shortest Dubins path from SE(2) state state1 to SE(2) state state2.
Definition: DubinsStateSpace.cpp:850
void freeState(State *state) const override
Free the memory of the allocated state.
Definition: SE2StateSpace.cpp:48
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....
Definition: VanaOwenStateSpace.cpp:342
State * allocState() const override
Allocate a state that can store a point in the described space.
Definition: VanaOwenStateSpace.cpp:88
virtual unsigned int validSegmentCount(const State *state1, const State *state2) const
Count how many segments of the "longest valid length" fit on the motion from state1 to state2.
Definition: StateSpace.cpp:851
The lower and upper bounds for an Rn space.
Definition: RealVectorBounds.h:111