Bench-MR
A Motion Planning Benchmark for Wheeled Mobile Robots
POSQStateSpace.h
Go to the documentation of this file.
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#pragma once
36
37/* Author: Mark Moll */
38
39// Adapted by Luigi Palmieri CR/AER to combine it with POSQSteering
40
41#include <ompl/base/MotionValidator.h>
42#include <ompl/base/spaces/SE2StateSpace.h>
43#include <boost/math/constants/constants.hpp>
44
45#include "POSQ.hpp"
46
50class POSQStateSpace : public ompl::base::SE2StateSpace {
51 public:
53
54 ~POSQStateSpace() override { delete state_space_; }
55
57 void initialize();
58
60 double distance(const ompl::base::State *state1,
61 const ompl::base::State *state2) const override;
62
65 void interpolate(const ompl::base::State *from, const ompl::base::State *to,
66 double t, ompl::base::State *state) const override;
67
68 virtual void interpolate(const ompl::base::State *from,
69 const ompl::base::State *to, double t,
70 bool &firstTime, vector<UnicycleState> &states,
71 ompl::base::State *state) const;
72
73 virtual void interpolate(const ompl::base::State *from,
74 const vector<UnicycleState> &states, double t,
75 ompl::base::State *state) const;
76
78 void sanityChecks() const override {
79 std::cout << "sanity check!!!!" << std::endl;
80 double zero = std::numeric_limits<double>::epsilon();
81 double eps = .1; // rarely such a large error will occur
82 ompl::base::StateSpace::sanityChecks(zero, eps, ~STATESPACE_INTERPOLATION);
83 }
84
85 protected:
86 // virtual void interpolate(const State *from, double t, State *state) const;
87
90};
91
92class POSQMotionValidator : public ompl::base::MotionValidator {
93 public:
94 POSQMotionValidator(const ompl::base::SpaceInformationPtr &si)
95 : ompl::base::MotionValidator(si) {
96 defaultSettings();
97 }
98
99 ~POSQMotionValidator() override = default;
100 bool checkMotion(const ompl::base::State *s1,
101 const ompl::base::State *s2) const override;
102 bool checkMotion(
103 const ompl::base::State *s1, const ompl::base::State *s2,
104 std::pair<ompl::base::State *, double> &lastValid) const override;
105
106 private:
107 POSQStateSpace *stateSpace_;
108 void defaultSettings();
109};
ob::SE2StateSpace::StateType State
Definition: Primitives.h:12
Definition: POSQStateSpace.h:92
~POSQMotionValidator() override=default
bool checkMotion(const ompl::base::State *s1, const ompl::base::State *s2) const override
Definition: POSQStateSpace.cpp:116
POSQMotionValidator(const ompl::base::SpaceInformationPtr &si)
Definition: POSQStateSpace.h:94
POSQ is a class to have the POSQ function as OMPL state space.
Definition: POSQStateSpace.h:50
double distance(const ompl::base::State *state1, const ompl::base::State *state2) const override
Compute the distance between the two states.
Definition: POSQStateSpace.cpp:9
POSQ * state_space_
Object from the steering function workspace.
Definition: POSQStateSpace.h:89
POSQStateSpace()
Definition: POSQStateSpace.h:52
void interpolate(const ompl::base::State *from, const ompl::base::State *to, double t, ompl::base::State *state) const override
Interpolate between two states from and to.
Definition: POSQStateSpace.cpp:16
void sanityChecks() const override
Checks if the state was properly initialized.
Definition: POSQStateSpace.h:78
~POSQStateSpace() override
Definition: POSQStateSpace.h:54
void initialize()
Initialize the requested steering function.
Definition: POSQStateSpace.cpp:7
POSQ class that implements the POSQ steering function.
Definition: POSQ.hpp:109
Definition: Primitives.h:14