[roboptim-commit] [SCM] roboptim-trajectory branch, master, updated. v0.2-46-gcf076c0
Status: Beta
Brought to you by:
flamiraux
From: Thomas M. <tho...@us...> - 2009-11-16 12:42:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "roboptim-trajectory". The branch, master has been updated via cf076c099ea28c840df6b2a725d4135b3f74dbe1 (commit) from ba9c15a73fa4e3f5e5824ad9702f028f2e0ae196 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cf076c099ea28c840df6b2a725d4135b3f74dbe1 Author: Thomas Moulard <tho...@gm...> Date: Mon Nov 16 13:42:12 2009 +0100 Clean interface. * include/roboptim/trajectory/free-time-trajectory.hh, * include/roboptim/trajectory/free-time-trajectory.hxx, * include/roboptim/trajectory/fwd.hh, * include/roboptim/trajectory/stable-point-state-function.hh, * include/roboptim/trajectory/state-function.hh, * include/roboptim/trajectory/state-function.hxx, * tests/anthropomorphic-cost-function.cc, * tests/free-time-trajectory-stable-time-point.cc, * tests/free-time-trajectory.cc, * tests/spline-time-optimization.cc, * tests/stable-point-state-function.cc, * tests/state-function.cc: Update interface so that classes are always parametrized by the trajectory classes types. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index f181643..71d65de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 2009-11-16 Thomas Moulard <tho...@gm...> + Clean interface. + * include/roboptim/trajectory/free-time-trajectory.hh, + * include/roboptim/trajectory/free-time-trajectory.hxx, + * include/roboptim/trajectory/fwd.hh, + * include/roboptim/trajectory/stable-point-state-function.hh, + * include/roboptim/trajectory/state-function.hh, + * include/roboptim/trajectory/state-function.hxx, + * tests/anthropomorphic-cost-function.cc, + * tests/free-time-trajectory-stable-time-point.cc, + * tests/free-time-trajectory.cc, + * tests/spline-time-optimization.cc, + * tests/stable-point-state-function.cc, + * tests/state-function.cc: Update interface so that classes + are always parametrized by the trajectory classes types. + +2009-11-16 Thomas Moulard <tho...@gm...> + Normalize test output. * tests/spline-optimization.cc: Here. diff --git a/include/roboptim/trajectory/free-time-trajectory.hh b/include/roboptim/trajectory/free-time-trajectory.hh index 756aae5..5f8b35b 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hh +++ b/include/roboptim/trajectory/free-time-trajectory.hh @@ -18,7 +18,10 @@ #ifndef ROBOPTIM_TRAJECTORY_FREETIMETRAJECTORY_HH # define ROBOPTIM_TRAJECTORY_FREETIMETRAJECTORY_HH # include <roboptim/trajectory/sys.hh> + # include <boost/numeric/ublas/vector_proxy.hpp> +# include <boost/static_assert.hpp> +# include <boost/type_traits/is_base_of.hpp> # include <roboptim/trajectory/trajectory.hh> @@ -31,12 +34,21 @@ namespace roboptim /// /// Build a trajectory from an input trajectory and a time scale /// factor. - template <unsigned DerivabilityOrder> - class FreeTimeTrajectory : public Trajectory<DerivabilityOrder> + template <typename T> + class FreeTimeTrajectory : public Trajectory<T::derivabilityOrder> { + /// Check that T is a trajectory type. + BOOST_STATIC_ASSERT((boost::is_base_of + <Trajectory<T::derivabilityOrder>, T>::value)); + public: /// \brief Parent type. - typedef Trajectory<DerivabilityOrder> parent_t; + typedef Trajectory<T::derivabilityOrder> parent_t; + /// \brief Fixed point trajectory type. + typedef T fixedTimeTrajectory_t; + /// \brief Self type. + typedef FreeTimeTrajectory<T> self_t; + /// \brief Import value type. typedef typename parent_t::value_type value_type; @@ -61,10 +73,10 @@ namespace roboptim /// /// \param traj trajectory defining this one by reparameterization /// \param s time scale - FreeTimeTrajectory (const Trajectory<DerivabilityOrder>& traj, value_type s) + FreeTimeTrajectory (const fixedTimeTrajectory_t& traj, value_type s) throw (); - FreeTimeTrajectory (const FreeTimeTrajectory<DerivabilityOrder>& traj) throw (); + FreeTimeTrajectory (const self_t& traj) throw (); virtual ~FreeTimeTrajectory () throw (); @@ -90,7 +102,7 @@ namespace roboptim return 0; } - ROBOPTIM_IMPLEMENT_CLONE (FreeTimeTrajectory<DerivabilityOrder>) + ROBOPTIM_IMPLEMENT_CLONE (self_t) /// \brief Display the function on the specified output stream. /// @@ -104,14 +116,14 @@ namespace roboptim /// \param index Angles index in parameter array. virtual void normalizeAngles (size_type index) throw (); - const Trajectory<DerivabilityOrder>& + const fixedTimeTrajectory_t& getFixedTimeTrajectory () const throw () { assert (trajectory_); return *trajectory_; } - Trajectory<DerivabilityOrder>* + self_t* resize (interval_t timeRange) const throw () { assert (trajectory_); @@ -126,13 +138,13 @@ namespace roboptim assert (this->scaleTime (tMin) == tmin); assert (this->scaleTime (tMax) == tmax); - Trajectory<DerivabilityOrder>* res = - new FreeTimeTrajectory<DerivabilityOrder> (*trajectory_, scale); + self_t* res = + new self_t (*trajectory_, scale); assert (res->timeRange () == this->timeRange ()); return res; } - Trajectory<DerivabilityOrder>* + fixedTimeTrajectory_t* makeFixedTimeTrajectory () const throw () { assert (trajectory_); @@ -164,7 +176,7 @@ namespace roboptim const throw (); private: /// \brief Input fixed time trajectory. - Trajectory<DerivabilityOrder>* trajectory_; + fixedTimeTrajectory_t* trajectory_; }; /// Example shows FreeTimeTrajectory use. diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index 6aa0394..14e02d3 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -47,43 +47,43 @@ namespace roboptim } } // end of namespace detail - template <unsigned dorder> - FreeTimeTrajectory<dorder>::FreeTimeTrajectory - (const Trajectory<dorder>& traj, value_type s) throw () - : Trajectory<dorder> (detail::unscaleInterval (traj, s), traj.outputSize (), - addScaleToParameters (traj.parameters (), s)), + template <typename T> + FreeTimeTrajectory<T>::FreeTimeTrajectory + (const fixedTimeTrajectory_t& traj, value_type s) throw () + : parent_t (detail::unscaleInterval (traj, s), traj.outputSize (), + addScaleToParameters (traj.parameters (), s)), trajectory_ (traj.clone ()) { assert (s != 0. && !std::isinf (s) && !std::isnan (s)); } - template <unsigned dorder> - FreeTimeTrajectory<dorder>::FreeTimeTrajectory - (const FreeTimeTrajectory<dorder>& traj) + template <typename T> + FreeTimeTrajectory<T>::FreeTimeTrajectory + (const self_t& traj) throw () - : Trajectory<dorder> (traj.timeRange (), traj.outputSize (), - traj.parameters ()), + : parent_t (traj.timeRange (), traj.outputSize (), + traj.parameters ()), trajectory_ (traj.trajectory_->clone ()) { } - template <unsigned dorder> - FreeTimeTrajectory<dorder>::~FreeTimeTrajectory () throw () + template <typename T> + FreeTimeTrajectory<T>::~FreeTimeTrajectory () throw () { delete trajectory_; } - template <unsigned dorder> + template <typename T> void - FreeTimeTrajectory<dorder>::impl_compute (result_t& res , double t) + FreeTimeTrajectory<T>::impl_compute (result_t& res , double t) const throw () { (*trajectory_) (res, this->scaleTime (t)); } - template <unsigned dorder> + template <typename T> void - FreeTimeTrajectory<dorder>::impl_derivative (gradient_t& derivative, + FreeTimeTrajectory<T>::impl_derivative (gradient_t& derivative, double t, size_type order) const throw () { @@ -93,9 +93,9 @@ namespace roboptim derivative *= std::pow (this->timeScale (), 0. + order); } - template <unsigned dorder> + template <typename T> void - FreeTimeTrajectory<dorder>::impl_derivative (gradient_t& derivative, + FreeTimeTrajectory<T>::impl_derivative (gradient_t& derivative, StableTimePoint stp, size_type order) const throw () { @@ -104,9 +104,9 @@ namespace roboptim derivative *= std::pow (this->timeScale (), 0. + order); } - template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::jacobian_t - FreeTimeTrajectory<dorder>::variationConfigWrtParam (double t) const throw () + template <typename T> + typename FreeTimeTrajectory<T>::jacobian_t + FreeTimeTrajectory<T>::variationConfigWrtParam (double t) const throw () { using namespace boost::numeric::ublas; value_type scaled = this->scaleTime (t); @@ -127,9 +127,9 @@ namespace roboptim return result; } - template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::jacobian_t - FreeTimeTrajectory<dorder>::variationDerivWrtParam (double t, size_type order) + template <typename T> + typename FreeTimeTrajectory<T>::jacobian_t + FreeTimeTrajectory<T>::variationDerivWrtParam (double t, size_type order) const throw () { if (order == 0) @@ -158,9 +158,9 @@ namespace roboptim return result; } - template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::jacobian_t - FreeTimeTrajectory<dorder>::variationConfigWrtParam + template <typename T> + typename FreeTimeTrajectory<T>::jacobian_t + FreeTimeTrajectory<T>::variationConfigWrtParam (StableTimePoint stp) const throw () { using namespace boost::numeric::ublas; @@ -180,9 +180,9 @@ namespace roboptim } - template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::jacobian_t - FreeTimeTrajectory<dorder>::variationDerivWrtParam + template <typename T> + typename FreeTimeTrajectory<T>::jacobian_t + FreeTimeTrajectory<T>::variationDerivWrtParam (StableTimePoint stp, size_type order) const throw () { if (order == 0) @@ -205,35 +205,35 @@ namespace roboptim return result; } - template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::value_type - FreeTimeTrajectory<dorder>::singularPointAtRank (size_type rank) const + template <typename T> + typename FreeTimeTrajectory<T>::value_type + FreeTimeTrajectory<T>::singularPointAtRank (size_type rank) const { double tMin = this->getLowerBound (this->timeRange ()); return tMin + (trajectory_->singularPointAtRank (rank) - tMin) * this->timeScale (); } - template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::vector_t - FreeTimeTrajectory<dorder>::derivBeforeSingularPoint (size_type rank, + template <typename T> + typename FreeTimeTrajectory<T>::vector_t + FreeTimeTrajectory<T>::derivBeforeSingularPoint (size_type rank, size_type order) const { return trajectory_->derivBeforeSingularPoint (rank, order); } - template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::vector_t - FreeTimeTrajectory<dorder>::derivAfterSingularPoint (size_type rank, size_type order) + template <typename T> + typename FreeTimeTrajectory<T>::vector_t + FreeTimeTrajectory<T>::derivAfterSingularPoint (size_type rank, size_type order) const { return trajectory_->derivAfterSingularPoint (rank, order); } - template <unsigned dorder> + template <typename T> void - FreeTimeTrajectory<dorder>::setParameters (const vector_t& p) throw () + FreeTimeTrajectory<T>::setParameters (const vector_t& p) throw () { //FIXME: is this ok? vector_t p_ = p; @@ -246,16 +246,16 @@ namespace roboptim this->trajectory_->setParameters (removeScaleFromParameters (p_)); } - template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::value_type - FreeTimeTrajectory<dorder>::timeScale () const throw () + template <typename T> + typename FreeTimeTrajectory<T>::value_type + FreeTimeTrajectory<T>::timeScale () const throw () { return this->parameters_[0]; } - template <unsigned dorder> + template <typename T> double - FreeTimeTrajectory<dorder>::scaleTime (double unscaled) const throw () + FreeTimeTrajectory<T>::scaleTime (double unscaled) const throw () { value_type tMin = getLowerBound (this->timeRange ()); value_type tmin = getLowerBound (this->trajectory_->timeRange ()); @@ -273,9 +273,9 @@ namespace roboptim return res; } - template <unsigned dorder> + template <typename T> double - FreeTimeTrajectory<dorder>::unscaleTime (double scaled) const throw () + FreeTimeTrajectory<T>::unscaleTime (double scaled) const throw () { value_type tMin = getLowerBound (this->timeRange ()); value_type tMax = getUpperBound (this->timeRange ()); @@ -293,17 +293,17 @@ namespace roboptim return res; } - template <unsigned dorder> + template <typename T> std::ostream& - FreeTimeTrajectory<dorder>::print (std::ostream& o) const throw () + FreeTimeTrajectory<T>::print (std::ostream& o) const throw () { o << "Free time trajectory." << std::endl; return o; } - template <unsigned dorder> + template <typename T> void - FreeTimeTrajectory<dorder>::normalizeAngles (size_type index) throw () + FreeTimeTrajectory<T>::normalizeAngles (size_type index) throw () { this->normalizeAngles (index, 1.); } diff --git a/include/roboptim/trajectory/fwd.hh b/include/roboptim/trajectory/fwd.hh index f51ae03..16d0280 100644 --- a/include/roboptim/trajectory/fwd.hh +++ b/include/roboptim/trajectory/fwd.hh @@ -21,10 +21,13 @@ namespace roboptim { + template <typename T> + class FreeTimeTrajectory; + template <unsigned dorder> class Trajectory; - template <unsigned dorder> + template <typename T> class StateFunction; template <typename T> diff --git a/include/roboptim/trajectory/stable-point-state-function.hh b/include/roboptim/trajectory/stable-point-state-function.hh index 760627f..b79ea7f 100644 --- a/include/roboptim/trajectory/stable-point-state-function.hh +++ b/include/roboptim/trajectory/stable-point-state-function.hh @@ -20,6 +20,8 @@ # include <roboptim/trajectory/sys.hh> # include <boost/shared_ptr.hpp> +# include <boost/static_assert.hpp> +# include <boost/type_traits/is_base_of.hpp> # include <roboptim/trajectory/fwd.hh> # include <roboptim/core/derivable-function.hh> @@ -53,9 +55,12 @@ namespace roboptim template <typename T> class StablePointStateFunction : public DerivableFunction { + /// Check that T is a trajectory type. + BOOST_STATIC_ASSERT((boost::is_base_of + <Trajectory<T::derivabilityOrder>, T>::value)); public: /// \brief Trajectory type. - typedef FreeTimeTrajectory<T::derivabilityOrder> trajectory_t; + typedef T trajectory_t; /// \brief Constructor. /// diff --git a/include/roboptim/trajectory/state-function.hh b/include/roboptim/trajectory/state-function.hh index 72211e1..bd1c436 100644 --- a/include/roboptim/trajectory/state-function.hh +++ b/include/roboptim/trajectory/state-function.hh @@ -20,6 +20,8 @@ # include <roboptim/trajectory/sys.hh> # include <boost/shared_ptr.hpp> +# include <boost/static_assert.hpp> +# include <boost/type_traits/is_base_of.hpp> # include <roboptim/trajectory/fwd.hh> # include <roboptim/core/derivable-function.hh> @@ -49,12 +51,15 @@ namespace roboptim /// /// \tparam T trajectory type - template <unsigned DerivabilityOrder> + template <typename T> class StateFunction : public DerivableFunction { + /// Check that T is a trajectory type. + BOOST_STATIC_ASSERT((boost::is_base_of + <Trajectory<T::derivabilityOrder>, T>::value)); public: /// \brief Trajectory type. - typedef Trajectory<DerivabilityOrder> trajectory_t; + typedef T trajectory_t; /// \brief Constructor. /// diff --git a/include/roboptim/trajectory/state-function.hxx b/include/roboptim/trajectory/state-function.hxx index 732e45c..e6f2a0c 100644 --- a/include/roboptim/trajectory/state-function.hxx +++ b/include/roboptim/trajectory/state-function.hxx @@ -21,8 +21,8 @@ namespace roboptim { - template <unsigned N> - StateFunction<N>::StateFunction (const trajectory_t& trajectory, + template <typename T> + StateFunction<T>::StateFunction (const trajectory_t& trajectory, boost::shared_ptr<DerivableFunction> function, const StableTimePoint tpt, size_type order) throw () @@ -38,21 +38,21 @@ namespace roboptim assert (function_->inputSize () == trajectory_.outputSize () * (order + 1)); } - template <unsigned N> - StateFunction<N>::~StateFunction() throw () + template <typename T> + StateFunction<T>::~StateFunction() throw () { } - template <unsigned N> - typename StateFunction<N>::size_type - StateFunction<N>::order () const throw () + template <typename T> + typename StateFunction<T>::size_type + StateFunction<T>::order () const throw () { return order_; } - template <unsigned N> + template <typename T> void - StateFunction<N>::impl_compute (result_t& res, + StateFunction<T>::impl_compute (result_t& res, const argument_t& p) const throw () { static boost::shared_ptr<trajectory_t> updatedTrajectory = @@ -61,9 +61,9 @@ namespace roboptim (*function_) (res, updatedTrajectory->state (tpt_, this->order_)); } - template <unsigned N> + template <typename T> void - StateFunction<N>::impl_gradient (gradient_t& grad, + StateFunction<T>::impl_gradient (gradient_t& grad, const argument_t& p, size_type i) const throw () { diff --git a/tests/anthropomorphic-cost-function.cc b/tests/anthropomorphic-cost-function.cc index 9cfcc5d..4974dd9 100644 --- a/tests/anthropomorphic-cost-function.cc +++ b/tests/anthropomorphic-cost-function.cc @@ -51,7 +51,7 @@ using namespace roboptim::visualization::gnuplot; typedef CFSQPSolver::problem_t::constraints_t constraint_t; typedef CFSQPSolver solver_t; -typedef FreeTimeTrajectory<Spline::derivabilityOrder> freeTime_t; +typedef FreeTimeTrajectory<Spline> freeTime_t; // Problem parameters. const unsigned configurationSpaceSize = 3; @@ -133,12 +133,12 @@ int optimize (double initialX, (freeTimeTraj, frontalSpeed, 1, problem, vRangeFrontal, nControlPoints * nConstraintsPerCtrlPts); - // Orthogonal - boost::shared_ptr<DerivableFunction> orthogonalSpeed (new OrthogonalSpeed ()); - Function::interval_t vRangeOrthogonal = Function::makeInterval (-vMax, vMax); - StablePointStateFunction<freeTime_t>::addToProblem - (freeTimeTraj, orthogonalSpeed, 1, problem, vRangeOrthogonal, - nControlPoints * nConstraintsPerCtrlPts); + // // Orthogonal + // boost::shared_ptr<DerivableFunction> orthogonalSpeed (new OrthogonalSpeed ()); + // Function::interval_t vRangeOrthogonal = Function::makeInterval (-vMax, vMax); + // StablePointStateFunction<freeTime_t>::addToProblem + // (freeTimeTraj, orthogonalSpeed, 1, problem, vRangeOrthogonal, + // nControlPoints * nConstraintsPerCtrlPts); // Omega (theta dot) Function::interval_t vRangeOmega = Function::makeInterval (-.5, .5); @@ -164,8 +164,7 @@ int optimize (double initialX, solver_t::result_t res = solver.minimum (); std::cerr << res << std::endl; - FreeTimeTrajectory<Spline::derivabilityOrder> optimizedTrajectory = - freeTimeTraj; + FreeTimeTrajectory<Spline> optimizedTrajectory = freeTimeTraj; switch (solver.minimumType ()) { diff --git a/tests/free-time-trajectory-stable-time-point.cc b/tests/free-time-trajectory-stable-time-point.cc index 8166be5..040d7ad 100644 --- a/tests/free-time-trajectory-stable-time-point.cc +++ b/tests/free-time-trajectory-stable-time-point.cc @@ -39,7 +39,7 @@ using namespace roboptim; using namespace roboptim::visualization; -typedef FreeTimeTrajectory<Spline::derivabilityOrder> freeTime_t; +typedef FreeTimeTrajectory<Spline> freeTime_t; template <typename T> bool isAlmostEqual (const T& x, const T& y, const T& epsilon = 1e10-8) @@ -287,7 +287,7 @@ int run_test () // Make trajectories. Spline::interval_t timeRange = Spline::makeInterval (0., 4.); Spline spline (timeRange, 1, removeScaleFromParameters (params), "before"); - FreeTimeTrajectory<Spline::derivabilityOrder> freeTimeTraj (spline, 1.); + FreeTimeTrajectory<Spline> freeTimeTraj (spline, 1.); assert (freeTimeTraj.inputSize () == 1); assert (freeTimeTraj.outputSize () == 1); diff --git a/tests/free-time-trajectory.cc b/tests/free-time-trajectory.cc index bfb555d..d634baa 100644 --- a/tests/free-time-trajectory.cc +++ b/tests/free-time-trajectory.cc @@ -39,7 +39,7 @@ using namespace roboptim; using namespace roboptim::visualization; -typedef FreeTimeTrajectory<Spline::derivabilityOrder> freeTime_t; +typedef FreeTimeTrajectory<Spline> freeTime_t; template <typename T> bool isAlmostEqual (const T& x, const T& y, const T& epsilon = 1e10-8) @@ -292,7 +292,7 @@ int run_test () // Make trajectories. Spline::interval_t timeRange = Spline::makeInterval (0., 4.); Spline spline (timeRange, 1, removeScaleFromParameters (params), "before"); - FreeTimeTrajectory<Spline::derivabilityOrder> freeTimeTraj (spline, 1.); + FreeTimeTrajectory<Spline> freeTimeTraj (spline, 1.); assert (freeTimeTraj.inputSize () == 1); assert (freeTimeTraj.outputSize () == 1); diff --git a/tests/spline-time-optimization.cc b/tests/spline-time-optimization.cc index 2e86d25..6fb0e4c 100644 --- a/tests/spline-time-optimization.cc +++ b/tests/spline-time-optimization.cc @@ -52,7 +52,7 @@ using namespace roboptim::visualization::gnuplot; typedef CFSQPSolver::problem_t::constraints_t constraint_t; typedef CFSQPSolver solver_t; -typedef FreeTimeTrajectory<Spline::derivabilityOrder> freeTime_t; +typedef FreeTimeTrajectory<Spline> freeTime_t; // Problem parameters. @@ -99,7 +99,7 @@ int run_test () makeFreeze (problem) (indices, freeTimeParams); Function::interval_t vRange = Function::makeUpperInterval (.5 * vMax * vMax); - LimitSpeed<FreeTimeTrajectory<Spline::derivabilityOrder> >::addToProblem + LimitSpeed<FreeTimeTrajectory<Spline> >::addToProblem (freeTimeTraj, problem, vRange, nControlPoints * nConstraintsPerCtrlPts); std::ofstream limitSpeedStream ("limit-speed.gp"); @@ -120,7 +120,7 @@ int run_test () solver_t::result_t res = solver.minimum (); std::cerr << res << std::endl; - FreeTimeTrajectory<Spline::derivabilityOrder> optimizedTrajectory = + FreeTimeTrajectory<Spline> optimizedTrajectory = freeTimeTraj; switch (solver.minimumType ()) diff --git a/tests/stable-point-state-function.cc b/tests/stable-point-state-function.cc index d30a219..2770354 100644 --- a/tests/stable-point-state-function.cc +++ b/tests/stable-point-state-function.cc @@ -49,7 +49,7 @@ int run_test () Spline::interval_t timeRange = Spline::makeInterval (0., 4.); Spline spline (timeRange, 3, params, "before"); - typedef FreeTimeTrajectory<Spline::derivabilityOrder> freeTimeTraj_t; + typedef FreeTimeTrajectory<Spline> freeTimeTraj_t; freeTimeTraj_t ftt (spline, 2.); for (unsigned i = 0; i < 10; ++i) @@ -58,12 +58,12 @@ int run_test () const double t = timePoint.getTime (ftt.timeRange ()); boost::shared_ptr<DerivableFunction> frontalSpeed (new FrontalSpeed ()); - StablePointStateFunction<Spline> stateFunction + StablePointStateFunction<FreeTimeTrajectory<Spline> > stateFunction (ftt, frontalSpeed, timePoint, orderMax); boost::shared_ptr<DerivableFunction> orthogonalSpeed (new OrthogonalSpeed ()); - StablePointStateFunction<Spline> orthoStateFunction + StablePointStateFunction<FreeTimeTrajectory<Spline> > orthoStateFunction (ftt, orthogonalSpeed, timePoint, orderMax); std::cout << "State cost evaluation:" << std::endl diff --git a/tests/state-function.cc b/tests/state-function.cc index 8a6b61f..4d6a299 100644 --- a/tests/state-function.cc +++ b/tests/state-function.cc @@ -52,12 +52,12 @@ int run_test () const double t = timePoint.getTime (spline.timeRange ()); boost::shared_ptr<DerivableFunction> frontalSpeed (new FrontalSpeed ()); - StateFunction<Spline::derivabilityOrder> stateFunction + StateFunction<Spline> stateFunction (spline, frontalSpeed, timePoint, orderMax); boost::shared_ptr<DerivableFunction> orthogonalSpeed (new OrthogonalSpeed ()); - StateFunction<Spline::derivabilityOrder> orthoStateFunction + StateFunction<Spline> orthoStateFunction (spline, orthogonalSpeed, timePoint, orderMax); std::cout << "State cost evaluation:" << std::endl ----------------------------------------------------------------------- Summary of changes: ChangeLog | 17 +++ .../roboptim/trajectory/free-time-trajectory.hh | 36 +++++--- .../roboptim/trajectory/free-time-trajectory.hxx | 104 ++++++++++---------- include/roboptim/trajectory/fwd.hh | 5 +- .../trajectory/stable-point-state-function.hh | 7 +- include/roboptim/trajectory/state-function.hh | 9 ++- include/roboptim/trajectory/state-function.hxx | 22 ++-- tests/anthropomorphic-cost-function.cc | 17 ++-- tests/free-time-trajectory-stable-time-point.cc | 4 +- tests/free-time-trajectory.cc | 4 +- tests/spline-time-optimization.cc | 6 +- tests/stable-point-state-function.cc | 6 +- tests/state-function.cc | 4 +- 13 files changed, 141 insertions(+), 100 deletions(-) hooks/post-receive -- roboptim-trajectory |