[roboptim-commit] [SCM] roboptim-trajectory branch, master, updated. v0.2-24-g4f7ec26
Status: Beta
Brought to you by:
flamiraux
From: Thomas M. <tho...@us...> - 2009-11-06 13:54:09
|
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 4f7ec26ee057cde9229773258a6e66d87ceba050 (commit) via 97621b6290570b9f1d650fc7d324af74b88d534e (commit) from a38a277e6553f4ba509ca607863ad9f9ffdcc390 (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 4f7ec26ee057cde9229773258a6e66d87ceba050 Author: Thomas Moulard <tho...@gm...> Date: Fri Nov 6 14:53:53 2009 +0100 Check interval unscaling. * tests/free-time-trajectory.cc: Add checks. * tests/free-time-trajectory.stdout: Regenerate. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 5e0455b..d901c57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-11-06 Thomas Moulard <tho...@gm...> + Check interval unscaling. + * tests/free-time-trajectory.cc: Add checks. + * tests/free-time-trajectory.stdout: Regenerate. + +2009-11-06 Thomas Moulard <tho...@gm...> + Fix function naming. * include/roboptim/trajectory/free-time-trajectory.hh, * include/roboptim/trajectory/free-time-trajectory.hxx: diff --git a/tests/free-time-trajectory.cc b/tests/free-time-trajectory.cc index bee5619..b76c4f7 100644 --- a/tests/free-time-trajectory.cc +++ b/tests/free-time-trajectory.cc @@ -22,6 +22,7 @@ #include <roboptim/core/finite-difference-gradient.hh> #include <roboptim/core/io.hh> +#include <roboptim/core/util.hh> #include <roboptim/trajectory/free-time-trajectory.hh> #include <roboptim/trajectory/fwd.hh> @@ -281,10 +282,27 @@ int run_test () assert (freeTimeTraj.inputSize () == 1); assert (freeTimeTraj.outputSize () == 1); + // Check interval scaling. + { + std::cout << "Initial interval" << std::endl; + std::cout << freeTimeTraj.timeRange () << std::endl; + + std::cout << "Params = 2" << std::endl; + params[0] = 2.; + freeTimeTraj.setParameters (params); + std::cout << freeTimeTraj.timeRange () << std::endl; + + std::cout << "Params = .5" << std::endl; + params[0] = .5; + freeTimeTraj.setParameters (params); + std::cout << freeTimeTraj.timeRange () << std::endl; + } + // Check scaling and unscaling. { params[0] = 3.14; freeTimeTraj.setParameters (params); + value_type t = 0.32; StableTimePoint stp (t / freeTimeTraj.length ()); diff --git a/tests/free-time-trajectory.stdout b/tests/free-time-trajectory.stdout index 0c7ed72..9342ff0 100644 --- a/tests/free-time-trajectory.stdout +++ b/tests/free-time-trajectory.stdout @@ -1,3 +1,9 @@ +Initial interval +(0, 4) +Params = 2 +(0, 2) +Params = .5 +(0, 8) Checking StableTimePoint scaling. Checking scale/unscale methods. Checking scale using tmin/tmax. commit 97621b6290570b9f1d650fc7d324af74b88d534e Author: Thomas Moulard <tho...@gm...> Date: Fri Nov 6 14:45:45 2009 +0100 Fix function naming. * include/roboptim/trajectory/free-time-trajectory.hh, * include/roboptim/trajectory/free-time-trajectory.hxx: Rename scaleTime/scaleInterval internal free functions to unscaleTime and unscaleInterval to maintain consistency. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 22bc76c..5e0455b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2009-11-06 Thomas Moulard <tho...@gm...> + Fix function naming. + * include/roboptim/trajectory/free-time-trajectory.hh, + * include/roboptim/trajectory/free-time-trajectory.hxx: + Rename scaleTime/scaleInterval internal free functions to + unscaleTime and unscaleInterval to maintain consistency. + +2009-11-06 Thomas Moulard <tho...@gm...> + Check scaling functions in FreeTimeTrajectory test. * include/roboptim/trajectory/free-time-trajectory.hh: Make scaleTime and unscaleTime public. diff --git a/include/roboptim/trajectory/free-time-trajectory.hh b/include/roboptim/trajectory/free-time-trajectory.hh index 28ee40e..8aaf688 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hh +++ b/include/roboptim/trajectory/free-time-trajectory.hh @@ -126,8 +126,10 @@ namespace roboptim assert (this->scaleTime (tMin) == tmin); assert (this->scaleTime (tMax) == tmax); - return new FreeTimeTrajectory<DerivabilityOrder> - (*trajectory_, scale); + Trajectory<DerivabilityOrder>* res = + new FreeTimeTrajectory<DerivabilityOrder> (*trajectory_, scale); + assert (res->timeRange () == this->timeRange ()); + return res; } Trajectory<DerivabilityOrder>* diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index 763952b..727f24f 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -27,7 +27,7 @@ namespace roboptim namespace detail { inline Function::value_type - scaleTime (Function::value_type unscaled, + unscaleTime (Function::value_type unscaled, Function::value_type min, Function::value_type scale) { @@ -36,13 +36,13 @@ namespace roboptim template <unsigned dorder> Function::interval_t - scaleInterval (const Trajectory<dorder>& traj, - typename Function::value_type scale) + unscaleInterval (const Trajectory<dorder>& traj, + typename Function::value_type scale) { Function::value_type min = Function::getLowerBound (traj.timeRange ()); Function::value_type max = - scaleTime (Function::getUpperBound (traj.timeRange ()), min, scale); + unscaleTime (Function::getUpperBound (traj.timeRange ()), min, scale); return Function::makeInterval (min, max); } } // end of namespace detail @@ -50,7 +50,7 @@ namespace roboptim template <unsigned dorder> FreeTimeTrajectory<dorder>::FreeTimeTrajectory (const Trajectory<dorder>& traj, value_type s) throw () - : Trajectory<dorder> (detail::scaleInterval (traj, s), traj.outputSize (), + : Trajectory<dorder> (detail::unscaleInterval (traj, s), traj.outputSize (), addScaleToParameters (traj.parameters (), s)), trajectory_ (traj.clone ()) { @@ -182,7 +182,8 @@ namespace roboptim p_[0] = 1e-8; this->parameters_ = p_; - this->timeRange_ = detail::scaleInterval (*trajectory_, this->timeScale ()); + this->timeRange_ = + detail::unscaleInterval (*trajectory_, this->timeScale ()); this->trajectory_->setParameters (removeScaleFromParameters (p_)); } ----------------------------------------------------------------------- Summary of changes: ChangeLog | 14 ++++++++++++++ .../roboptim/trajectory/free-time-trajectory.hh | 6 ++++-- .../roboptim/trajectory/free-time-trajectory.hxx | 13 +++++++------ tests/free-time-trajectory.cc | 18 ++++++++++++++++++ tests/free-time-trajectory.stdout | 6 ++++++ 5 files changed, 49 insertions(+), 8 deletions(-) hooks/post-receive -- roboptim-trajectory |