hpp-rbprm  4.10.0
Implementation of RB-PRM planner using hpp.
polynom-trajectory.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014 CNRS
3 // Authors: Florent Lamiraux
4 //
5 // This file is part of hpp-core
6 // hpp-core is free software: you can redistribute it
7 // and/or modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation, either version
9 // 3 of the License, or (at your option) any later version.
10 //
11 // hpp-core is distributed in the hope that it will be
12 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Lesser Public License for more details. You should have
15 // received a copy of the GNU Lesser General Public License along with
16 // hpp-core If not, see
17 // <http://www.gnu.org/licenses/>.
18 
19 #ifndef HPP_RBPRM_POLYNOM_TRAJECTORY_HH
20 # define HPP_RBPRM_POLYNOM_TRAJECTORY_HH
21 
22 # include <hpp/core/fwd.hh>
23 # include <hpp/core/config.hh>
24 # include <hpp/core/path.hh>
26 # include <curves/curve_abc.h>
27 
28 namespace hpp {
29 namespace rbprm {
30 namespace interpolation {
31  HPP_PREDEF_CLASS (PolynomTrajectory);
32  typedef boost::shared_ptr <PolynomTrajectory>
34  typedef curves::curve_abc<core::value_type, core::value_type, true, Eigen::Vector3d> Polynom;
35  typedef boost::shared_ptr <Polynom> PolynomPtr_t;
45  class HPP_CORE_DLLAPI PolynomTrajectory : public core::Path
46  {
47  public:
48  typedef Path parent_t;
50  virtual ~PolynomTrajectory () throw () {}
51 
57  core::value_type subSetStart = 0,
58  core::value_type subSetEnd = 1)
59  {
60  PolynomTrajectory* ptr = new PolynomTrajectory (polynom, subSetStart, subSetEnd);
61  PolynomTrajectoryPtr_t shPtr (ptr);
62  ptr->init (shPtr);
63  ptr->checkPath ();
64  return shPtr;
65  }
66 
70  {
71  PolynomTrajectory* ptr = new PolynomTrajectory (*path);
72  PolynomTrajectoryPtr_t shPtr (ptr);
73  ptr->init (shPtr);
74  ptr->checkPath ();
75  return shPtr;
76  }
77 
82  virtual core::PathPtr_t copy () const
83  {
84  return createCopy (weak_.lock ());
85  }
86 
91  virtual core::PathPtr_t extract (const core::interval_t& subInterval) const
92  throw (core::projection_error);
93 
95  core::Configuration_t initial () const
96  {
97  return polynom_->operator ()(subSetStart_);
98  }
99 
101  core::Configuration_t end () const
102  {
103  return polynom_->operator ()(subSetEnd_);
104  }
105 
106  virtual void checkPath () const {}
107 
108  protected:
110  virtual std::ostream& print (std::ostream &os) const
111  {
112  os << "PolynomTrajectory:" << std::endl;
113  os << "interval: [ " << timeRange ().first << ", "
114  << timeRange ().second << " ]" << std::endl;
115  os << "initial configuration: " << initial() << std::endl;
116  os << "final configuration: " << end() << std::endl;
117  return os;
118  }
121  core::value_type subSetStart,core::value_type subSetEnd);
122 
124  PolynomTrajectory (const PolynomTrajectory& path);
125 
127  {
128  parent_t::init (self);
129  weak_ = self;
130  }
131 
132  virtual bool impl_compute (core::ConfigurationOut_t result,
133  core::value_type param) const;
134 
135  virtual core::PathPtr_t copy(const core::ConstraintSetPtr_t&) const {throw;}
136 
137  public:
139  const core::value_type subSetStart_;
140  const core::value_type subSetEnd_;
141  const core::value_type length_;
142 
143  private:
144  PolynomTrajectoryWkPtr_t weak_;
145  }; // class ComTrajectory
146 } // namespace interpolation
147 } // namespace rbprm
148 } // namespace hpp
149 #endif // HPP_RBPRM_POLYNOM_TRAJECTORY_HH
hpp::rbprm::interpolation::PolynomTrajectory::end
core::Configuration_t end() const
Get the final configuration.
Definition: polynom-trajectory.hh:101
hpp::rbprm::interpolation::PolynomTrajectory::copy
virtual core::PathPtr_t copy() const
Definition: polynom-trajectory.hh:82
hpp::rbprm::interpolation::PolynomTrajectory::parent_t
Path parent_t
Definition: polynom-trajectory.hh:48
hpp::rbprm::interpolation::PolynomTrajectory::copy
virtual core::PathPtr_t copy(const core::ConstraintSetPtr_t &) const
Definition: polynom-trajectory.hh:135
hpp::rbprm::interpolation::PolynomPtr_t
boost::shared_ptr< Polynom > PolynomPtr_t
Definition: polynom-trajectory.hh:35
hpp::rbprm::interpolation::PolynomTrajectory::subSetEnd_
const core::value_type subSetEnd_
Definition: polynom-trajectory.hh:140
hpp::rbprm::interpolation::PolynomTrajectoryPtr_t
boost::shared_ptr< PolynomTrajectory > PolynomTrajectoryPtr_t
Definition: polynom-trajectory.hh:33
hpp::rbprm::interpolation::PolynomTrajectory::~PolynomTrajectory
virtual ~PolynomTrajectory()
Destructor.
Definition: polynom-trajectory.hh:50
time-dependant.hh
hpp::rbprm::interpolation::Polynom
curves::curve_abc< core::value_type, core::value_type, true, Eigen::Vector3d > Polynom
Definition: polynom-trajectory.hh:34
hpp
Definition: algorithm.hh:27
hpp::rbprm::interpolation::PolynomTrajectory::length_
const core::value_type length_
Definition: polynom-trajectory.hh:141
hpp::rbprm::interpolation::PolynomTrajectory::checkPath
virtual void checkPath() const
Definition: polynom-trajectory.hh:106
hpp::rbprm::interpolation::PolynomTrajectory::subSetStart_
const core::value_type subSetStart_
Definition: polynom-trajectory.hh:139
hpp::rbprm::interpolation::PolynomTrajectory::initial
core::Configuration_t initial() const
Get the initial configuration.
Definition: polynom-trajectory.hh:95
hpp::rbprm::interpolation::PolynomTrajectory
Definition: polynom-trajectory.hh:45
hpp::rbprm::interpolation::PolynomTrajectory::init
void init(PolynomTrajectoryPtr_t self)
Definition: polynom-trajectory.hh:126
hpp::rbprm::interpolation::PolynomTrajectory::polynom_
const PolynomPtr_t polynom_
Definition: polynom-trajectory.hh:138
hpp::rbprm::interpolation::PolynomTrajectory::print
virtual std::ostream & print(std::ostream &os) const
Print path in a stream.
Definition: polynom-trajectory.hh:110
hpp::rbprm::interpolation::PolynomTrajectory::create
static PolynomTrajectoryPtr_t create(PolynomPtr_t polynom, core::value_type subSetStart=0, core::value_type subSetEnd=1)
Definition: polynom-trajectory.hh:56
hpp::rbprm::interpolation::PolynomTrajectory::createCopy
static PolynomTrajectoryPtr_t createCopy(const PolynomTrajectoryPtr_t &path)
Definition: polynom-trajectory.hh:69
hpp::rbprm::interpolation::HPP_PREDEF_CLASS
HPP_PREDEF_CLASS(ComTrajectory)