libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
roboptimTrajectory.hpp
1 /*
2  * RoboptimTrajectory.h
3  * BioMove3D
4  *
5  * Created by Jim Mainprice on 22/06/10.
6  * Copyright 2010 LAAS/CNRS. All rights reserved.
7  *
8  */
9 
10 #ifndef ROBOPTIMTRAJ_H
11 #define ROBOPTIMTRAJ_H
12 
13 #ifdef Q_FOREACH
14 #undef Q_FOREACH
15 #endif
16 
17 #include <roboptim/trajectory/trajectory.hh>
18 #include <roboptim/trajectory/cubic-b-spline.hh>
19 
20 #include "API/Trajectory/trajectory.hpp"
21 
25 namespace roboptim
26 {
27  class LinearTrajectory : public Trajectory<3> // Fix me should be one
28  {
29  public:
30  // dimension N pour manip
31  // parameters (dimension,NbPointControl)
32  LinearTrajectory (interval_t timeRange, size_type dimension,
33  const vector_t& parameters,
34  const std::string name = "Linear Trajectory") throw ();
35 
38  LinearTrajectory (const LinearTrajectory& linearInterpol) throw ();
39 
40  virtual ~LinearTrajectory () throw ();
41 
42  // returns the number of control points
43  unsigned int getNumberOfControlPoints() { return nbp_; }
44 
46  virtual void setParameters (const vector_t&) throw ();
47 
48  // ds/dp
49  virtual jacobian_t variationConfigWrtParam (double t) const throw ();
50  virtual jacobian_t variationDerivWrtParam (double t, size_type order) const throw ();
51 
52  // Autant de points singuliers que de points de control
53  virtual value_type singularPointAtRank (size_type rank) const;
54  virtual vector_t derivBeforeSingularPoint (size_type rank, size_type order) const;
55  virtual vector_t derivAfterSingularPoint (size_type rank, size_type order) const;
56 
57  ROBOPTIM_IMPLEMENT_CLONE(LinearTrajectory)
58 
59  virtual Trajectory<derivabilityOrder>* resize (interval_t timeRange)
60  const throw ()
61  {
62  return new LinearTrajectory (timeRange, this->outputSize (), this->parameters ());
63  }
64 
69  virtual std::ostream& print (std::ostream& o) const throw ();
70 
71  jacobian_t variationConfigWrtParam (StableTimePoint tp) const throw ();
72  jacobian_t variationDerivWrtParam (StableTimePoint tp, size_type order)
73  const throw ();
74 
75  protected:
76  void impl_compute (result_t& r, double t) const throw ();
77  void impl_derivative (gradient_t& g, double x, size_type order) const throw ();
78  void impl_derivative (gradient_t& g, StableTimePoint, size_type order) const throw ();
79 
80  value_type Dt () const;
81  size_type interval (value_type t) const;
82  vector_t basisFunctions (value_type t, size_type order) const;
83 
84  private:
86  unsigned int nbp_;
87  };
88 
92  class CostMapFunction : public Function
93  {
94  public:
96  CostMapFunction (Robot* R, unsigned int nbControlPoints) throw();
97 
98  // print the functions
99  virtual std::ostream& print (std::ostream& s) const throw () { return s; }
100 
101  protected:
102  // compute the cost of one solution
103  void impl_compute (result_t& r , const argument_t& a) const throw ();
104 
105  private:
106  // The Robot
107  Robot* m_Robot;
108 
109  // Nombre de points de controls
110  unsigned int m_nbControlPoints;
111  };
112 
117  {
118  public:
119  RoboptimFactory() {}
120 
123 
124  private:
125  Robot* m_Robot;
126  };
127 
132  {
133  public:
134  RoboptimTrajectory() {}
135 
136  void showSpline (const CubicBSpline& spline);
137 
138  int run_CostMap();
139  int run_testManipulator();
140  int run_test1();
141  int run_test2();
142  };
143 }
144 
145 #endif
virtual std::ostream & print(std::ostream &o) const
Display the function on the specified output stream.
Definition: roboptimTrajectory.cpp:235
API::Trajectory * make_Move3D(LinearTrajectory &traj)
make a move 3d linear traj from roboptim
Definition: roboptimTrajectory.cpp:321
Cost Map Function.
Definition: roboptimTrajectory.hpp:92
Definition: roboptimTrajectory.hpp:27
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
Roboptim trajectory.
Definition: roboptimTrajectory.hpp:131
LinearTrajectory(interval_t timeRange, size_type dimension, const vector_t &parameters, const std::string name="Linear Trajectory")
Change the arguments of the Linear Trajectory.
Definition: roboptimTrajectory.cpp:93
Definition: trajectory.hpp:40
CostMapFunction(Robot *R, unsigned int nbControlPoints)
Build a linear function from a matrix and a vector.
Definition: roboptimTrajectory.cpp:363
Roboptim trajectory.
Definition: roboptimTrajectory.hpp:116
virtual void setParameters(const vector_t &)
Modify spline parameters.
Definition: roboptimTrajectory.cpp:128
LinearTrajectory * make_Roboptim(API::Trajectory &traj)
make a roboptim linear traj from move3d
Definition: roboptimTrajectory.cpp:249