hpp-rbprm  4.10.1
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 <ndcurves/curve_abc.h>
27 
28 namespace hpp {
29 namespace rbprm {
30 namespace interpolation {
31 HPP_PREDEF_CLASS(PolynomTrajectory);
32 typedef boost::shared_ptr<PolynomTrajectory> PolynomTrajectoryPtr_t;
33 typedef ndcurves::curve_abc<core::value_type, core::value_type, true, Eigen::Vector3d> Polynom;
34 typedef boost::shared_ptr<Polynom> PolynomPtr_t;
44 class HPP_CORE_DLLAPI PolynomTrajectory : public core::Path {
45  public:
46  typedef Path parent_t;
48  virtual ~PolynomTrajectory() throw() {}
49 
54  static PolynomTrajectoryPtr_t create(PolynomPtr_t polynom, core::value_type subSetStart = 0,
55  core::value_type subSetEnd = 1) {
56  PolynomTrajectory* ptr = new PolynomTrajectory(polynom, subSetStart, subSetEnd);
57  PolynomTrajectoryPtr_t shPtr(ptr);
58  ptr->init(shPtr);
59  ptr->checkPath();
60  return shPtr;
61  }
62 
66  PolynomTrajectory* ptr = new PolynomTrajectory(*path);
67  PolynomTrajectoryPtr_t shPtr(ptr);
68  ptr->init(shPtr);
69  ptr->checkPath();
70  return shPtr;
71  }
72 
77  virtual core::PathPtr_t copy() const { return createCopy(weak_.lock()); }
78 
83  virtual core::PathPtr_t extract(const core::interval_t& subInterval) const throw(core::projection_error);
84 
86  core::Configuration_t initial() const { return polynom_->operator()(subSetStart_); }
87 
89  core::Configuration_t end() const { return polynom_->operator()(subSetEnd_); }
90 
91  virtual void checkPath() const {}
92 
93  protected:
95  virtual std::ostream& print(std::ostream& os) const {
96  os << "PolynomTrajectory:" << std::endl;
97  os << "interval: [ " << timeRange().first << ", " << timeRange().second << " ]" << std::endl;
98  os << "initial configuration: " << initial() << std::endl;
99  os << "final configuration: " << end() << std::endl;
100  return os;
101  }
103  PolynomTrajectory(PolynomPtr_t polynom, core::value_type subSetStart, core::value_type subSetEnd);
104 
107 
109  parent_t::init(self);
110  weak_ = self;
111  }
112 
113  virtual bool impl_compute(core::ConfigurationOut_t result, core::value_type param) const;
114 
115  virtual core::PathPtr_t copy(const core::ConstraintSetPtr_t&) const { throw; }
116 
117  public:
119  const core::value_type subSetStart_;
120  const core::value_type subSetEnd_;
121  const core::value_type length_;
122 
123  private:
124  PolynomTrajectoryWkPtr_t weak_;
125 }; // class ComTrajectory
126 } // namespace interpolation
127 } // namespace rbprm
128 } // namespace hpp
129 #endif // HPP_RBPRM_POLYNOM_TRAJECTORY_HH
hpp::rbprm::interpolation::PolynomTrajectory::end
core::Configuration_t end() const
Get the final configuration.
Definition: polynom-trajectory.hh:89
hpp::rbprm::interpolation::PolynomTrajectory::copy
virtual core::PathPtr_t copy() const
Definition: polynom-trajectory.hh:77
hpp::rbprm::interpolation::PolynomTrajectory::parent_t
Path parent_t
Definition: polynom-trajectory.hh:46
hpp::rbprm::interpolation::PolynomTrajectory::copy
virtual core::PathPtr_t copy(const core::ConstraintSetPtr_t &) const
Definition: polynom-trajectory.hh:115
hpp::rbprm::interpolation::PolynomPtr_t
boost::shared_ptr< Polynom > PolynomPtr_t
Definition: polynom-trajectory.hh:34
hpp::rbprm::interpolation::PolynomTrajectory::subSetEnd_
const core::value_type subSetEnd_
Definition: polynom-trajectory.hh:120
hpp::rbprm::interpolation::PolynomTrajectoryPtr_t
boost::shared_ptr< PolynomTrajectory > PolynomTrajectoryPtr_t
Definition: polynom-trajectory.hh:32
hpp::rbprm::interpolation::PolynomTrajectory::~PolynomTrajectory
virtual ~PolynomTrajectory()
Destructor.
Definition: polynom-trajectory.hh:48
time-dependant.hh
hpp
Definition: algorithm.hh:27
hpp::rbprm::interpolation::PolynomTrajectory::length_
const core::value_type length_
Definition: polynom-trajectory.hh:121
hpp::rbprm::interpolation::PolynomTrajectory::checkPath
virtual void checkPath() const
Definition: polynom-trajectory.hh:91
hpp::rbprm::interpolation::PolynomTrajectory::subSetStart_
const core::value_type subSetStart_
Definition: polynom-trajectory.hh:119
hpp::rbprm::interpolation::PolynomTrajectory::initial
core::Configuration_t initial() const
Get the initial configuration.
Definition: polynom-trajectory.hh:86
hpp::rbprm::interpolation::PolynomTrajectory
Definition: polynom-trajectory.hh:44
hpp::rbprm::interpolation::Polynom
ndcurves::curve_abc< core::value_type, core::value_type, true, Eigen::Vector3d > Polynom
Definition: polynom-trajectory.hh:33
hpp::rbprm::interpolation::PolynomTrajectory::init
void init(PolynomTrajectoryPtr_t self)
Definition: polynom-trajectory.hh:108
hpp::rbprm::interpolation::PolynomTrajectory::polynom_
const PolynomPtr_t polynom_
Definition: polynom-trajectory.hh:118
hpp::rbprm::interpolation::PolynomTrajectory::print
virtual std::ostream & print(std::ostream &os) const
Print path in a stream.
Definition: polynom-trajectory.hh:95
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:54
hpp::rbprm::interpolation::PolynomTrajectory::createCopy
static PolynomTrajectoryPtr_t createCopy(const PolynomTrajectoryPtr_t &path)
Definition: polynom-trajectory.hh:65
hpp::rbprm::interpolation::HPP_PREDEF_CLASS
HPP_PREDEF_CLASS(ComTrajectory)