roboptim-commit Mailing List for RobOptim (Page 94)
Status: Beta
Brought to you by:
flamiraux
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(62) |
Jul
(62) |
Aug
(36) |
Sep
(24) |
Oct
(41) |
Nov
(182) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(12) |
Feb
(13) |
Mar
(104) |
Apr
(95) |
May
(90) |
Jun
(90) |
Jul
(93) |
Aug
(97) |
Sep
(91) |
Oct
(93) |
Nov
(90) |
Dec
(95) |
2011 |
Jan
(96) |
Feb
(84) |
Mar
(94) |
Apr
(91) |
May
(93) |
Jun
(91) |
Jul
(93) |
Aug
(93) |
Sep
(107) |
Oct
(93) |
Nov
(58) |
Dec
|
2012 |
Jan
(8) |
Feb
(4) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(6) |
Dec
(5) |
2013 |
Jan
(16) |
Feb
(22) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Thomas M. <tho...@us...> - 2009-07-28 02:39:15
|
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". The branch, core has been updated via c28a3ab485f01bc14615065fe3baf20c2dc62583 (commit) from 4447b8195ca42b3ebb44c6ff6e7163da3d24549a (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 c28a3ab485f01bc14615065fe3baf20c2dc62583 Author: Thomas Moulard <tho...@gm...> Date: Tue Jul 28 11:38:44 2009 +0900 Compute in double precision. * src/numeric-linear-function.cc, * src/numeric-quadratic-function.cc: compute numeric functions in double precision. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 2dcd5ff..df82e52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-07-28 Thomas Moulard <tho...@gm...> + + Compute in double precision. + * src/numeric-linear-function.cc, + * src/numeric-quadratic-function.cc: compute numeric + functions in double precision. + 2009-07-27 Thomas Moulard <tho...@gm...> Update submodules. diff --git a/src/numeric-linear-function.cc b/src/numeric-linear-function.cc index ffa9e7f..0efeca9 100644 --- a/src/numeric-linear-function.cc +++ b/src/numeric-linear-function.cc @@ -46,7 +46,7 @@ namespace roboptim const throw () { using namespace boost::numeric::ublas; - noalias (result) = prod (a_, argument) + b_; + noalias (result) = prec_prod (a_, argument) + b_; } // A diff --git a/src/numeric-quadratic-function.cc b/src/numeric-quadratic-function.cc index fcc5d88..5862d6d 100644 --- a/src/numeric-quadratic-function.cc +++ b/src/numeric-quadratic-function.cc @@ -50,8 +50,8 @@ namespace roboptim using namespace boost::numeric::ublas; result (0) = inner_prod - (prod (trans (argument), a_), argument) / 2 - + inner_prod (trans (b_), argument); + (prec_prod (trans (argument), a_), argument) / 2 + + prec_inner_prod (trans (b_), argument); } // x * A + b @@ -61,7 +61,7 @@ namespace roboptim size_type) const throw () { using namespace boost::numeric::ublas; - noalias (result) = prod (x, a_) + b_; + noalias (result) = prec_prod (x, a_) + b_; } // A ----------------------------------------------------------------------- Summary of changes: ChangeLog | 7 +++++++ src/numeric-linear-function.cc | 2 +- src/numeric-quadratic-function.cc | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-27 12:11:38
|
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". The branch, core-ipopt-plugin has been updated via b2cba9edd264fa810db4e2c6b6f74ff0a184829b (commit) from 30e3d33bb1b890210481cbb5b8203ef71e7fcd54 (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 b2cba9edd264fa810db4e2c6b6f74ff0a184829b Author: Thomas Moulard <tho...@gm...> Date: Mon Jul 27 20:58:20 2009 +0900 Disable gcov support in plug-in. * src/Makefile.am: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 21015af..c989d1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-07-27 Thomas Moulard <tho...@gm...> + + Disable gcov support in plug-in. + * src/Makefile.am: Here. + 2009-07-02 Thomas Moulard <tho...@gm...> Handle submodule and check for git. diff --git a/src/Makefile.am b/src/Makefile.am index 9742e0d..7e227fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,3 +22,8 @@ roboptim_core_ipopt_plugin_la_LIBADD = $(ROBOPTIMCORE_LIBS) roboptim_core_ipopt_plugin_la_LIBADD += $(IPOPT_LIBS) roboptim_core_ipopt_plugin_la_LDFLAGS = -module -version-info 1:1:0 + +# Make sure one does not compile a plug-in with test coverage support as +# it seems to trigger a segv at exit. +roboptim_core_ipopt_plugin_la_CXXFLAGS = \ + `echo $(CXXFLAGS) | sed -e 's/-ftest-coverage//' -e 's/-fprofile-arcs//'` ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ src/Makefile.am | 5 +++++ 2 files changed, 10 insertions(+), 0 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-27 11:47:58
|
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". The branch, core has been updated via 4447b8195ca42b3ebb44c6ff6e7163da3d24549a (commit) from 0ba87dea84267ee96ba1943b1de51845ead37555 (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 4447b8195ca42b3ebb44c6ff6e7163da3d24549a Author: Thomas Moulard <tho...@gm...> Date: Mon Jul 27 20:47:27 2009 +0900 Update submodules. * .gitmodules, * build-aux: Update. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/.gitmodules b/.gitmodules index 55f2f0b..6302c9e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "build-aux"] - path = build-aux - url = sourceforge:roboptim [submodule "doc"] path = doc url = sourceforge:roboptim +[submodule "build-aux"] + path = build-aux + url = sourceforge:roboptim diff --git a/ChangeLog b/ChangeLog index b16df7a..2dcd5ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-07-27 Thomas Moulard <tho...@gm...> + Update submodules. + * .gitmodules, + * build-aux: Update. + +2009-07-27 Thomas Moulard <tho...@gm...> + Do not compile plug-in with gcov support. * src/Makefile.am: Here. diff --git a/build-aux b/build-aux index 53249c7..03ff0bf 160000 --- a/build-aux +++ b/build-aux @@ -1 +1 @@ -Subproject commit 53249c7a39864b963946d8088c421e367c8e6b75 +Subproject commit 03ff0bf047ccf89a5c10b8f304c2770d7f75e017 ----------------------------------------------------------------------- Summary of changes: .gitmodules | 6 +++--- ChangeLog | 6 ++++++ build-aux | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-27 11:43:51
|
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". The branch, build-aux has been updated via 03ff0bf047ccf89a5c10b8f304c2770d7f75e017 (commit) from 53249c7a39864b963946d8088c421e367c8e6b75 (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 03ff0bf047ccf89a5c10b8f304c2770d7f75e017 Author: Thomas Moulard <tho...@gm...> Date: Mon Jul 27 20:43:15 2009 +0900 Beautify Autotest output, capture Valgrind log. * autotest.at: Display what command line has been called and capture ``valgrind.log''. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 843c25f..e132428 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-07-27 Thomas Moulard <tho...@gm...> + + Beautify Autotest output, capture Valgrind log. + * autotest.at: Display what command line has been + called and capture ``valgrind.log''. + 2009-07-01 Thomas Moulard <tho...@gm...> Add Ipopt Autoconf macros. diff --git a/autotest.at b/autotest.at index 75485ee..1d3094d 100644 --- a/autotest.at +++ b/autotest.at @@ -47,8 +47,10 @@ AT_CHECK([if m4_default([$3], [false]); then AT_XFAIL_IF([m4_default([$4], [false])]) cp $abs_srcdir/$1.stdout expout -AT_CHECK([$CHECK_PREFIX `which $1`], [0], [expout], [ignore]) - +TESTCASE=`which $1` +echo "$at_srcdir/AT_LINE: $CHECK_PREFIX $TESTCASE" +AT_CHECK([$CHECK_PREFIX $TESTCASE], [0], [expout], [ignore]) +AT_CAPTURE_FILE ([valgrind.log]) AT_CLEANUP ]) # CHECK_STDOUT ----------------------------------------------------------------------- Summary of changes: ChangeLog | 6 ++++++ autotest.at | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-27 09:45:12
|
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". The branch, core has been updated via 0ba87dea84267ee96ba1943b1de51845ead37555 (commit) via 3054fc40da9082f0d5d92525eabad85dedea3780 (commit) from bbb4b1bec3c2d8f7313770523d51677ca18b3400 (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 0ba87dea84267ee96ba1943b1de51845ead37555 Author: Thomas Moulard <tho...@gm...> Date: Mon Jul 27 18:44:40 2009 +0900 Do not compile plug-in with gcov support. * src/Makefile.am: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 2a4f95a..b16df7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-27 Thomas Moulard <tho...@gm...> + Do not compile plug-in with gcov support. + * src/Makefile.am: Here. + +2009-07-27 Thomas Moulard <tho...@gm...> + Add a dependency toward roboptim-core in dummy plug-in. * src/Makefile.am: Here. diff --git a/src/Makefile.am b/src/Makefile.am index d5feb80..ddab16a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,3 +35,8 @@ lib_LTLIBRARIES += roboptim-core-dummy-plugin.la roboptim_core_dummy_plugin_la_SOURCES = roboptim-core-dummy-plugin.cc roboptim_core_dummy_plugin_la_LIBADD = libroboptim-core.la roboptim_core_dummy_plugin_la_LDFLAGS = -module -version-info 1:1:0 + +# Make sure one does not compile a plug-in with test coverage support as +# it seems to trigger a segv at exit. +roboptim_core_dummy_plugin_la_CXXFLAGS = \ + `echo $(CXXFLAGS) | sed -e 's/-ftest-coverage//' -e 's/-fprofile-arcs//'` commit 3054fc40da9082f0d5d92525eabad85dedea3780 Author: Thomas Moulard <tho...@gm...> Date: Mon Jul 27 18:27:34 2009 +0900 Add a dependency toward roboptim-core in dummy plug-in. * src/Makefile.am: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 26cb25d..2a4f95a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-27 Thomas Moulard <tho...@gm...> + Add a dependency toward roboptim-core in dummy plug-in. + * src/Makefile.am: Here. + +2009-07-27 Thomas Moulard <tho...@gm...> + Make factory more verbose. * include/roboptim/core/solver-factory.hxx: Display error messages if lt_dlclose or lt_dlexit fail. diff --git a/src/Makefile.am b/src/Makefile.am index 86c13dd..d5feb80 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,4 +33,5 @@ libroboptim_core_la_LDFLAGS = -version-info 1:1:0 lib_LTLIBRARIES += roboptim-core-dummy-plugin.la roboptim_core_dummy_plugin_la_SOURCES = roboptim-core-dummy-plugin.cc +roboptim_core_dummy_plugin_la_LIBADD = libroboptim-core.la roboptim_core_dummy_plugin_la_LDFLAGS = -module -version-info 1:1:0 ----------------------------------------------------------------------- Summary of changes: ChangeLog | 10 ++++++++++ src/Makefile.am | 6 ++++++ 2 files changed, 16 insertions(+), 0 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-24 13:29:18
|
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". The branch, trajectory has been updated via 426cebb63345884dff89badfcdc7d9d26bd94d6f (commit) via 7ca45f83a5d086f16300b7ee6e6e78fec7683038 (commit) via 0b99ce1f0d5092feacc0f4727b81680648cb39c5 (commit) via 29990df3dc3a4752224da685b5c098c776045905 (commit) via 43285667e3854afe995f6df305433b35435aba7d (commit) via c07e521ef2ad6609a8d6f227a4da570a9053628f (commit) via 94a362672c05f2cececc582046e5460bc72696d2 (commit) via 68542565dfb6e4b7fc963e9e859ac91c2abb0140 (commit) from e7a5e923e458b43e1a6a42a47511695f76ea4de5 (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 426cebb63345884dff89badfcdc7d9d26bd94d6f Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 22:28:38 2009 +0900 Enhance time optimization. * include/roboptim/trajectory/free-time-trajectory.hxx: Set scale to 0 when one try to insert a negative scale. * tests/spline-optimization.stdout: Regenerate. * tests/spline-time-optimization.cc: Better display, handle any number of control points. * tests/spline-time-optimization.stdout: Regenerate. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index d7f2807..fcc0088 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2009-07-24 Thomas Moulard <tho...@gm...> + Enhance time optimization. + * include/roboptim/trajectory/free-time-trajectory.hxx: + Set scale to 0 when one try to insert a negative scale. + * tests/spline-optimization.stdout: Regenerate. + * tests/spline-time-optimization.cc: Better display, handle + any number of control points. + * tests/spline-time-optimization.stdout: Regenerate. + +2009-07-24 Thomas Moulard <tho...@gm...> + Fix vMax display in plot_limitSpeed. * include/roboptim/trajectory/visualization/limit-speed.hh: Fix vMax display. diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index 0da3ba4..99d8ee3 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -156,11 +156,14 @@ namespace roboptim void FreeTimeTrajectory<dorder>::setParameters (const vector_t& p) throw () { - assert (p[0] > 0.); + //FIXME: is this ok? + vector_t p_ = p; + if (p_[0] <= 0.) + p_[0] = 1e-8; - this->parameters_ = p; + this->parameters_ = p_; this->timeRange_ = detail::scaleInterval (*trajectory_, this->timeScale ()); - this->trajectory_->setParameters (removeScaleFromParameters (p)); + this->trajectory_->setParameters (removeScaleFromParameters (p_)); } template <unsigned dorder> diff --git a/tests/spline-optimization.stdout b/tests/spline-optimization.stdout index 4e6ef69..acaf55d 100644 --- a/tests/spline-optimization.stdout +++ b/tests/spline-optimization.stdout @@ -425,405 +425,405 @@ e plot '-' title 'after' with line -0.000000 -0.000000 -0.000011 0.000011 -0.000086 0.000086 -0.000290 0.000290 -0.000686 0.000686 -0.001340 0.001340 -0.002316 0.002316 -0.003678 0.003678 -0.005490 0.005490 -0.007817 0.007817 -0.010723 0.010723 -0.014272 0.014272 -0.018529 0.018529 -0.023559 0.023559 -0.029424 0.029424 -0.036190 0.036190 -0.043922 0.043922 -0.052682 0.052682 -0.062537 0.062537 -0.073549 0.073549 -0.085784 0.085784 -0.099306 0.099306 -0.114179 0.114179 -0.130467 0.130467 -0.148235 0.148235 -0.167547 0.167547 -0.188468 0.188468 -0.211062 0.211062 -0.235392 0.235392 -0.261524 0.261524 -0.289522 0.289522 -0.319450 0.319450 -0.351373 0.351373 -0.385354 0.385354 -0.421458 0.421458 -0.459750 0.459750 -0.500294 0.500294 -0.543154 0.543154 -0.588395 0.588395 -0.636080 0.636080 -0.686275 0.686275 -0.739043 0.739043 -0.794449 0.794449 -0.852557 0.852557 -0.913431 0.913431 -0.977137 0.977137 -1.043738 1.043738 -1.113298 1.113298 -1.185882 1.185882 -1.261555 1.261555 -1.340380 1.340380 -1.422422 1.422422 -1.507745 1.507745 -1.596414 1.596414 -1.688493 1.688493 -1.784046 1.784046 -1.883137 1.883137 -1.985832 1.985832 -2.092194 2.092194 -2.202287 2.202287 -2.316176 2.316176 -2.433926 2.433926 -2.555600 2.555600 -2.681264 2.681264 -2.810980 2.810980 -2.944815 2.944815 -3.082831 3.082831 -3.225093 3.225093 -3.371667 3.371667 -3.522615 3.522615 -3.678002 3.678002 -3.837894 3.837894 -4.002353 4.002353 -4.171445 4.171445 -4.345233 4.345233 -4.523782 4.523782 -4.707157 4.707157 -4.895421 4.895421 -5.088640 5.088640 -5.286877 5.286877 -5.490196 5.490196 -5.698642 5.698642 -5.912172 5.912172 -6.130726 6.130726 -6.354240 6.354240 -6.582654 6.582654 -6.815904 6.815904 -7.053929 7.053929 -7.296667 7.296667 -7.544055 7.544055 -7.796032 7.796032 -8.052536 8.052536 -8.313505 8.313505 -8.578876 8.578876 -8.848588 8.848588 -9.122578 9.122578 -9.400784 9.400784 -9.683145 9.683145 -9.969599 9.969599 -10.260082 10.260082 -10.554534 10.554534 -10.852893 10.852893 -11.155095 11.155095 -11.461080 11.461080 -11.770784 11.770784 -12.084147 12.084147 -12.401106 12.401106 -12.721599 12.721599 -13.045564 13.045564 -13.372938 13.372938 -13.703661 13.703661 -14.037670 14.037670 -14.374902 14.374902 -14.715296 14.715296 -15.058790 15.058790 -15.405321 15.405321 -15.754828 15.754828 -16.107249 16.107249 -16.462521 16.462521 -16.820583 16.820583 -17.181373 17.181373 -17.544827 17.544827 -17.910885 17.910885 -18.279485 18.279485 -18.650564 18.650564 -19.024060 19.024060 -19.399911 19.399911 -19.778056 19.778056 -20.158431 20.158431 -20.540976 20.540976 -20.925628 20.925628 -21.312325 21.312325 -21.701005 21.701005 -22.091606 22.091606 -22.484066 22.484066 -22.878322 22.878322 -23.274314 23.274314 -23.671978 23.671978 -24.071253 24.071253 -24.472077 24.472077 -24.874387 24.874387 -25.278122 25.278122 -25.683220 25.683220 -26.089618 26.089618 -26.497255 26.497255 -26.906068 26.906068 -27.315996 27.315996 -27.726976 27.726976 -28.138946 28.138946 -28.551845 28.551845 -28.965610 28.965610 -29.380179 29.380179 -29.795490 29.795490 -30.211482 30.211482 -30.628091 30.628091 -31.045257 31.045257 -31.462917 31.462917 -31.881008 31.881008 -32.299470 32.299470 -32.718240 32.718240 -33.137255 33.137255 -33.556464 33.556464 -33.975852 33.975852 -34.395414 34.395414 -34.815147 34.815147 -35.235045 35.235045 -35.655104 35.655104 -36.075319 36.075319 -36.495686 36.495686 -36.916200 36.916200 -37.336857 37.336857 -37.757651 37.757651 -38.178578 38.178578 -38.599635 38.599635 -39.020815 39.020815 -39.442115 39.442115 -39.863529 39.863529 -40.285054 40.285054 -40.706685 40.706685 -41.128417 41.128417 -41.550245 41.550245 -41.972165 41.972165 -42.394173 42.394173 -42.816263 42.816263 -43.238431 43.238431 -43.660673 43.660673 -44.082984 44.082984 -44.505359 44.505359 -44.927794 44.927794 -45.350284 45.350284 -45.772825 45.772825 -46.195411 46.195411 -46.618039 46.618039 -47.040704 47.040704 -47.463401 47.463401 -47.886125 47.886125 -48.308873 48.308873 -48.731638 48.731638 -49.154418 49.154418 -49.577207 49.577207 +0.000013 0.000013 +0.000107 0.000107 +0.000362 0.000362 +0.000859 0.000859 +0.001678 0.001678 +0.002899 0.002899 +0.004604 0.004604 +0.006873 0.006873 +0.009786 0.009786 +0.013423 0.013423 +0.017866 0.017866 +0.023195 0.023195 +0.029491 0.029491 +0.036833 0.036833 +0.045303 0.045303 +0.054981 0.054981 +0.065948 0.065948 +0.078284 0.078284 +0.092070 0.092070 +0.107386 0.107386 +0.124312 0.124312 +0.142930 0.142930 +0.163320 0.163320 +0.185562 0.185562 +0.209738 0.209738 +0.235926 0.235926 +0.264209 0.264209 +0.294666 0.294666 +0.327379 0.327379 +0.362427 0.362427 +0.399891 0.399891 +0.439852 0.439852 +0.482390 0.482390 +0.527586 0.527586 +0.575520 0.575520 +0.626273 0.626273 +0.679926 0.679926 +0.736558 0.736558 +0.796251 0.796251 +0.859085 0.859085 +0.925141 0.925141 +0.994499 0.994499 +1.067239 1.067239 +1.143443 1.143443 +1.223190 1.223190 +1.306561 1.306561 +1.393638 1.393638 +1.484499 1.484499 +1.579227 1.579227 +1.677901 1.677901 +1.780602 1.780602 +1.887410 1.887410 +1.998407 1.998407 +2.113672 2.113672 +2.233286 2.233286 +2.357330 2.357330 +2.485884 2.485884 +2.619029 2.619029 +2.756845 2.756845 +2.899413 2.899413 +3.046813 3.046813 +3.199126 3.199126 +3.356433 3.356433 +3.518813 3.518813 +3.686348 3.686348 +3.859119 3.859119 +4.037204 4.037204 +4.220686 4.220686 +4.409645 4.409645 +4.604160 4.604160 +4.804314 4.804314 +5.010185 5.010185 +5.221856 5.221856 +5.439406 5.439406 +5.662916 5.662916 +5.892466 5.892466 +6.128137 6.128137 +6.370010 6.370010 +6.618165 6.618165 +6.872682 6.872682 +7.133608 7.133608 +7.400851 7.400851 +7.674282 7.674282 +7.953777 7.953777 +8.239207 8.239207 +8.530446 8.530446 +8.827367 8.827367 +9.129843 9.129843 +9.437748 9.437748 +9.750954 9.750954 +10.069335 10.069335 +10.392764 10.392764 +10.721114 10.721114 +11.054258 11.054258 +11.392069 11.392069 +11.734421 11.734421 +12.081186 12.081186 +12.432239 12.432239 +12.787451 12.787451 +13.146696 13.146696 +13.509847 13.509847 +13.876778 13.876778 +14.247362 14.247362 +14.621471 14.621471 +14.998979 14.998979 +15.379759 15.379759 +15.763684 15.763684 +16.150628 16.150628 +16.540463 16.540463 +16.933063 16.933063 +17.328300 17.328300 +17.726049 17.726049 +18.126181 18.126181 +18.528571 18.528571 +18.933091 18.933091 +19.339615 19.339615 +19.748016 19.748016 +20.158166 20.158166 +20.569940 20.569940 +20.983210 20.983210 +21.397849 21.397849 +21.813730 21.813730 +22.230728 22.230728 +22.648714 22.648714 +23.067562 23.067562 +23.487145 23.487145 +23.907337 23.907337 +24.328010 24.328010 +24.749037 24.749037 +25.170293 25.170293 +25.591649 25.591649 +26.012979 26.012979 +26.434157 26.434157 +26.855055 26.855055 +27.275547 27.275547 +27.695505 27.695505 +28.114803 28.114803 +28.533314 28.533314 +28.950911 28.950911 +29.367468 29.367468 +29.782857 29.782857 +30.196951 30.196951 +30.609625 30.609625 +31.020750 31.020750 +31.430200 31.430200 +31.837849 31.837849 +32.243569 32.243569 +32.647234 32.647234 +33.048716 33.048716 +33.447889 33.447889 +33.844627 33.844627 +34.238801 34.238801 +34.630286 34.630286 +35.018954 35.018954 +35.404679 35.404679 +35.787334 35.787334 +36.166791 36.166791 +36.542925 36.542925 +36.915608 36.915608 +37.284714 37.284714 +37.650151 37.650151 +38.011977 38.011977 +38.370284 38.370284 +38.725164 38.725164 +39.076710 39.076710 +39.425015 39.425015 +39.770170 39.770170 +40.112270 40.112270 +40.451407 40.451407 +40.787672 40.787672 +41.121159 41.121159 +41.451960 41.451960 +41.780168 41.780168 +42.105876 42.105876 +42.429176 42.429176 +42.750161 42.750161 +43.068923 43.068923 +43.385555 43.385555 +43.700149 43.700149 +44.012799 44.012799 +44.323596 44.323596 +44.632634 44.632634 +44.940005 44.940005 +45.245801 45.245801 +45.550116 45.550116 +45.853042 45.853042 +46.154671 46.154671 +46.455096 46.455096 +46.754410 46.754410 +47.052705 47.052705 +47.350074 47.350074 +47.646609 47.646609 +47.942404 47.942404 +48.237550 48.237550 +48.532140 48.532140 +48.826268 48.826268 +49.120025 49.120025 +49.413504 49.413504 +49.706799 49.706799 50.000000 50.000000 -50.422793 50.422793 -50.845582 50.845582 -51.268362 51.268362 -51.691127 51.691127 -52.113875 52.113875 -52.536599 52.536599 -52.959296 52.959296 -53.381961 53.381961 -53.804589 53.804589 -54.227175 54.227175 -54.649716 54.649716 -55.072206 55.072206 -55.494641 55.494641 -55.917016 55.917016 -56.339327 56.339327 -56.761569 56.761569 -57.183737 57.183737 -57.605827 57.605827 -58.027835 58.027835 -58.449755 58.449755 -58.871583 58.871583 -59.293315 59.293315 -59.714946 59.714946 -60.136471 60.136471 -60.557885 60.557885 -60.979185 60.979185 -61.400365 61.400365 -61.821422 61.821422 -62.242349 62.242349 -62.663143 62.663143 -63.083800 63.083800 -63.504314 63.504314 -63.924681 63.924681 -64.344896 64.344896 -64.764955 64.764955 -65.184853 65.184853 -65.604586 65.604586 -66.024148 66.024148 -66.443536 66.443536 -66.862745 66.862745 -67.281760 67.281760 -67.700530 67.700530 -68.118992 68.118992 -68.537083 68.537083 -68.954743 68.954743 -69.371909 69.371909 -69.788518 69.788518 -70.204510 70.204510 -70.619821 70.619821 -71.034390 71.034390 -71.448155 71.448155 -71.861054 71.861054 -72.273024 72.273024 -72.684004 72.684004 -73.093932 73.093932 -73.502745 73.502745 -73.910382 73.910382 -74.316780 74.316780 -74.721878 74.721878 -75.125613 75.125613 -75.527923 75.527923 -75.928747 75.928747 -76.328022 76.328022 -76.725686 76.725686 -77.121678 77.121678 -77.515934 77.515934 -77.908394 77.908394 -78.298995 78.298995 -78.687675 78.687675 -79.074372 79.074372 -79.459024 79.459024 -79.841569 79.841569 -80.221944 80.221944 -80.600089 80.600089 -80.975940 80.975940 -81.349436 81.349436 -81.720515 81.720515 -82.089115 82.089115 -82.455173 82.455173 -82.818627 82.818627 -83.179417 83.179417 -83.537479 83.537479 -83.892751 83.892751 -84.245172 84.245172 -84.594679 84.594679 -84.941210 84.941210 -85.284704 85.284704 -85.625098 85.625098 -85.962330 85.962330 -86.296339 86.296339 -86.627062 86.627062 -86.954436 86.954436 -87.278401 87.278401 -87.598894 87.598894 -87.915853 87.915853 -88.229216 88.229216 -88.538920 88.538920 -88.844905 88.844905 -89.147107 89.147107 -89.445466 89.445466 -89.739918 89.739918 -90.030401 90.030401 -90.316855 90.316855 -90.599216 90.599216 -90.877422 90.877422 -91.151412 91.151412 -91.421124 91.421124 -91.686495 91.686495 -91.947464 91.947464 -92.203968 92.203968 -92.455945 92.455945 -92.703333 92.703333 -92.946071 92.946071 -93.184096 93.184096 -93.417346 93.417346 -93.645760 93.645760 -93.869274 93.869274 -94.087828 94.087828 -94.301358 94.301358 -94.509804 94.509804 -94.713123 94.713123 -94.911360 94.911360 -95.104579 95.104579 -95.292843 95.292843 -95.476218 95.476218 -95.654767 95.654767 -95.828555 95.828555 -95.997647 95.997647 -96.162106 96.162106 -96.321998 96.321998 -96.477385 96.477385 -96.628333 96.628333 -96.774907 96.774907 -96.917169 96.917169 -97.055185 97.055185 -97.189020 97.189020 -97.318736 97.318736 -97.444400 97.444400 -97.566074 97.566074 -97.683824 97.683824 -97.797713 97.797713 -97.907806 97.907806 -98.014168 98.014168 -98.116863 98.116863 -98.215954 98.215954 -98.311507 98.311507 -98.403586 98.403586 -98.492255 98.492255 -98.577578 98.577578 -98.659620 98.659620 -98.738445 98.738445 -98.814118 98.814118 -98.886702 98.886702 -98.956262 98.956262 -99.022863 99.022863 -99.086569 99.086569 -99.147443 99.147443 -99.205551 99.205551 -99.260957 99.260957 -99.313725 99.313725 -99.363920 99.363920 -99.411605 99.411605 -99.456846 99.456846 -99.499706 99.499706 -99.540250 99.540250 -99.578542 99.578542 -99.614646 99.614646 -99.648627 99.648627 -99.680550 99.680550 -99.710478 99.710478 -99.738476 99.738476 -99.764608 99.764608 -99.788938 99.788938 -99.811532 99.811532 -99.832453 99.832453 -99.851765 99.851765 -99.869533 99.869533 -99.885821 99.885821 -99.900694 99.900694 -99.914216 99.914216 -99.926451 99.926451 -99.937463 99.937463 -99.947318 99.947318 -99.956078 99.956078 -99.963810 99.963810 -99.970576 99.970576 -99.976441 99.976441 -99.981471 99.981471 -99.985728 99.985728 -99.989277 99.989277 -99.992183 99.992183 -99.994510 99.994510 -99.996322 99.996322 -99.997684 99.997684 -99.998660 99.998660 -99.999314 99.999314 -99.999710 99.999710 -99.999914 99.999914 -99.999989 99.999989 +50.293201 50.293201 +50.586496 50.586496 +50.879975 50.879975 +51.173732 51.173732 +51.467860 51.467860 +51.762450 51.762450 +52.057596 52.057596 +52.353391 52.353391 +52.649926 52.649926 +52.947295 52.947295 +53.245590 53.245590 +53.544904 53.544904 +53.845329 53.845329 +54.146958 54.146958 +54.449884 54.449884 +54.754199 54.754199 +55.059995 55.059995 +55.367366 55.367366 +55.676404 55.676404 +55.987201 55.987201 +56.299851 56.299851 +56.614445 56.614445 +56.931077 56.931077 +57.249839 57.249839 +57.570824 57.570824 +57.894124 57.894124 +58.219832 58.219832 +58.548040 58.548040 +58.878841 58.878841 +59.212328 59.212328 +59.548593 59.548593 +59.887730 59.887730 +60.229829 60.229830 +60.574985 60.574985 +60.923290 60.923290 +61.274836 61.274836 +61.629716 61.629716 +61.988023 61.988023 +62.349849 62.349849 +62.715286 62.715286 +63.084392 63.084392 +63.457075 63.457075 +63.833209 63.833209 +64.212666 64.212666 +64.595321 64.595321 +64.981046 64.981046 +65.369714 65.369714 +65.761199 65.761199 +66.155373 66.155373 +66.552111 66.552111 +66.951284 66.951284 +67.352766 67.352766 +67.756431 67.756431 +68.162151 68.162151 +68.569800 68.569800 +68.979250 68.979250 +69.390375 69.390375 +69.803049 69.803049 +70.217143 70.217143 +70.632532 70.632532 +71.049089 71.049089 +71.466686 71.466686 +71.885197 71.885197 +72.304495 72.304495 +72.724453 72.724453 +73.144945 73.144945 +73.565843 73.565843 +73.987020 73.987021 +74.408351 74.408351 +74.829707 74.829707 +75.250962 75.250963 +75.671990 75.671990 +76.092663 76.092663 +76.512855 76.512855 +76.932438 76.932438 +77.351286 77.351286 +77.769272 77.769272 +78.186270 78.186270 +78.602151 78.602151 +79.016790 79.016790 +79.430060 79.430060 +79.841834 79.841834 +80.251984 80.251984 +80.660385 80.660385 +81.066909 81.066909 +81.471429 81.471429 +81.873819 81.873819 +82.273951 82.273951 +82.671700 82.671700 +83.066937 83.066937 +83.459537 83.459537 +83.849372 83.849372 +84.236316 84.236316 +84.620241 84.620241 +85.001021 85.001021 +85.378529 85.378529 +85.752638 85.752638 +86.123222 86.123222 +86.490153 86.490153 +86.853304 86.853304 +87.212549 87.212549 +87.567761 87.567761 +87.918814 87.918814 +88.265579 88.265579 +88.607931 88.607931 +88.945742 88.945742 +89.278886 89.278886 +89.607236 89.607236 +89.930665 89.930665 +90.249046 90.249046 +90.562252 90.562252 +90.870157 90.870157 +91.172633 91.172633 +91.469554 91.469554 +91.760793 91.760793 +92.046223 92.046223 +92.325718 92.325718 +92.599149 92.599149 +92.866392 92.866392 +93.127318 93.127318 +93.381835 93.381835 +93.629990 93.629990 +93.871863 93.871863 +94.107534 94.107534 +94.337084 94.337084 +94.560594 94.560594 +94.778144 94.778144 +94.989815 94.989815 +95.195686 95.195686 +95.395840 95.395840 +95.590355 95.590355 +95.779314 95.779314 +95.962796 95.962796 +96.140881 96.140881 +96.313652 96.313652 +96.481187 96.481187 +96.643567 96.643567 +96.800874 96.800874 +96.953187 96.953187 +97.100587 97.100587 +97.243155 97.243155 +97.380971 97.380971 +97.514116 97.514116 +97.642670 97.642670 +97.766714 97.766714 +97.886328 97.886328 +98.001593 98.001593 +98.112590 98.112590 +98.219398 98.219398 +98.322099 98.322099 +98.420773 98.420773 +98.515501 98.515501 +98.606362 98.606362 +98.693439 98.693439 +98.776810 98.776810 +98.856557 98.856557 +98.932761 98.932761 +99.005501 99.005501 +99.074859 99.074859 +99.140915 99.140915 +99.203749 99.203749 +99.263442 99.263442 +99.320074 99.320074 +99.373727 99.373727 +99.424480 99.424480 +99.472414 99.472414 +99.517610 99.517610 +99.560148 99.560148 +99.600109 99.600109 +99.637573 99.637573 +99.672621 99.672621 +99.705334 99.705334 +99.735791 99.735791 +99.764074 99.764074 +99.790262 99.790262 +99.814438 99.814438 +99.836680 99.836680 +99.857070 99.857070 +99.875688 99.875688 +99.892614 99.892614 +99.907930 99.907930 +99.921716 99.921716 +99.934052 99.934052 +99.945019 99.945019 +99.954697 99.954697 +99.963167 99.963167 +99.970509 99.970509 +99.976805 99.976805 +99.982134 99.982134 +99.986577 99.986577 +99.990214 99.990214 +99.993127 99.993127 +99.995396 99.995396 +99.997101 99.997101 +99.998322 99.998322 +99.999141 99.999141 +99.999638 99.999638 +99.999893 99.999893 +99.999987 99.999987 100.000000 100.000000 e diff --git a/tests/spline-time-optimization.cc b/tests/spline-time-optimization.cc index 0eff8cc..0288873 100644 --- a/tests/spline-time-optimization.cc +++ b/tests/spline-time-optimization.cc @@ -47,26 +47,28 @@ using namespace roboptim::visualization::gnuplot; typedef boost::mpl::vector<DerivableFunction, LinearFunction> constraint_t; typedef Solver<DerivableFunction, constraint_t> solver_t; +typedef FreeTimeTrajectory<Spline::derivabilityOrder> freeTime_t; + + +// Problem parameters. +const unsigned nControlPoints = 26; +const double vMax = 125.; int run_test () { using namespace boost; using namespace boost::assign; - Spline::vector_t params (4); - // Initial position. - params[0] = 0.; - // Control point 1. - params[1] = 25.; - // Control point 2. - params[2] = 75.; - // Final position. - params[3] = 100.; + const double finalPos = 200.; + Spline::vector_t params (nControlPoints); + + for (unsigned i = 0; i < nControlPoints; ++i) + params[i] = finalPos / (nControlPoints - 1) * i; // Make trajectories. Spline::interval_t timeRange = Spline::makeInterval (0., 4.); Spline spline (timeRange, 1, params, "before"); - FreeTimeTrajectory<Spline::derivabilityOrder> freeTimeTraj (spline, 1.); + freeTime_t freeTimeTraj (spline, 1.); // Define cost. Function::matrix_t a (1, freeTimeTraj.parameters ().size ()); @@ -85,34 +87,41 @@ int run_test () Function::matrix_t a (1, problem.function ().inputSize ()); Function::vector_t b (1); a.clear (), b.clear (); - a(0, 0) = 1.; + a (0, 0) = 1.; shared_ptr<NumericLinearFunction> speedPositivity (new NumericLinearFunction (a, b)); problem.addConstraint - (static_pointer_cast<DerivableFunction> (speedPositivity), - Function::makeLowerInterval (0.)); + (static_pointer_cast<LinearFunction> (speedPositivity), + Function::makeLowerInterval (1e-3)); } + const freeTime_t::vector_t freeTimeParams = freeTimeTraj.parameters (); + const unsigned freeTimeParamsSize = freeTimeParams.size (); - typedef Freeze<DerivableFunction, constraint_t, LinearFunction> freeze_t; + typedef Freeze<DerivableFunction, constraint_t, DerivableFunction> freeze_t; freeze_t freeze (problem, list_of <freeze_t::frozenArgument_t> - (1, params[0]) - (params.size (), params[params.size () - 1])); + (1, freeTimeParams[1]) + (freeTimeParamsSize - 1, + freeTimeParams[freeTimeParamsSize - 1])); freeze (); + Function::interval_t vRange (0., 2 * vMax * vMax); + LimitSpeed<FreeTimeTrajectory<Spline::derivabilityOrder> >::addToProblem + (freeTimeTraj, problem, vRange, nControlPoints * 10); - Function::interval_t vRange (0., 100.); - LimitSpeed<FreeTimeTrajectory<Spline::derivabilityOrder> >::addToProblem (freeTimeTraj, problem, vRange, 10); + std::ofstream limitSpeedStream ("limit-speed.gp"); + Gnuplot gnuplot = Gnuplot::make_interactive_gnuplot (); - SolverFactory<solver_t> factory ("cfsqp", problem); - solver_t& solver = factory (); + gnuplot + << set ("multiplot layout 1,2 title " + "'variation of speed before and after optimization'") + << set ("grid"); + gnuplot << plot_limitSpeed (freeTimeTraj, vMax); - std::cout << "Cost function (before): " << cost (freeTimeTraj.parameters ()) - << std::endl - << "Parameters (before): " << freeTimeTraj.parameters () - << std::endl; + SolverFactory<solver_t> factory ("cfsqp", problem); + solver_t& solver = factory (); std::cout << solver << std::endl; @@ -126,12 +135,8 @@ int run_test () FreeTimeTrajectory<Spline::derivabilityOrder> optimizedTrajectory = freeTimeTraj; optimizedTrajectory.setParameters (result.x); - std::cout << "Parameters (after): " << optimizedTrajectory.parameters () - << std::endl; - std::ofstream limitSpeedStream ("limit-speed.gp"); - limitSpeedStream - << (Gnuplot::make_interactive_gnuplot () - << plot_limitSpeed (optimizedTrajectory)); + std::cout << result << std::endl; + gnuplot << plot_limitSpeed (optimizedTrajectory, vMax); break; } @@ -147,12 +152,7 @@ int run_test () freeTimeTraj; optimizedTrajectory.setParameters (result.x); std::cout << result << std::endl; - std::cout << "Parameters (after): " << optimizedTrajectory.parameters () - << std::endl; - std::ofstream limitSpeedStream ("limit-speed.gp"); - limitSpeedStream - << (Gnuplot::make_interactive_gnuplot () - << plot_limitSpeed (optimizedTrajectory)); + gnuplot << plot_limitSpeed (optimizedTrajectory, vMax); break; } @@ -163,7 +163,7 @@ int run_test () return 1; } } - + limitSpeedStream << (gnuplot << unset ("multiplot")); return 0; } diff --git a/tests/spline-time-optimization.stdout b/tests/spline-time-optimization.stdout index 1925e7f..9967d16 100644 --- a/tests/spline-time-optimization.stdout +++ b/tests/spline-time-optimization.stdout @@ -1,23 +1,21 @@ -Cost function (before): [1](1) -Parameters (before): [5](1,0,25,75,100) Problem: Numeric linear function - A = [1,5]((1,0,0,0,0)) + A = [1,27]((1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)) B = [1](0) - Argument's bounds: (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf) - Argument's scales: 1, 1, 1, 1, 1 - Number of constraints: 14 + Argument's bounds: (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf) + Argument's scales: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + Number of constraints: 264 Constraint 0 Numeric linear function - A = [1,5]((1,0,0,0,0)) + A = [1,27]((1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)) B = [1](0) - Bounds: (0, inf) + Bounds: (0.001, inf) Scales: 1 Initial value: [1](1) Constraint 1 Numeric linear function - A = [1,5]((0,1,0,0,0)) + A = [1,27]((0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)) B = [1](-0) Bounds: (0, 0) Scales: 1 @@ -25,86 +23,1586 @@ Problem: Constraint 2 Numeric linear function - A = [1,5]((0,0,0,0,1)) - B = [1](-100) + A = [1,27]((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1)) + B = [1](-200) Bounds: (0, 0) Scales: 1 Initial value: [1](0) Constraint 3 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0) (derivable function) + Bounds: (0, 31250) Scales: 1 Initial value: [1](0) Constraint 4 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.00384615) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](3.90625) + Initial value: [1](0.0423896) Constraint 5 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.00769231) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](15.625) + Initial value: [1](0.678233) Constraint 6 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.0115385) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](31.25) + Initial value: [1](3.43356) Constraint 7 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.0153846) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](46.875) + Initial value: [1](10.8517) Constraint 8 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.0192308) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](54.6875) + Initial value: [1](26.4935) Constraint 9 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.0230769) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](46.875) + Initial value: [1](54.9369) Constraint 10 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.0269231) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](31.25) + Initial value: [1](101.777) Constraint 11 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.0307692) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](15.625) + Initial value: [1](173.628) Constraint 12 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.0346154) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](3.90625) + Initial value: [1](278.118) Constraint 13 - limit speed (derivable function) - Bounds: (0, 100) + speed limit (0.0384615) (derivable function) + Bounds: (0, 31250) Scales: 1 - Initial value: [1](4.82947e-15) + Initial value: [1](421.573) - Starting point: [5](1,0,25,75,100) + Constraint 14 + speed limit (0.0423077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](582.696) + + Constraint 15 + speed limit (0.0461538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](747.156) + + Constraint 16 + speed limit (0.05) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](907.061) + + Constraint 17 + speed limit (0.0538462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1055.53) + + Constraint 18 + speed limit (0.0576923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1186.71) + + Constraint 19 + speed limit (0.0615385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1295.76) + + Constraint 20 + speed limit (0.0653846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1378.85) + + Constraint 21 + speed limit (0.0692308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1433.17) + + Constraint 22 + speed limit (0.0730769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1456.94) + + Constraint 23 + speed limit (0.0769231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 24 + speed limit (0.0807692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 25 + speed limit (0.0846154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 26 + speed limit (0.0884615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 27 + speed limit (0.0923077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 28 + speed limit (0.0961538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 29 + speed limit (0.1) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 30 + speed limit (0.103846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 31 + speed limit (0.107692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 32 + speed limit (0.111538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 33 + speed limit (0.115385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 34 + speed limit (0.119231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 35 + speed limit (0.123077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 36 + speed limit (0.126923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 37 + speed limit (0.130769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 38 + speed limit (0.134615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 39 + speed limit (0.138462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 40 + speed limit (0.142308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 41 + speed limit (0.146154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 42 + speed limit (0.15) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 43 + speed limit (0.153846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 44 + speed limit (0.157692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 45 + speed limit (0.161538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 46 + speed limit (0.165385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 47 + speed limit (0.169231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 48 + speed limit (0.173077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 49 + speed limit (0.176923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 50 + speed limit (0.180769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 51 + speed limit (0.184615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 52 + speed limit (0.188462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 53 + speed limit (0.192308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 54 + speed limit (0.196154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 55 + speed limit (0.2) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 56 + speed limit (0.203846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 57 + speed limit (0.207692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 58 + speed limit (0.211538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 59 + speed limit (0.215385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 60 + speed limit (0.219231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 61 + speed limit (0.223077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 62 + speed limit (0.226923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 63 + speed limit (0.230769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 64 + speed limit (0.234615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 65 + speed limit (0.238462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 66 + speed limit (0.242308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 67 + speed limit (0.246154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 68 + speed limit (0.25) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 69 + speed limit (0.253846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 70 + speed limit (0.257692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 71 + speed limit (0.261538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 72 + speed limit (0.265385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 73 + speed limit (0.269231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 74 + speed limit (0.273077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 75 + speed limit (0.276923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 76 + speed limit (0.280769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 77 + speed limit (0.284615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 78 + speed limit (0.288462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 79 + speed limit (0.292308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 80 + speed limit (0.296154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 81 + speed limit (0.3) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 82 + speed limit (0.303846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 83 + speed limit (0.307692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 84 + speed limit (0.311538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 85 + speed limit (0.315385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 86 + speed limit (0.319231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 87 + speed limit (0.323077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 88 + speed limit (0.326923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 89 + speed limit (0.330769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 90 + speed limit (0.334615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 91 + speed limit (0.338462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 92 + speed limit (0.342308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 93 + speed limit (0.346154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 94 + speed limit (0.35) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 95 + speed limit (0.353846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 96 + speed limit (0.357692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 97 + speed limit (0.361538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 98 + speed limit (0.365385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 99 + speed limit (0.369231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 100 + speed limit (0.373077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 101 + speed limit (0.376923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 102 + speed limit (0.380769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 103 + speed limit (0.384615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 104 + speed limit (0.388462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 105 + speed limit (0.392308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 106 + speed limit (0.396154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 107 + speed limit (0.4) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 108 + speed limit (0.403846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 109 + speed limit (0.407692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 110 + speed limit (0.411538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 111 + speed limit (0.415385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 112 + speed limit (0.419231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 113 + speed limit (0.423077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 114 + speed limit (0.426923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 115 + speed limit (0.430769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 116 + speed limit (0.434615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 117 + speed limit (0.438462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 118 + speed limit (0.442308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 119 + speed limit (0.446154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 120 + speed limit (0.45) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 121 + speed limit (0.453846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 122 + speed limit (0.457692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 123 + speed limit (0.461538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 124 + speed limit (0.465385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 125 + speed limit (0.469231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 126 + speed limit (0.473077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 127 + speed limit (0.476923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 128 + speed limit (0.480769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 129 + speed limit (0.484615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 130 + speed limit (0.488462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 131 + speed limit (0.492308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 132 + speed limit (0.496154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 133 + speed limit (0.5) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 134 + speed limit (0.503846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 135 + speed limit (0.507692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 136 + speed limit (0.511538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 137 + speed limit (0.515385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 138 + speed limit (0.519231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 139 + speed limit (0.523077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 140 + speed limit (0.526923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 141 + speed limit (0.530769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 142 + speed limit (0.534615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 143 + speed limit (0.538462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 144 + speed limit (0.542308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 145 + speed limit (0.546154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 146 + speed limit (0.55) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 147 + speed limit (0.553846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 148 + speed limit (0.557692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 149 + speed limit (0.561538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 150 + speed limit (0.565385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 151 + speed limit (0.569231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 152 + speed limit (0.573077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 153 + speed limit (0.576923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 154 + speed limit (0.580769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 155 + speed limit (0.584615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 156 + speed limit (0.588462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 157 + speed limit (0.592308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 158 + speed limit (0.596154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 159 + speed limit (0.6) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 160 + speed limit (0.603846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 161 + speed limit (0.607692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 162 + speed limit (0.611538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 163 + speed limit (0.615385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 164 + speed limit (0.619231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 165 + speed limit (0.623077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 166 + speed limit (0.626923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 167 + speed limit (0.630769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 168 + speed limit (0.634615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 169 + speed limit (0.638462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 170 + speed limit (0.642308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 171 + speed limit (0.646154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 172 + speed limit (0.65) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 173 + speed limit (0.653846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 174 + speed limit (0.657692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 175 + speed limit (0.661538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 176 + speed limit (0.665385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 177 + speed limit (0.669231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 178 + speed limit (0.673077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 179 + speed limit (0.676923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 180 + speed limit (0.680769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 181 + speed limit (0.684615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 182 + speed limit (0.688462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 183 + speed limit (0.692308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 184 + speed limit (0.696154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 185 + speed limit (0.7) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 186 + speed limit (0.703846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 187 + speed limit (0.707692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 188 + speed limit (0.711538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 189 + speed limit (0.715385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 190 + speed limit (0.719231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 191 + speed limit (0.723077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 192 + speed limit (0.726923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 193 + speed limit (0.730769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 194 + speed limit (0.734615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 195 + speed limit (0.738462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 196 + speed limit (0.742308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 197 + speed limit (0.746154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 198 + speed limit (0.75) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 199 + speed limit (0.753846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 200 + speed limit (0.757692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 201 + speed limit (0.761538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 202 + speed limit (0.765385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 203 + speed limit (0.769231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 204 + speed limit (0.773077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 205 + speed limit (0.776923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 206 + speed limit (0.780769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 207 + speed limit (0.784615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 208 + speed limit (0.788462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 209 + speed limit (0.792308) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 210 + speed limit (0.796154) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 211 + speed limit (0.8) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 212 + speed limit (0.803846) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 213 + speed limit (0.807692) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 214 + speed limit (0.811538) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 215 + speed limit (0.815385) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 216 + speed limit (0.819231) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 217 + speed limit (0.823077) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 218 + speed limit (0.826923) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 219 + speed limit (0.830769) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 220 + speed limit (0.834615) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 221 + speed limit (0.838462) (derivable function) + Bounds: (0, 31250) + Scales: 1 + Initial value: [1](1458) + + Constraint 222 + speed lim... [truncated message content] |
From: Thomas M. <tho...@us...> - 2009-07-24 09:58:11
|
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". The branch, core has been updated via 51500c04ce698d5353142b1404be0b631ee50534 (commit) from 9e5ae38145c8fe9776591711f415451932a96599 (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 51500c04ce698d5353142b1404be0b631ee50534 Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 18:57:49 2009 +0900 Add copy constructor for GenericSolver. * include/roboptim/core/generic-solver.hh, * src/generic-solver.cc: Add copy constructor. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 5fa7628..1ad38bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-07-24 Thomas Moulard <tho...@gm...> + Add copy constructor for GenericSolver. + * include/roboptim/core/generic-solver.hh, + * src/generic-solver.cc: Add copy constructor. + +2009-07-24 Thomas Moulard <tho...@gm...> + Make Solver class destructor virtual. * include/roboptim/core/solver.hh: Here. diff --git a/include/roboptim/core/generic-solver.hh b/include/roboptim/core/generic-solver.hh index 3c7baf3..07fc154 100644 --- a/include/roboptim/core/generic-solver.hh +++ b/include/roboptim/core/generic-solver.hh @@ -69,6 +69,7 @@ namespace roboptim /// \name Constructors and destructors. /// \{ explicit GenericSolver () throw (); + explicit GenericSolver (const GenericSolver&) throw (); virtual ~GenericSolver () throw (); /// \} diff --git a/src/generic-solver.cc b/src/generic-solver.cc index e37900f..2da4267 100644 --- a/src/generic-solver.cc +++ b/src/generic-solver.cc @@ -25,6 +25,11 @@ namespace roboptim { } + GenericSolver::GenericSolver (const GenericSolver& solver) throw () + : result_ (solver.result_) + { + } + GenericSolver::~GenericSolver () throw () { } ----------------------------------------------------------------------- Summary of changes: ChangeLog | 6 ++++++ include/roboptim/core/generic-solver.hh | 1 + src/generic-solver.cc | 5 +++++ 3 files changed, 12 insertions(+), 0 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-24 09:44:58
|
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". The branch, core has been updated via 9e5ae38145c8fe9776591711f415451932a96599 (commit) from 2f2a57d36cf61ac2d46fc00b503773d0793508ef (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 9e5ae38145c8fe9776591711f415451932a96599 Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 18:44:36 2009 +0900 Make Solver class destructor virtual. * include/roboptim/core/solver.hh: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 54c9a3e..5fa7628 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-24 Thomas Moulard <tho...@gm...> + Make Solver class destructor virtual. + * include/roboptim/core/solver.hh: Here. + +2009-07-24 Thomas Moulard <tho...@gm...> + Add missing initialization list. * src/result-with-warnings.cc: Here. diff --git a/include/roboptim/core/solver.hh b/include/roboptim/core/solver.hh index e596180..6c38821 100644 --- a/include/roboptim/core/solver.hh +++ b/include/roboptim/core/solver.hh @@ -77,7 +77,7 @@ namespace roboptim template <typename F_, typename C_> explicit Solver (const Problem<F_, C_>& problem) throw (); - ~Solver () throw (); + virtual ~Solver () throw (); /// \brief Retrieve the problem. /// \return problem this solver is solving ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ include/roboptim/core/solver.hh | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-24 09:35:15
|
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". The branch, core has been updated via 2f2a57d36cf61ac2d46fc00b503773d0793508ef (commit) from 3f3c267127fb151702e2d6e955f4d8da03af721e (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 2f2a57d36cf61ac2d46fc00b503773d0793508ef Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 18:34:37 2009 +0900 Add missing initialization list. * src/result-with-warnings.cc: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 26acf40..54c9a3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-07-24 Thomas Moulard <tho...@gm...> + + Add missing initialization list. + * src/result-with-warnings.cc: Here. + 2009-07-23 Thomas Moulard <tho...@gm...> Clean finite difference gradient code. diff --git a/src/result-with-warnings.cc b/src/result-with-warnings.cc index ee17924..e70b6dc 100644 --- a/src/result-with-warnings.cc +++ b/src/result-with-warnings.cc @@ -31,7 +31,8 @@ namespace roboptim ResultWithWarnings::ResultWithWarnings (const Function::size_type n, const Function::size_type m) throw () - : Result (n, m) + : Result (n, m), + warnings () { } ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ src/result-with-warnings.cc | 3 ++- 2 files changed, 7 insertions(+), 1 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-24 08:15:50
|
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". The branch, shared-tests has been updated via 312d6535e3e856122c79552fe8928b7cb192c114 (commit) from a566f94bbf6a9f315e35a982b6b682f91e2b01a1 (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 312d6535e3e856122c79552fe8928b7cb192c114 Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 16:59:41 2009 +0900 Fix gradient. * hs071.hh: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index fa378ed..23b50d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-07-24 Thomas Moulard <tho...@gm...> + + Fix gradient. + * hs071.hh: Here. + 2009-07-01 Thomas Moulard <tho...@gm...> Create separate shared-tests branch. diff --git a/hs071.hh b/hs071.hh index ca40f0e..461ed06 100644 --- a/hs071.hh +++ b/hs071.hh @@ -40,10 +40,10 @@ struct F : public TwiceDerivableFunction impl_gradient (gradient_t& grad, const argument_t& x, size_type) const throw () { grad.clear (); - grad[0] = x[0] * x[3] + x[3] * (x[0] + x[1] + x[2]); + grad[0] = x[3] * (2 * x[0] + x[1] + x[2]); grad[1] = x[0] * x[3]; - grad[2] = x[0] * x[3] + 1; - grad[3] = x[0] * (x[0] + x[1] + x[2]); + grad[2] = x[0] * x[3]; + grad[3] = x[0] * (x[0] + x[1] + x[2]) + 1; } void ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ hs071.hh | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-24 01:27:23
|
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". The branch, trajectory has been updated via e7a5e923e458b43e1a6a42a47511695f76ea4de5 (commit) from 9983d73a3a8d10b91db4ef44c3796cf9b64ca789 (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 e7a5e923e458b43e1a6a42a47511695f76ea4de5 Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 10:26:35 2009 +0900 Add missing ``inline''. * include/roboptim/trajectory/free-time-trajectory.hxx: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index d33534c..216b48c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-24 Thomas Moulard <tho...@gm...> + Add missing ``inline''. + * include/roboptim/trajectory/free-time-trajectory.hxx: Here. + +2009-07-24 Thomas Moulard <tho...@gm...> + Add missing ``inline'' in header. * include/roboptim/trajectory/free-time-trajectory.hh: Here. diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index 3c8e533..0da3ba4 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -26,7 +26,7 @@ namespace roboptim { namespace detail { - Function::value_type + inline Function::value_type scaleTime (Function::value_type unscaled, Function::value_type min, Function::value_type scale) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ .../roboptim/trajectory/free-time-trajectory.hxx | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-24 01:11:11
|
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". The branch, trajectory has been updated via 9983d73a3a8d10b91db4ef44c3796cf9b64ca789 (commit) from e2120f36f1a42a2348efe6879c22d922564c1972 (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 9983d73a3a8d10b91db4ef44c3796cf9b64ca789 Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 10:10:52 2009 +0900 Add missing ``inline'' in header. * include/roboptim/trajectory/free-time-trajectory.hh: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index b7d62c9..d33534c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-24 Thomas Moulard <tho...@gm...> + Add missing ``inline'' in header. + * include/roboptim/trajectory/free-time-trajectory.hh: Here. + +2009-07-24 Thomas Moulard <tho...@gm...> + Add isValidTime method. This patch fix a warning due to the fact that some variables are not used anymore if one compiles with -DNDEBUG diff --git a/include/roboptim/trajectory/free-time-trajectory.hh b/include/roboptim/trajectory/free-time-trajectory.hh index d9d1198..95c70e4 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hh +++ b/include/roboptim/trajectory/free-time-trajectory.hh @@ -122,7 +122,7 @@ namespace roboptim Function::vector_t removeScaleFromParameters (const Function::vector_t& v); - Function::vector_t + inline Function::vector_t addScaleToParameters (const Function::vector_t& p, Function::value_type t) { @@ -133,7 +133,7 @@ namespace roboptim return res; } - Function::vector_t + inline Function::vector_t removeScaleFromParameters (const Function::vector_t& p) { Function::vector_t res (p.size () - 1); ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ .../roboptim/trajectory/free-time-trajectory.hh | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-24 01:01:43
|
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". The branch, trajectory has been updated via e2120f36f1a42a2348efe6879c22d922564c1972 (commit) from d25b5e2969ac4a1656e03931123ad1033acfe854 (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 e2120f36f1a42a2348efe6879c22d922564c1972 Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 10:01:22 2009 +0900 Add isValidTime method. This patch fix a warning due to the fact that some variables are not used anymore if one compiles with -DNDEBUG (as assertions are dropped). * include/roboptim/trajectory/free-time-trajectory.hxx: Use isValidTime. * include/roboptim/trajectory/trajectory.hh, * include/roboptim/trajectory/trajectory.hxx: Add isValidTime method. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 0a1ba08..b7d62c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2009-07-24 Thomas Moulard <tho...@gm...> + Add isValidTime method. + This patch fix a warning due to the fact that some variables + are not used anymore if one compiles with -DNDEBUG + (as assertions are dropped). + * include/roboptim/trajectory/free-time-trajectory.hxx: Use isValidTime. + * include/roboptim/trajectory/trajectory.hh, + * include/roboptim/trajectory/trajectory.hxx: Add isValidTime method. + +2009-07-24 Thomas Moulard <tho...@gm...> + Fix naming clash in inclusion guards. * include/roboptim/trajectory/visualization/limit-speed.hh: Here. diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index efb4678..3c8e533 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -45,7 +45,6 @@ namespace roboptim scaleTime (Function::getUpperBound (traj.timeRange ()), min, scale); return Function::makeInterval (min, max); } - } // end of namespace detail template <unsigned dorder> @@ -176,12 +175,11 @@ namespace roboptim FreeTimeTrajectory<dorder>::scaleTime (double unscaled) const throw () { value_type tMin = getLowerBound (this->timeRange ()); - value_type tMax = getUpperBound (this->timeRange ()); value_type tmin = getLowerBound (this->trajectory_->timeRange ()); value_type tmax = getUpperBound (this->trajectory_->timeRange ()); unscaled = detail::fixTime (unscaled, *this); - assert (tMin <= unscaled && unscaled <= tMax); + assert (this->isValidTime (unscaled)); value_type res = tmin + (unscaled - tMin) / timeScale (); @@ -199,10 +197,9 @@ namespace roboptim value_type tMin = getLowerBound (this->timeRange ()); value_type tMax = getUpperBound (this->timeRange ()); value_type tmin = getLowerBound (this->trajectory_->timeRange ()); - value_type tmax = getUpperBound (this->trajectory_->timeRange ()); scaled = detail::fixTime (scaled, *this); - assert (tmin <= scaled && scaled <= tmax); + assert (trajectory_->isValidTime (scaled)); value_type res = tMin + (scaled - tmin) * timeScale (); diff --git a/include/roboptim/trajectory/trajectory.hh b/include/roboptim/trajectory/trajectory.hh index 1dc0c9b..9593a39 100644 --- a/include/roboptim/trajectory/trajectory.hh +++ b/include/roboptim/trajectory/trajectory.hh @@ -229,7 +229,7 @@ namespace roboptim virtual jacobian_t variationDerivWrtParam (StableTimePoint tp, size_type order) const throw (); - + bool isValidTime (value_type t) const throw (); virtual Trajectory<DerivabilityOrder>* clone () const throw () = 0; diff --git a/include/roboptim/trajectory/trajectory.hxx b/include/roboptim/trajectory/trajectory.hxx index 3cc76f3..d561332 100644 --- a/include/roboptim/trajectory/trajectory.hxx +++ b/include/roboptim/trajectory/trajectory.hxx @@ -158,6 +158,15 @@ namespace roboptim } template <unsigned dorder> + bool + Trajectory<dorder>::isValidTime (value_type t) const throw () + { + value_type tmin = getLowerBound (this->timeRange ()); + value_type tmax = getUpperBound (this->timeRange ()); + return (tmin <= t && t <= tmax); + } + + template <unsigned dorder> std::ostream& Trajectory<dorder>::print (std::ostream& o) const throw () { ----------------------------------------------------------------------- Summary of changes: ChangeLog | 10 ++++++++++ .../roboptim/trajectory/free-time-trajectory.hxx | 7 ++----- include/roboptim/trajectory/trajectory.hh | 2 +- include/roboptim/trajectory/trajectory.hxx | 9 +++++++++ 4 files changed, 22 insertions(+), 6 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-24 00:46:29
|
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". The branch, trajectory has been updated via d25b5e2969ac4a1656e03931123ad1033acfe854 (commit) from 2a26cddaa6f2adf74b16ac644544b3112d86902c (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 d25b5e2969ac4a1656e03931123ad1033acfe854 Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 09:46:08 2009 +0900 Fix naming clash in inclusion guards. * include/roboptim/trajectory/visualization/limit-speed.hh: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index bcaff73..0a1ba08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-24 Thomas Moulard <tho...@gm...> + Fix naming clash in inclusion guards. + * include/roboptim/trajectory/visualization/limit-speed.hh: Here. + +2009-07-24 Thomas Moulard <tho...@gm...> + Remove orphan stdout file and distribute the right one. * tests/Makefile.am: Fix typo. * tests/spline-optimization-time.stdout: Remove. diff --git a/include/roboptim/trajectory/visualization/limit-speed.hh b/include/roboptim/trajectory/visualization/limit-speed.hh index 4c3c0ab..c6097c7 100644 --- a/include/roboptim/trajectory/visualization/limit-speed.hh +++ b/include/roboptim/trajectory/visualization/limit-speed.hh @@ -15,8 +15,8 @@ // You should have received a copy of the GNU Lesser General Public License // along with roboptim. If not, see <http://www.gnu.org/licenses/>. -#ifndef ROBOPTIM_TRAJECTORY_VISUALIZATION_TRAJECTORY_HH -# define ROBOPTIM_TRAJECTORY_VISUALIZATION_TRAJECTORY_HH +#ifndef ROBOPTIM_TRAJECTORY_VISUALIZATION_LIMIT_SPEED_HH +# define ROBOPTIM_TRAJECTORY_VISUALIZATION_LIMIT_SPEED_HH # include <boost/format.hpp> # include <roboptim/core/visualization/gnuplot-commands.hh> @@ -88,4 +88,4 @@ namespace roboptim } // end of namespace visualization. } // end of namespace roboptim. -#endif //! ROBOPTIM_TRAJECTORY_VISUALIZATION_TRAJECTORY_HH +#endif //! ROBOPTIM_TRAJECTORY_VISUALIZATION_LIMIT_SPEED_HH ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ .../trajectory/visualization/limit-speed.hh | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-24 00:14:24
|
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". The branch, trajectory has been updated via 2a26cddaa6f2adf74b16ac644544b3112d86902c (commit) from 6360e4cc4aaa76a89733089731e0806025c1c651 (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 2a26cddaa6f2adf74b16ac644544b3112d86902c Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 24 09:14:01 2009 +0900 Remove orphan stdout file and distribute the right one. * tests/Makefile.am: Fix typo. * tests/spline-optimization-time.stdout: Remove. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 90ccdbe..bcaff73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-07-24 Thomas Moulard <tho...@gm...> + + Remove orphan stdout file and distribute the right one. + * tests/Makefile.am: Fix typo. + * tests/spline-optimization-time.stdout: Remove. + 2009-07-23 Thomas Moulard <tho...@gm...> Fix typo. diff --git a/tests/Makefile.am b/tests/Makefile.am index 5a3a950..047a8e2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -73,5 +73,5 @@ EXTRA_DIST += \ simple.stdout \ spline-gradient.stdout \ spline-optimization.stdout \ - spline-optimization-time.stdout \ + spline-time-optimization.stdout \ spline.stdout diff --git a/tests/spline-optimization-time.stdout b/tests/spline-optimization-time.stdout deleted file mode 100644 index e69de29..0000000 ----------------------------------------------------------------------- Summary of changes: ChangeLog | 6 ++++++ tests/Makefile.am | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) delete mode 100644 tests/spline-optimization-time.stdout hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-23 12:20:24
|
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". The branch, trajectory has been updated via 6360e4cc4aaa76a89733089731e0806025c1c651 (commit) from a3a373d12f6b72d0f967bf409f20c78a4084850b (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 6360e4cc4aaa76a89733089731e0806025c1c651 Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 21:20:01 2009 +0900 Fix typo. * tests/testsuite.at: Fix typo in test case name. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 0d592dd..90ccdbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-23 Thomas Moulard <tho...@gm...> + Fix typo. + * tests/testsuite.at: Fix typo in test case name. + +2009-07-23 Thomas Moulard <tho...@gm...> + Remove tests that was tagged as XFAIL. * tests/free-time-trajectory.stdout, * tests/spline-time-optimization.stdout: Regenerate. diff --git a/tests/testsuite.at b/tests/testsuite.at index 59f145c..145c46b 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -33,6 +33,6 @@ CHECK_STDOUT([spline], [Check Spline class.]) CHECK_STDOUT([spline-gradient], [Check Spline gradient.]) CHECK_STDOUT([spline-optimization], [Optimize a Spline with Cfsqp.]) CHECK_STDOUT([free-time-trajectory], [Check free time trajectory.]) -CHECK_STDOUT([spline-optimization-time], [Optimize a free time trajectory.]) +CHECK_STDOUT([spline-time-optimization], [Optimize a free time trajectory.]) # End of testsuite.at ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ tests/testsuite.at | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-23 12:17:37
|
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". The branch, trajectory has been updated via a3a373d12f6b72d0f967bf409f20c78a4084850b (commit) via ad435a753786cc84413be4bdd135e846f190cd09 (commit) via 5d903cc95a204dee7e86454f921c76fdb533a1a3 (commit) from e68e36456ec09d884ee2dbad50eb067724d5a723 (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 a3a373d12f6b72d0f967bf409f20c78a4084850b Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 21:16:40 2009 +0900 Remove tests that was tagged as XFAIL. * tests/free-time-trajectory.stdout, * tests/spline-time-optimization.stdout: Regenerate. * tests/testsuite.at: Free time trajectory and spline time optimization tests are not xfail anymore. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 8c85b58..0d592dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2009-07-23 Thomas Moulard <tho...@gm...> + Remove tests that was tagged as XFAIL. + * tests/free-time-trajectory.stdout, + * tests/spline-time-optimization.stdout: Regenerate. + * tests/testsuite.at: Free time trajectory and spline + time optimization tests are not xfail anymore. + +2009-07-23 Thomas Moulard <tho...@gm...> + Move time stable point gradient interface into Trajectory class. * include/Makefile.am: Distribue new header. * include/roboptim/trajectory/free-time-trajectory.hh:, diff --git a/tests/free-time-trajectory.stdout b/tests/free-time-trajectory.stdout index e69de29..7bd0924 100644 --- a/tests/free-time-trajectory.stdout +++ b/tests/free-time-trajectory.stdout @@ -0,0 +1,605 @@ +Spline range: [0, 4] +FTT range: [0, 4] +/------------------------------------------------------------------------------\ +| T || Value | Value (ftt) || Derivative | Derivative (ftt) | +-------------------------------------------------------------------------------- +| 0 || 0 | 0 || 0 | 0 | +| 0.1 || 0.00813802 | 0.00813802 || 0.244141 | 0.244141 | +| 0.2 || 0.0651042 | 0.0651042 || 0.976562 | 0.976562 | +| 0.3 || 0.219727 | 0.219727 || 2.19727 | 2.19727 | +| 0.4 || 0.520833 | 0.520833 || 3.90625 | 3.90625 | +| 0.5 || 1.01725 | 1.01725 || 6.10352 | 6.10352 | +| 0.6 || 1.75781 | 1.75781 || 8.78906 | 8.78906 | +| 0.7 || 2.79134 | 2.79134 || 11.9629 | 11.9629 | +| 0.8 || 4.16667 | 4.16667 || 15.625 | 15.625 | +| 0.9 || 5.92448 | 5.92448 || 19.5312 | 19.5312 | +| 1 || 8.07292 | 8.07292 || 23.4375 | 23.4375 | +| 1.1 || 10.612 | 10.612 || 27.3437 | 27.3437 | +| 1.2 || 13.5417 | 13.5417 || 31.25 | 31.25 | +| 1.3 || 16.862 | 16.862 || 35.1562 | 35.1562 | +| 1.4 || 20.5729 | 20.5729 || 39.0625 | 39.0625 | +| 1.5 || 24.6745 | 24.6745 || 42.9688 | 42.9688 | +| 1.6 || 29.1667 | 29.1667 || 46.875 | 46.875 | +| 1.7 || 34.0332 | 34.0332 || 50.293 | 50.293 | +| 1.8 || 39.1927 | 39.1927 || 52.7344 | 52.7344 | +| 1.9 || 44.5475 | 44.5475 || 54.1992 | 54.1992 | +| 2 || 50 | 50 || 54.6875 | 54.6875 | +| 2.1 || 55.4525 | 55.4525 || 54.1992 | 54.1992 | +| 2.2 || 60.8073 | 60.8073 || 52.7344 | 52.7344 | +| 2.3 || 65.9668 | 65.9668 || 50.293 | 50.293 | +| 2.4 || 70.8333 | 70.8333 || 46.875 | 46.875 | +| 2.5 || 75.3255 | 75.3255 || 42.9687 | 42.9687 | +| 2.6 || 79.4271 | 79.4271 || 39.0625 | 39.0625 | +| 2.7 || 83.138 | 83.138 || 35.1562 | 35.1562 | +| 2.8 || 86.4583 | 86.4583 || 31.25 | 31.25 | +| 2.9 || 89.388 | 89.388 || 27.3437 | 27.3437 | +| 3 || 91.9271 | 91.9271 || 23.4375 | 23.4375 | +| 3.1 || 94.0755 | 94.0755 || 19.5312 | 19.5312 | +| 3.2 || 95.8333 | 95.8333 || 15.625 | 15.625 | +| 3.3 || 97.2087 | 97.2087 || 11.9629 | 11.9629 | +| 3.4 || 98.2422 | 98.2422 || 8.78906 | 8.78906 | +| 3.5 || 98.9827 | 98.9827 || 6.10352 | 6.10352 | +| 3.6 || 99.4792 | 99.4792 || 3.90625 | 3.90625 | +| 3.7 || 99.7803 | 99.7803 || 2.19727 | 2.19727 | +| 3.8 || 99.9349 | 99.9349 || 0.976562 | 0.976562 | +| 3.9 || 99.9919 | 99.9919 || 0.244141 | 0.244141 | +| 4 || 100 | 100 || -2.08167e-14 | -2.08167e-14 | +\------------------------------------------------------------------------------/ + +Gradient check. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. + +Variation of the derivative w.r.t to parameters: +[1,4]((0,0,0,0)) [1,5]((0,0,0,0,0)) +[1,4]((-0.00976562,0.00976562,0,0)) [1,5]((0.0244141,-0.00976562,0.00976562,0,0)) +[1,4]((-0.0390625,0.0390625,0,0)) [1,5]((0.195312,-0.0390625,0.0390625,0,0)) +[1,4]((-0.0878906,0.0878906,0,0)) [1,5]((0.65918,-0.0878906,0.0878906,0,0)) +[1,4]((-0.15625,0.15625,0,0)) [1,5]((1.5625,-0.15625,0.15625,0,0)) +[1,4]((-0.244141,0.244141,0,0)) [1,5]((3.05176,-0.244141,0.244141,0,0)) +[1,4]((-0.351562,0.351562,0,0)) [1,5]((5.27344,-0.351562,0.351562,0,0)) +[1,4]((-0.478516,0.478516,0,0)) [1,5]((8.37402,-0.478516,0.478516,0,0)) +[1,4]((-0.625,0.625,0,0)) [1,5]((12.5,-0.625,0.625,0,0)) +[1,4]((-0.761719,0.751953,0.00976562,0)) [1,5]((17.5781,-0.761719,0.751953,0.00976562,0)) +[1,4]((-0.859375,0.820312,0.0390625,0)) [1,5]((23.4375,-0.859375,0.820312,0.0390625,0)) +[1,4]((-0.917969,0.830078,0.0878906,0)) [1,5]((30.0781,-0.917969,0.830078,0.0878906,0)) +[1,4]((-0.9375,0.78125,0.15625,0)) [1,5]((37.5,-0.9375,0.78125,0.15625,0)) +[1,4]((-0.917969,0.673828,0.244141,0)) [1,5]((45.7031,-0.917969,0.673828,0.244141,0)) +[1,4]((-0.859375,0.507812,0.351562,0)) [1,5]((54.6875,-0.859375,0.507812,0.351562,0)) +[1,4]((-0.761719,0.283203,0.478516,0)) [1,5]((64.4531,-0.761719,0.283203,0.478516,0)) +[1,4]((-0.625,-1.11022e-15,0.625,-0)) [1,5]((75,-0.625,-1.11022e-15,0.625,-0)) +[1,4]((-0.478516,-0.283203,0.751953,0.00976563)) [1,5]((85.498,-0.478516,-0.283203,0.751953,0.00976563)) +[1,4]((-0.351562,-0.507813,0.820313,0.0390625)) [1,5]((94.9219,-0.351562,-0.507813,0.820313,0.0390625)) +[1,4]((-0.244141,-0.673828,0.830078,0.0878906)) [1,5]((102.979,-0.244141,-0.673828,0.830078,0.0878906)) +[1,4]((-0.15625,-0.78125,0.78125,0.15625)) [1,5]((109.375,-0.15625,-0.78125,0.78125,0.15625)) +[1,4]((-0.0878906,-0.830078,0.673828,0.244141)) [1,5]((113.818,-0.0878906,-0.830078,0.673828,0.244141)) +[1,4]((-0.0390625,-0.820312,0.507812,0.351563)) [1,5]((116.016,-0.0390625,-0.820312,0.507812,0.351563)) +[1,4]((-0.00976562,-0.751953,0.283203,0.478516)) [1,5]((115.674,-0.00976562,-0.751953,0.283203,0.478516)) +[1,4]((0,-0.625,-2.22045e-15,0.625)) [1,5]((112.5,0,-0.625,-2.22045e-15,0.625)) +[1,4]((0,-0.478516,-0.283203,0.761719)) [1,5]((107.422,0,-0.478516,-0.283203,0.761719)) +[1,4]((0,-0.351562,-0.507813,0.859375)) [1,5]((101.562,0,-0.351562,-0.507813,0.859375)) +[1,4]((0,-0.244141,-0.673828,0.917969)) [1,5]((94.9219,0,-0.244141,-0.673828,0.917969)) +[1,4]((0,-0.15625,-0.78125,0.9375)) [1,5]((87.5,0,-0.15625,-0.78125,0.9375)) +[1,4]((0,-0.0878906,-0.830078,0.917969)) [1,5]((79.2969,0,-0.0878906,-0.830078,0.917969)) +[1,4]((0,-0.0390625,-0.820312,0.859375)) [1,5]((70.3125,0,-0.0390625,-0.820312,0.859375)) +[1,4]((0,-0.00976562,-0.751953,0.761719)) [1,5]((60.5469,0,-0.00976562,-0.751953,0.761719)) +[1,4]((0,0,-0.625,0.625)) [1,5]((50,0,0,-0.625,0.625)) +[1,4]((0,0,-0.478516,0.478516)) [1,5]((39.4775,0,0,-0.478516,0.478516)) +[1,4]((0,0,-0.351562,0.351562)) [1,5]((29.8828,0,0,-0.351562,0.351562)) +[1,4]((0,0,-0.244141,0.244141)) [1,5]((21.3623,0,0,-0.244141,0.244141)) +[1,4]((0,0,-0.15625,0.15625)) [1,5]((14.0625,0,0,-0.15625,0.15625)) +[1,4]((0,0,-0.0878906,0.0878906)) [1,5]((8.12988,0,0,-0.0878906,0.0878906)) +[1,4]((0,0,-0.0390625,0.0390625)) [1,5]((3.71094,0,0,-0.0390625,0.0390625)) +[1,4]((0,0,-0.00976562,0.00976562)) [1,5]((0.952148,0,0,-0.00976562,0.00976562)) +[1,4]((0,0,0,0)) [1,5]((-8.32667e-14,0,0,0,0)) + +Spline range: [0, 4] +FTT range: [0, 8] +/------------------------------------------------------------------------------\ +| T || Value | Value (ftt) || Derivative | Derivative (ftt) | +-------------------------------------------------------------------------------- +| 0 || 0 | 0 || 0 | 0 | +| 0.1 || 0.00813802 | 0.00101725 || 0.244141 | 0.0305176 | +| 0.2 || 0.0651042 | 0.00813802 || 0.976562 | 0.12207 | +| 0.3 || 0.219727 | 0.0274658 || 2.19727 | 0.274658 | +| 0.4 || 0.520833 | 0.0651042 || 3.90625 | 0.488281 | +| 0.5 || 1.01725 | 0.127157 || 6.10352 | 0.762939 | +| 0.6 || 1.75781 | 0.219727 || 8.78906 | 1.09863 | +| 0.7 || 2.79134 | 0.348918 || 11.9629 | 1.49536 | +| 0.8 || 4.16667 | 0.520833 || 15.625 | 1.95312 | +| 0.9 || 5.92448 | 0.741577 || 19.5312 | 2.47192 | +| 1 || 8.07292 | 1.01725 || 23.4375 | 3.05176 | +| 1.1 || 10.612 | 1.35396 || 27.3437 | 3.69263 | +| 1.2 || 13.5417 | 1.75781 || 31.25 | 4.39453 | +| 1.3 || 16.862 | 2.2349 || 35.1562 | 5.15747 | +| 1.4 || 20.5729 | 2.79134 || 39.0625 | 5.98145 | +| 1.5 || 24.6745 | 3.43323 || 42.9688 | 6.86646 | +| 1.6 || 29.1667 | 4.16667 || 46.875 | 7.8125 | +| 1.7 || 34.0332 | 4.99674 || 50.293 | 8.78906 | +| 1.8 || 39.1927 | 5.92448 || 52.7344 | 9.76563 | +| 1.9 || 44.5475 | 6.94987 || 54.1992 | 10.7422 | +| 2 || 50 | 8.07292 || 54.6875 | 11.7188 | +| 2.1 || 55.4525 | 9.29362 || 54.1992 | 12.6953 | +| 2.2 || 60.8073 | 10.612 || 52.7344 | 13.6719 | +| 2.3 || 65.9668 | 12.028 || 50.293 | 14.6484 | +| 2.4 || 70.8333 | 13.5417 || 46.875 | 15.625 | +| 2.5 || 75.3255 | 15.153 || 42.9687 | 16.6016 | +| 2.6 || 79.4271 | 16.862 || 39.0625 | 17.5781 | +| 2.7 || 83.138 | 18.6686 || 35.1562 | 18.5547 | +| 2.8 || 86.4583 | 20.5729 || 31.25 | 19.5313 | +| 2.9 || 89.388 | 22.5749 || 27.3437 | 20.5078 | +| 3 || 91.9271 | 24.6745 || 23.4375 | 21.4844 | +| 3.1 || 94.0755 | 26.8717 || 19.5312 | 22.4609 | +| 3.2 || 95.8333 | 29.1667 || 15.625 | 23.4375 | +| 3.3 || 97.2087 | 31.5572 || 11.9629 | 24.353 | +| 3.4 || 98.2422 | 34.0332 || 8.78906 | 25.1465 | +| 3.5 || 98.9827 | 36.5824 || 6.10352 | 25.8179 | +| 3.6 || 99.4792 | 39.1927 || 3.90625 | 26.3672 | +| 3.7 || 99.7803 | 41.8518 || 2.19727 | 26.7944 | +| 3.8 || 99.9349 | 44.5475 || 0.976562 | 27.0996 | +| 3.9 || 99.9919 | 47.2677 || 0.244141 | 27.2827 | +| 4 || N/A | 50 || N/A | 27.3438 | +| 4.1 || N/A | 52.7323 || N/A | 27.2827 | +| 4.2 || N/A | 55.4525 || N/A | 27.0996 | +| 4.3 || N/A | 58.1482 || N/A | 26.7944 | +| 4.4 || N/A | 60.8073 || N/A | 26.3672 | +| 4.5 || N/A | 63.4176 || N/A | 25.8179 | +| 4.6 || N/A | 65.9668 || N/A | 25.1465 | +| 4.7 || N/A | 68.4428 || N/A | 24.353 | +| 4.8 || N/A | 70.8333 || N/A | 23.4375 | +| 4.9 || N/A | 73.1283 || N/A | 22.4609 | +| 5 || N/A | 75.3255 || N/A | 21.4844 | +| 5.1 || N/A | 77.4251 || N/A | 20.5078 | +| 5.2 || N/A | 79.4271 || N/A | 19.5313 | +| 5.3 || N/A | 81.3314 || N/A | 18.5547 | +| 5.4 || N/A | 83.138 || N/A | 17.5781 | +| 5.5 || N/A | 84.847 || N/A | 16.6016 | +| 5.6 || N/A | 86.4583 || N/A | 15.625 | +| 5.7 || N/A | 87.972 || N/A | 14.6484 | +| 5.8 || N/A | 89.388 || N/A | 13.6719 | +| 5.9 || N/A | 90.7064 || N/A | 12.6953 | +| 6 || N/A | 91.9271 || N/A | 11.7188 | +| 6.1 || N/A | 93.0501 || N/A | 10.7422 | +| 6.2 || N/A | 94.0755 || N/A | 9.76563 | +| 6.3 || N/A | 95.0033 || N/A | 8.78906 | +| 6.4 || N/A | 95.8333 || N/A | 7.8125 | +| 6.5 || N/A | 96.5668 || N/A | 6.86646 | +| 6.6 || N/A | 97.2087 || N/A | 5.98145 | +| 6.7 || N/A | 97.7651 || N/A | 5.15747 | +| 6.8 || N/A | 98.2422 || N/A | 4.39453 | +| 6.9 || N/A | 98.646 || N/A | 3.69263 | +| 7 || N/A | 98.9827 || N/A | 3.05176 | +| 7.1 || N/A | 99.2584 || N/A | 2.47192 | +| 7.2 || N/A | 99.4792 || N/A | 1.95313 | +| 7.3 || N/A | 99.6511 || N/A | 1.49536 | +| 7.4 || N/A | 99.7803 || N/A | 1.09863 | +| 7.5 || N/A | 99.8728 || N/A | 0.762939 | +| 7.6 || N/A | 99.9349 || N/A | 0.488281 | +| 7.7 || N/A | 99.9725 || N/A | 0.274658 | +| 7.8 || N/A | 99.9919 || N/A | 0.12207 | +| 7.9 || N/A | 99.999 || N/A | 0.0305176 | +| 8 || N/A | 100 || N/A | 4.69069e-15 | +\------------------------------------------------------------------------------/ + +Gradient check. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. + +Variation of the derivative w.r.t to parameters: +[1,4]((0,0,0,0)) [1,5]((0,0,0,0,0)) +[1,4]((-0.00976562,0.00976562,0,0)) [1,5]((0.00610352,-0.00244141,0.00244141,0,0)) +[1,4]((-0.0390625,0.0390625,0,0)) [1,5]((0.0488281,-0.00976562,0.00976562,0,0)) +[1,4]((-0.0878906,0.0878906,0,0)) [1,5]((0.164795,-0.0219727,0.0219727,0,0)) +[1,4]((-0.15625,0.15625,0,0)) [1,5]((0.390625,-0.0390625,0.0390625,0,0)) +[1,4]((-0.244141,0.244141,0,0)) [1,5]((0.762939,-0.0610352,0.0610352,0,0)) +[1,4]((-0.351562,0.351562,0,0)) [1,5]((1.31836,-0.0878906,0.0878906,0,0)) +[1,4]((-0.478516,0.478516,0,0)) [1,5]((2.09351,-0.119629,0.119629,0,0)) +[1,4]((-0.625,0.625,0,0)) [1,5]((3.125,-0.15625,0.15625,0,0)) +[1,4]((-0.761719,0.751953,0.00976562,0)) [1,5]((4.44946,-0.197754,0.197754,0,0)) +[1,4]((-0.859375,0.820312,0.0390625,0)) [1,5]((6.10352,-0.244141,0.244141,0,0)) +[1,4]((-0.917969,0.830078,0.0878906,0)) [1,5]((8.12378,-0.29541,0.29541,0,0)) +[1,4]((-0.9375,0.78125,0.15625,0)) [1,5]((10.5469,-0.351562,0.351562,0,0)) +[1,4]((-0.917969,0.673828,0.244141,0)) [1,5]((13.4094,-0.412598,0.412598,0,0)) +[1,4]((-0.859375,0.507812,0.351562,0)) [1,5]((16.748,-0.478516,0.478516,0,0)) +[1,4]((-0.761719,0.283203,0.478516,0)) [1,5]((20.5994,-0.549316,0.549316,0,0)) +[1,4]((-0.625,-1.11022e-15,0.625,-0)) [1,5]((25,-0.625,0.625,3.08149e-32,0)) +[1,4]((-0.478516,-0.283203,0.751953,0.00976563)) [1,5]((29.8828,-0.698242,0.695801,0.00244141,0)) +[1,4]((-0.351562,-0.507813,0.820313,0.0390625)) [1,5]((35.1563,-0.761719,0.751953,0.00976563,0)) +[1,4]((-0.244141,-0.673828,0.830078,0.0878906)) [1,5]((40.8203,-0.81543,0.793457,0.0219727,0)) +[1,4]((-0.15625,-0.78125,0.78125,0.15625)) [1,5]((46.875,-0.859375,0.820312,0.0390625,0)) +[1,4]((-0.0878906,-0.830078,0.673828,0.244141)) [1,5]((53.3203,-0.893555,0.83252,0.0610352,0)) +[1,4]((-0.0390625,-0.820312,0.507812,0.351563)) [1,5]((60.1563,-0.917969,0.830078,0.0878906,0)) +[1,4]((-0.00976562,-0.751953,0.283203,0.478516)) [1,5]((67.3828,-0.932617,0.812988,0.119629,0)) +[1,4]((0,-0.625,-2.22045e-15,0.625)) [1,5]((75,-0.9375,0.78125,0.15625,0)) +[1,4]((0,-0.478516,-0.283203,0.761719)) [1,5]((83.0078,-0.932617,0.734863,0.197754,0)) +[1,4]((0,-0.351562,-0.507813,0.859375)) [1,5]((91.4063,-0.917969,0.673828,0.244141,0)) +[1,4]((0,-0.244141,-0.673828,0.917969)) [1,5]((100.195,-0.893555,0.598145,0.29541,0)) +[1,4]((0,-0.15625,-0.78125,0.9375)) [1,5]((109.375,-0.859375,0.507812,0.351563,0)) +[1,4]((0,-0.0878906,-0.830078,0.917969)) [1,5]((118.945,-0.81543,0.402832,0.412598,0)) +[1,4]((0,-0.0390625,-0.820312,0.859375)) [1,5]((128.906,-0.761719,0.283203,0.478516,0)) +[1,4]((0,-0.00976562,-0.751953,0.761719)) [1,5]((139.258,-0.698242,0.148926,0.549316,0)) +[1,4]((0,0,-0.625,0.625)) [1,5]((150,-0.625,-2.22045e-15,0.625,-0)) +[1,4]((0,0,-0.478516,0.478516)) [1,5]((160.73,-0.549316,-0.148926,0.695801,0.00244141)) +[1,4]((0,0,-0.351562,0.351562)) [1,5]((170.996,-0.478516,-0.283203,0.751953,0.00976563)) +[1,4]((0,0,-0.244141,0.244141)) [1,5]((180.725,-0.412598,-0.402832,0.793457,0.0219727)) +[1,4]((0,0,-0.15625,0.15625)) [1,5]((189.844,-0.351562,-0.507813,0.820313,0.0390625)) +[1,4]((0,0,-0.0878906,0.0878906)) [1,5]((198.279,-0.29541,-0.598145,0.83252,0.0610352)) +[1,4]((0,0,-0.0390625,0.0390625)) [1,5]((205.957,-0.244141,-0.673828,0.830078,0.0878906)) +[1,4]((0,0,-0.00976562,0.00976562)) [1,5]((212.805,-0.197754,-0.734863,0.812988,0.119629)) +N/A [1,5]((218.75,-0.15625,-0.78125,0.78125,0.15625)) +N/A [1,5]((223.718,-0.119629,-0.812988,0.734863,0.197754)) +N/A [1,5]((227.637,-0.0878906,-0.830078,0.673828,0.244141)) +N/A [1,5]((230.432,-0.0610352,-0.83252,0.598145,0.29541)) +N/A [1,5]((232.031,-0.0390625,-0.820312,0.507812,0.351562)) +N/A [1,5]((232.361,-0.0219727,-0.793457,0.402832,0.412598)) +N/A [1,5]((231.348,-0.00976563,-0.751953,0.283203,0.478516)) +N/A [1,5]((228.918,-0.00244141,-0.695801,0.148926,0.549316)) +N/A [1,5]((225,0,-0.625,2.22045e-15,0.625)) +N/A [1,5]((220.117,0,-0.549316,-0.148926,0.698242)) +N/A [1,5]((214.844,0,-0.478516,-0.283203,0.761719)) +N/A [1,5]((209.18,0,-0.412598,-0.402832,0.81543)) +N/A [1,5]((203.125,0,-0.351563,-0.507812,0.859375)) +N/A [1,5]((196.68,0,-0.29541,-0.598145,0.893555)) +N/A [1,5]((189.844,0,-0.244141,-0.673828,0.917969)) +N/A [1,5]((182.617,0,-0.197754,-0.734863,0.932617)) +N/A [1,5]((175,0,-0.15625,-0.78125,0.9375)) +N/A [1,5]((166.992,0,-0.119629,-0.812988,0.932617)) +N/A [1,5]((158.594,0,-0.0878906,-0.830078,0.917969)) +N/A [1,5]((149.805,0,-0.0610352,-0.83252,0.893555)) +N/A [1,5]((140.625,0,-0.0390625,-0.820313,0.859375)) +N/A [1,5]((131.055,0,-0.0219727,-0.793457,0.81543)) +N/A [1,5]((121.094,0,-0.00976563,-0.751953,0.761719)) +N/A [1,5]((110.742,0,-0.00244141,-0.695801,0.698242)) +N/A [1,5]((100,0,0,-0.625,0.625)) +N/A [1,5]((89.2639,0,0,-0.549316,0.549316)) +N/A [1,5]((78.9551,0,0,-0.478516,0.478516)) +N/A [1,5]((69.1101,0,0,-0.412598,0.412598)) +N/A [1,5]((59.7656,0,0,-0.351563,0.351563)) +N/A [1,5]((50.9583,0,0,-0.29541,0.29541)) +N/A [1,5]((42.7246,0,0,-0.244141,0.244141)) +N/A [1,5]((35.1013,0,0,-0.197754,0.197754)) +N/A [1,5]((28.125,0,0,-0.15625,0.15625)) +N/A [1,5]((21.8323,0,0,-0.119629,0.119629)) +N/A [1,5]((16.2598,0,0,-0.0878906,0.0878906)) +N/A [1,5]((11.4441,0,0,-0.0610352,0.0610352)) +N/A [1,5]((7.42188,0,0,-0.0390625,0.0390625)) +N/A [1,5]((4.22974,0,0,-0.0219727,0.0219727)) +N/A [1,5]((1.9043,0,0,-0.00976563,0.00976563)) +N/A [1,5]((0.482178,0,0,-0.00244141,0.00244141)) +N/A [1,5]((7.50511e-14,0,0,0,4.44089e-16)) + +Spline range: [0, 4] +FTT range: [0, 2] +/------------------------------------------------------------------------------\ +| T || Value | Value (ftt) || Derivative | Derivative (ftt) | +-------------------------------------------------------------------------------- +| 0 || 0 | 0 || 0 | 0 | +| 0.1 || 0.00813802 | 0.0651042 || 0.244141 | 1.95312 | +| 0.2 || 0.0651042 | 0.520833 || 0.976562 | 7.8125 | +| 0.3 || 0.219727 | 1.75781 || 2.19727 | 17.5781 | +| 0.4 || 0.520833 | 4.16667 || 3.90625 | 31.25 | +| 0.5 || 1.01725 | 8.07292 || 6.10352 | 46.875 | +| 0.6 || 1.75781 | 13.5417 || 8.78906 | 62.5 | +| 0.7 || 2.79134 | 20.5729 || 11.9629 | 78.125 | +| 0.8 || 4.16667 | 29.1667 || 15.625 | 93.75 | +| 0.9 || 5.92448 | 39.1927 || 19.5312 | 105.469 | +| 1 || 8.07292 | 50 || 23.4375 | 109.375 | +| 1.1 || 10.612 | 60.8073 || 27.3437 | 105.469 | +| 1.2 || 13.5417 | 70.8333 || 31.25 | 93.75 | +| 1.3 || 16.862 | 79.4271 || 35.1562 | 78.125 | +| 1.4 || 20.5729 | 86.4583 || 39.0625 | 62.5 | +| 1.5 || 24.6745 | 91.9271 || 42.9688 | 46.875 | +| 1.6 || 29.1667 | 95.8333 || 46.875 | 31.25 | +| 1.7 || 34.0332 | 98.2422 || 50.293 | 17.5781 | +| 1.8 || 39.1927 | 99.4792 || 52.7344 | 7.8125 | +| 1.9 || 44.5475 | 99.9349 || 54.1992 | 1.95312 | +| 2 || 50 | 100 || 54.6875 | -4.16334e-14 | +\------------------------------------------------------------------------------/ + +Gradient check. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. +Spline gradient. +Free time trajectory gradient. + +Variation of the derivative w.r.t to parameters: +[1,4]((0,0,0,0)) [1,5]((0,0,0,0,0)) +[1,4]((-0.00976562,0.00976562,0,0)) [1,5]((0.0976562,-0.0390625,0.0390625,0,0)) +[1,4]((-0.0390625,0.0390625,0,0)) [1,5]((0.78125,-0.15625,0.15625,0,0)) +[1,4]((-0.0878906,0.0878906,0,0)) [1,5]((2.63672,-0.351563,0.351563,0,0)) +[1,4]((-0.15625,0.15625,0,0)) [1,5]((6.25,-0.625,0.625,0,0)) +[1,4]((-0.244141,0.244141,0,0)) [1,5]((11.7188,-0.859375,0.820312,0.0390625,0)) +[1,4]((-0.351562,0.351562,0,0)) [1,5]((18.75,-0.9375,0.78125,0.15625,0)) +[1,4]((-0.478516,0.478516,0,0)) [1,5]((27.3437,-0.859375,0.507813,0.351562,0)) +[1,4]((-0.625,0.625,0,0)) [1,5]((37.5,-0.625,5.55112e-16,0.625,0)) +[1,4]((-0.761719,0.751953,0.00976562,0)) [1,5]((47.4609,-0.351563,-0.507812,0.820312,0.0390625)) +[1,4]((-0.859375,0.820312,0.0390625,0)) [1,5]((54.6875,-0.15625,-0.78125,0.78125,0.15625)) +[1,4]((-0.917969,0.830078,0.0878906,0)) [1,5]((58.0078,-0.0390625,-0.820313,0.507813,0.351562)) +[1,4]((-0.9375,0.78125,0.15625,0)) [1,5]((56.25,0,-0.625,1.11022e-15,0.625)) +[1,4]((-0.917969,0.673828,0.244141,0)) [1,5]((50.7812,0,-0.351562,-0.507812,0.859375)) +[1,4]((-0.859375,0.507812,0.351562,0)) [1,5]((43.75,0,-0.15625,-0.78125,0.9375)) +[1,4]((-0.761719,0.283203,0.478516,0)) [1,5]((35.1562,0,-0.0390625,-0.820312,0.859375)) +[1,4]((-0.625,-1.11022e-15,0.625,-0)) [1,5]((25,0,0,-0.625,0.625)) +[1,4]((-0.478516,-0.283203,0.751953,0.00976563)) [1,5]((14.9414,0,0,-0.351562,0.351562)) +[1,4]((-0.351562,-0.507813,0.820313,0.0390625)) [1,5]((7.03125,0,0,-0.15625,0.15625)) +[1,4]((-0.244141,-0.673828,0.830078,0.0878906)) [1,5]((1.85547,0,0,-0.0390625,0.0390625)) +[1,4]((-0.15625,-0.78125,0.78125,0.15625)) [1,5]((-4.16334e-14,0,0,0,0)) + diff --git a/tests/spline-time-optimization.stdout b/tests/spline-time-optimization.stdout index 093069b..1925e7f 100644 --- a/tests/spline-time-optimization.stdout +++ b/tests/spline-time-optimization.stdout @@ -6,16 +6,24 @@ Problem: B = [1](0) Argument's bounds: (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf) Argument's scales: 1, 1, 1, 1, 1 - Number of constraints: 2 + Number of constraints: 14 Constraint 0 Numeric linear function + A = [1,5]((1,0,0,0,0)) + B = [1](0) + Bounds: (0, inf) + Scales: 1 + Initial value: [1](1) + + Constraint 1 + Numeric linear function A = [1,5]((0,1,0,0,0)) B = [1](-0) Bounds: (0, 0) Scales: 1 Initial value: [1](0) - Constraint 1 + Constraint 2 Numeric linear function A = [1,5]((0,0,0,0,1)) B = [1](-100) @@ -23,11 +31,77 @@ Problem: Scales: 1 Initial value: [1](0) + Constraint 3 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](0) + + Constraint 4 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](3.90625) + + Constraint 5 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](15.625) + + Constraint 6 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](31.25) + + Constraint 7 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](46.875) + + Constraint 8 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](54.6875) + + Constraint 9 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](46.875) + + Constraint 10 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](31.25) + + Constraint 11 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](15.625) + + Constraint 12 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](3.90625) + + Constraint 13 + limit speed (derivable function) + Bounds: (0, 100) + Scales: 1 + Initial value: [1](4.82947e-15) + Starting point: [5](1,0,25,75,100) Starting value: [1](1) Infinity value (for all functions): inf CFSQP specific variables: - Nineq: 0 + Nineq: 23 Nineqn: 0 Neq: 2 Neqn: 2 @@ -38,5 +112,12 @@ CFSQP specific variables: Eps: 1e-08 Epseqn: 1e-08 Udelta: 1e-08 - CFSQP constraints: (0, 1), (1, 1) -Parameters (after): [5](-1e+10,-2.95264e-14,25,75,100) + CFSQP constraints: (0, 1), (3, 1), (3, 0), (4, 1), (4, 0), (5, 1), (5, 0), (6, 1), (6, 0), (7, 1), (7, 0), (8, 1), (8, 0), (9, 1), (9, 0), (10, 1), (10, 0), (11, 1), (11, 0), (12, 1), (12, 0), (13, 1), (13, 0), (1, 1), (2, 1) +Result: + Size (input, output): 5, 1 + X: [5](0.524762,-0.0213066,25.0162,74.9838,99.9787) + Value: [1](0.524762) + Constraints values: [14](0.524762,0.0213066,0.0213066,0,7.45503,29.8201,59.6082,89.3323,104.166,89.2815,59.5321,29.7694,7.44234,5.68434e-14) + Lambda: [25](0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) + Warnings: New iterate equivalent to previous one. +Parameters (after): [5](0.524762,-0.0213066,25.0162,74.9838,99.9787) diff --git a/tests/testsuite.at b/tests/testsuite.at index 6541760..59f145c 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -32,7 +32,7 @@ CHECK_STDOUT([simple], [Check basic features.]) CHECK_STDOUT([spline], [Check Spline class.]) CHECK_STDOUT([spline-gradient], [Check Spline gradient.]) CHECK_STDOUT([spline-optimization], [Optimize a Spline with Cfsqp.]) -CHECK_STDOUT([free-time-trajectory], [Check free time trajectory.], [false], [true]) -CHECK_STDOUT([spline-optimization-time], [Optimize a free time trajectory.], [false], [true]) +CHECK_STDOUT([free-time-trajectory], [Check free time trajectory.]) +CHECK_STDOUT([spline-optimization-time], [Optimize a free time trajectory.]) # End of testsuite.at commit ad435a753786cc84413be4bdd135e846f190cd09 Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 21:14:44 2009 +0900 Move time stable point gradient interface into Trajectory class. * include/Makefile.am: Distribue new header. * include/roboptim/trajectory/free-time-trajectory.hh:, * include/roboptim/trajectory/free-time-trajectory.hxx: Move gradient methods taking a stable time point as input into trajectory. * include/roboptim/trajectory/limit-speed.hh, * include/roboptim/trajectory/limit-speed.hxx: Add trajectory getter.. * include/roboptim/trajectory/stable-time-point.hh: Add missing inline. * include/roboptim/trajectory/trajectory.hh, * include/roboptim/trajectory/trajectory.hxx: Add gradient interfaces taking as input a stable time point.. * include/roboptim/trajectory/visualization/limit-speed.hh: New. * tests/spline-time-optimization.cc: Display speed limit. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 36613e0..8c85b58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 2009-07-23 Thomas Moulard <tho...@gm...> + Move time stable point gradient interface into Trajectory class. + * include/Makefile.am: Distribue new header. + * include/roboptim/trajectory/free-time-trajectory.hh:, + * include/roboptim/trajectory/free-time-trajectory.hxx: + Move gradient methods taking a stable time point as input + into trajectory. + * include/roboptim/trajectory/limit-speed.hh, + * include/roboptim/trajectory/limit-speed.hxx: Add trajectory getter.. + * include/roboptim/trajectory/stable-time-point.hh: Add missing inline. + * include/roboptim/trajectory/trajectory.hh, + * include/roboptim/trajectory/trajectory.hxx: Add gradient interfaces + taking as input a stable time point.. + * include/roboptim/trajectory/visualization/limit-speed.hh: New. + * tests/spline-time-optimization.cc: Display speed limit. + +2009-07-23 Thomas Moulard <tho...@gm...> + Fix computation error in free time trajectory. * include/roboptim/trajectory/free-time-trajectory.hxx: Fix computation error. diff --git a/include/Makefile.am b/include/Makefile.am index b8b3019..2ad8c9b 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -22,4 +22,5 @@ nobase_include_HEADERS = \ roboptim/trajectory/trajectory.hxx nobase_include_HEADERS += \ + roboptim/trajectory/visualization/limit-speed.hh \ roboptim/trajectory/visualization/trajectory.hh \ No newline at end of file diff --git a/include/roboptim/trajectory/free-time-trajectory.hh b/include/roboptim/trajectory/free-time-trajectory.hh index 9d58f4c..d9d1198 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hh +++ b/include/roboptim/trajectory/free-time-trajectory.hh @@ -18,7 +18,6 @@ #ifndef ROBOPTIM_TRAJECTORY_FREETIMETRAJECTORY_HH # define ROBOPTIM_TRAJECTORY_FREETIMETRAJECTORY_HH # include <roboptim/trajectory/trajectory.hh> -# include <roboptim/trajectory/stable-time-point.hh> namespace roboptim { @@ -51,9 +50,6 @@ namespace roboptim /// \brief Import interval type. typedef typename parent_t::interval_t interval_t; - using typename parent_t::operator (); - using typename parent_t::derivative; - /// Constructor with fixed definition interval trajectory /// /// \param traj trajectory defining this one by reparameterization @@ -76,45 +72,6 @@ namespace roboptim virtual vector_t derivAfterSingularPoint (size_type rank, size_type order) const; - result_t operator () (StableTimePoint argument) const throw () - { - result_t result (this->outputSize ()); - result.clear (); - (*this) (result, argument); - return result; - } - - void operator () (result_t& result, StableTimePoint argument) const throw () - { - assert (this->isValidResult (result)); - this->impl_compute (result, argument); - assert (this->isValidResult (result)); - } - - gradient_t derivative (StableTimePoint argument, size_type order = 1) const - throw () - { - gradient_t derivative (this->derivativeSize ()); - derivative.clear (); - this->derivative (derivative, argument, order); - return derivative; - } - - void derivative (gradient_t& derivative, - StableTimePoint argument, - size_type order = 1) const - throw () - { - assert (order <= Trajectory<DerivabilityOrder>::derivabilityOrder - && this->isValidDerivative (derivative)); - this->impl_derivative (derivative, argument, order); - assert (this->isValidDerivative (derivative)); - } - - virtual jacobian_t variationConfigWrtParam (StableTimePoint tp) const throw (); - virtual jacobian_t variationDerivWrtParam (StableTimePoint tp, size_type order) - const throw (); - virtual void setParameters (const vector_t&) throw (); /// \brief Get time scale factor. @@ -138,9 +95,6 @@ namespace roboptim void impl_compute (result_t&, double) const throw (); void impl_derivative (gradient_t& g, double x, size_type order) const throw (); - void impl_compute (result_t&, StableTimePoint) const throw (); - void impl_derivative (gradient_t& g, StableTimePoint, size_type order) - const throw (); private: /// \brief Scale input time argument. diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index ca8d308..efb4678 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -68,14 +68,12 @@ namespace roboptim { } - template <unsigned dorder> FreeTimeTrajectory<dorder>::~FreeTimeTrajectory () throw () { delete trajectory_; } - template <unsigned dorder> void FreeTimeTrajectory<dorder>::impl_compute @@ -86,14 +84,6 @@ namespace roboptim template <unsigned dorder> void - FreeTimeTrajectory<dorder>::impl_compute - (typename FreeTimeTrajectory<dorder>::result_t& res , StableTimePoint stp) const throw () - { - (*this) (res, stp.getTime (this->timeRange ())); - } - - template <unsigned dorder> - void FreeTimeTrajectory<dorder>::impl_derivative (typename FreeTimeTrajectory<dorder>::gradient_t& derivative, double t, @@ -106,32 +96,12 @@ namespace roboptim } template <unsigned dorder> - void - FreeTimeTrajectory<dorder>::impl_derivative - (typename FreeTimeTrajectory<dorder>::gradient_t& derivative, - StableTimePoint stp, - typename FreeTimeTrajectory<dorder>::size_type order) const throw () - { - return this->impl_derivative (derivative, - stp.getTime (this->timeRange ()), - order); - } - - template <unsigned dorder> typename FreeTimeTrajectory<dorder>::jacobian_t FreeTimeTrajectory<dorder>::variationConfigWrtParam (double t) const throw () { return this->variationDerivWrtParam (t, 0.); } - template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::jacobian_t - FreeTimeTrajectory<dorder>::variationConfigWrtParam (StableTimePoint stp) - const throw () - { - return this->variationConfigWrtParam (stp.getTime (this->timeRange ())); - } - //FIXME: check that! template <unsigned dorder> typename FreeTimeTrajectory<dorder>::jacobian_t @@ -158,16 +128,6 @@ namespace roboptim } template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::jacobian_t - FreeTimeTrajectory<dorder>::variationDerivWrtParam (StableTimePoint stp, - size_type order) - const throw () - { - return this->variationDerivWrtParam - (stp.getTime (this->timeRange ()), order); - } - - template <unsigned dorder> typename FreeTimeTrajectory<dorder>::value_type FreeTimeTrajectory<dorder>::singularPointAtRank (size_type rank) const { diff --git a/include/roboptim/trajectory/limit-speed.hh b/include/roboptim/trajectory/limit-speed.hh index 17ef6dc..850cad9 100644 --- a/include/roboptim/trajectory/limit-speed.hh +++ b/include/roboptim/trajectory/limit-speed.hh @@ -33,6 +33,8 @@ namespace roboptim LimitSpeed (StableTimePoint timePoint, const T& spline) throw (); ~LimitSpeed () throw (); + const T& trajectory () const throw (); + template <typename F, typename CLIST> static void addToProblem (const T&, Problem<F, CLIST>&, diff --git a/include/roboptim/trajectory/limit-speed.hxx b/include/roboptim/trajectory/limit-speed.hxx index a3a644c..e75d8b9 100644 --- a/include/roboptim/trajectory/limit-speed.hxx +++ b/include/roboptim/trajectory/limit-speed.hxx @@ -37,7 +37,14 @@ namespace roboptim template <typename T> LimitSpeed<T>::~LimitSpeed () throw () {} - + + template <typename T> + const T& + LimitSpeed<T>::trajectory () const throw () + { + return trajectory_; + } + template <typename T> void LimitSpeed<T>::impl_compute (result_t& res, const argument_t& p) const throw () diff --git a/include/roboptim/trajectory/stable-time-point.hh b/include/roboptim/trajectory/stable-time-point.hh index ce9256a..f2ff2e4 100644 --- a/include/roboptim/trajectory/stable-time-point.hh +++ b/include/roboptim/trajectory/stable-time-point.hh @@ -22,7 +22,7 @@ namespace roboptim { class TMax {}; - TMax tMax; + static const TMax tMax = TMax (); class StableTimePoint { @@ -53,12 +53,12 @@ namespace roboptim value_type alpha_; }; - StableTimePoint operator* (Function::value_type alpha, TMax) + inline StableTimePoint operator* (Function::value_type alpha, TMax) { return StableTimePoint (alpha); } - StableTimePoint operator* (TMax, Function::value_type alpha) + inline StableTimePoint operator* (TMax, Function::value_type alpha) { return StableTimePoint (alpha); } diff --git a/include/roboptim/trajectory/trajectory.hh b/include/roboptim/trajectory/trajectory.hh index 5754eb9..1dc0c9b 100644 --- a/include/roboptim/trajectory/trajectory.hh +++ b/include/roboptim/trajectory/trajectory.hh @@ -19,8 +19,9 @@ # define ROBOPTIM_TRAJECTORY_TRAJECTORY_HH # include <utility> -# include <roboptim/trajectory/fwd.hh> # include <roboptim/core/n-times-derivable-function.hh> +# include <roboptim/trajectory/fwd.hh> +# include <roboptim/trajectory/stable-time-point.hh> # define ROBOPTIM_IMPLEMENT_CLONE(C) \ virtual C* clone () const throw () \ @@ -73,12 +74,21 @@ namespace roboptim /// \brief Parent type. typedef NTimesDerivableFunction<DerivabilityOrder> parent_t; + using typename parent_t::operator (); + using typename parent_t::derivative; + using typename parent_t::impl_compute; + using typename parent_t::impl_derivative; + /// \brief Import value type. typedef typename parent_t::value_type value_type; /// \brief Import size type. typedef typename parent_t::size_type size_type; /// \brief Import vector type. typedef typename parent_t::vector_t vector_t; + /// \brief Import result type. + typedef typename parent_t::result_t result_t; + /// \brief Import gradient type. + typedef typename parent_t::gradient_t gradient_t; /// \brief Import jacobian type. typedef typename parent_t::jacobian_t jacobian_t; /// \brief Import interval type. @@ -179,10 +189,56 @@ namespace roboptim const = 0; /// \} + + result_t operator () (StableTimePoint argument) const throw () + { + result_t result (this->outputSize ()); + result.clear (); + (*this) (result, argument); + return result; + } + + void operator () (result_t& result, StableTimePoint argument) const throw () + { + assert (this->isValidResult (result)); + this->impl_compute (result, argument); + assert (this->isValidResult (result)); + } + + gradient_t derivative (StableTimePoint argument, size_type order = 1) const + throw () + { + gradient_t derivative (this->derivativeSize ()); + derivative.clear (); + this->derivative (derivative, argument, order); + return derivative; + } + + void derivative (gradient_t& derivative, + StableTimePoint argument, + size_type order = 1) const + throw () + { + assert (order <= Trajectory<DerivabilityOrder>::derivabilityOrder + && this->isValidDerivative (derivative)); + this->impl_derivative (derivative, argument, order); + assert (this->isValidDerivative (derivative)); + } + + virtual jacobian_t variationConfigWrtParam (StableTimePoint tp) const throw (); + virtual jacobian_t variationDerivWrtParam (StableTimePoint tp, size_type order) + const throw (); + + + virtual Trajectory<DerivabilityOrder>* clone () const throw () = 0; virtual std::ostream& print (std::ostream&) const throw (); protected: + void impl_compute (result_t&, StableTimePoint) const throw (); + void impl_derivative (gradient_t& g, StableTimePoint, size_type order) + const throw (); + Trajectory (interval_t, size_type, const vector_t&, std::string name = std::string ()) throw (); diff --git a/include/roboptim/trajectory/trajectory.hxx b/include/roboptim/trajectory/trajectory.hxx index a8a657b..3cc76f3 100644 --- a/include/roboptim/trajectory/trajectory.hxx +++ b/include/roboptim/trajectory/trajectory.hxx @@ -117,6 +117,46 @@ namespace roboptim return singularPoints_; } + + template <unsigned dorder> + void + Trajectory<dorder>::impl_compute + (typename Trajectory<dorder>::result_t& res , StableTimePoint stp) const throw () + { + (*this) (res, stp.getTime (this->timeRange ())); + } + + template <unsigned dorder> + void + Trajectory<dorder>::impl_derivative + (typename Trajectory<dorder>::gradient_t& derivative, + StableTimePoint stp, + typename Trajectory<dorder>::size_type order) const throw () + { + return this->impl_derivative (derivative, + stp.getTime (this->timeRange ()), + order); + } + + template <unsigned dorder> + typename Trajectory<dorder>::jacobian_t + Trajectory<dorder>::variationConfigWrtParam (StableTimePoint stp) + const throw () + { + return this->variationConfigWrtParam (stp.getTime (this->timeRange ())); + } + + + template <unsigned dorder> + typename Trajectory<dorder>::jacobian_t + Trajectory<dorder>::variationDerivWrtParam (StableTimePoint stp, + size_type order) + const throw () + { + return this->variationDerivWrtParam + (stp.getTime (this->timeRange ()), order); + } + template <unsigned dorder> std::ostream& Trajectory<dorder>::print (std::ostream& o) const throw () diff --git a/include/roboptim/trajectory/visualization/limit-speed.hh b/include/roboptim/trajectory/visualization/limit-speed.hh new file mode 100644 index 0000000..4c3c0ab --- /dev/null +++ b/include/roboptim/trajectory/visualization/limit-speed.hh @@ -0,0 +1,91 @@ +// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA. +// +// This file is part of the roboptim. +// +// roboptim is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// roboptim is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with roboptim. If not, see <http://www.gnu.org/licenses/>. + +#ifndef ROBOPTIM_TRAJECTORY_VISUALIZATION_TRAJECTORY_HH +# define ROBOPTIM_TRAJECTORY_VISUALIZATION_TRAJECTORY_HH +# include <boost/format.hpp> + +# include <roboptim/core/visualization/gnuplot-commands.hh> +# include <roboptim/trajectory/limit-speed.hh> + +namespace roboptim +{ + namespace visualization + { + namespace gnuplot + { + /// \brief Plot a speed limit constraint. + /// + /// \return Gnuplot command + template <unsigned dorder> + Command plot_limitSpeed + (const Trajectory<dorder>& trajectory, + typename Trajectory<dorder>::value_type step = .01); + + namespace detail + { + template <typename T> + struct PlotLimitSpeed + { + PlotLimitSpeed (const T& trajectory, std::string& str) + : trajectory_ (trajectory), + str_ (str) + {} + + void operator () (const Function::value_type& t) + { + using namespace boost::numeric::ublas; + using boost::format; + + double tmax = Function::getUpperBound (trajectory_.timeRange ()); + + LimitSpeed<T> speedLimit (t / tmax * tMax, trajectory_); + Function::vector_t res = speedLimit (trajectory_.parameters ()); + str_ += (format ("%1% %2%\n") % t % res[0]).str (); + } + + private: + const T& trajectory_; + std::string& str_; + }; + } // end of namespace detail. + + template <unsigned dorder> + Command plot_limitSpeed (const Trajectory<dorder>& trajectory, + typename Trajectory<dorder>::value_type step) + { + using namespace detail; + Function::value_type min = + Function::getLowerBound (trajectory.timeRange ()); + Function::value_type max = + Function::getUpperBound (trajectory.timeRange ()); + Function::discreteInterval_t interval (min, max, step); + + std::string str = (boost::format ("plot '-' title '%1%' with line\n") + % trajectory.getName ()).str (); + + trajectory.foreach + (interval, + PlotLimitSpeed<Trajectory<dorder> > (trajectory, str)); + str += "e\n"; + return Command (str); + } + } // end of namespace gnuplot. + } // end of namespace visualization. +} // end of namespace roboptim. + +#endif //! ROBOPTIM_TRAJECTORY_VISUALIZATION_TRAJECTORY_HH diff --git a/tests/spline-time-optimization.cc b/tests/spline-time-optimization.cc index d5eb57a..0eff8cc 100644 --- a/tests/spline-time-optimization.cc +++ b/tests/spline-time-optimization.cc @@ -15,6 +15,8 @@ // You should have received a copy of the GNU Lesser General Public License // along with roboptim. If not, see <http://www.gnu.org/licenses/>. +#include <fstream> + #include <boost/assign/list_of.hpp> #include <boost/mpl/vector.hpp> #include <boost/numeric/ublas/io.hpp> @@ -22,6 +24,10 @@ #include <roboptim/core/finite-difference-gradient.hh> #include <roboptim/core/solver-factory.hh> +#include <roboptim/core/visualization/gnuplot.hh> +#include <roboptim/core/visualization/gnuplot-commands.hh> +#include <roboptim/core/visualization/gnuplot-function.hh> + #include <roboptim/trajectory/free-time-trajectory.hh> #include <roboptim/trajectory/freeze.hh> #include <roboptim/trajectory/fwd.hh> @@ -30,9 +36,14 @@ #include <roboptim/trajectory/spline.hh> #include <roboptim/trajectory/trajectory-cost.hh> +#include <roboptim/trajectory/visualization/limit-speed.hh> + + #include "common.hh" using namespace roboptim; +using namespace roboptim::visualization; +using namespace roboptim::visualization::gnuplot; typedef boost::mpl::vector<DerivableFunction, LinearFunction> constraint_t; typedef Solver<DerivableFunction, constraint_t> solver_t; @@ -117,6 +128,10 @@ int run_test () optimizedTrajectory.setParameters (result.x); std::cout << "Parameters (after): " << optimizedTrajectory.parameters () << std::endl; + std::ofstream limitSpeedStream ("limit-speed.gp"); + limitSpeedStream + << (Gnuplot::make_interactive_gnuplot () + << plot_limitSpeed (optimizedTrajectory)); break; } @@ -134,6 +149,10 @@ int run_test () std::cout << result << std::endl; std::cout << "Parameters (after): " << optimizedTrajectory.parameters () << std::endl; + std::ofstream limitSpeedStream ("limit-speed.gp"); + limitSpeedStream + << (Gnuplot::make_interactive_gnuplot () + << plot_limitSpeed (optimizedTrajectory)); break; } @@ -144,6 +163,7 @@ int run_test () return 1; } } + return 0; } commit 5d903cc95a204dee7e86454f921c76fdb533a1a3 Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 18:11:31 2009 +0900 Fix computation error in free time trajectory. * include/roboptim/trajectory/free-time-trajectory.hxx: Fix computation error. * tests/spline-time-optimization.cc: Restyle. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b... [truncated message content] |
From: Thomas M. <tho...@us...> - 2009-07-23 08:03:08
|
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". The branch, trajectory has been updated via e68e36456ec09d884ee2dbad50eb067724d5a723 (commit) via d54d72128bb2da227d970fa804bb6dc3f34e3b52 (commit) via ca95fba1be9390c7fbd2021eba8722615bf8138c (commit) via 757e9e9de4b63f7269ac059951a6559b039ee531 (commit) from 3f7373f2c344ea0b64890e57c82cff5d59786e74 (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 e68e36456ec09d884ee2dbad50eb067724d5a723 Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 17:02:37 2009 +0900 Debug free time trajectory. * include/roboptim/trajectory/free-time-trajectory.hxx: Debug and clean code. * include/roboptim/trajectory/trajectory.hh: Add fixTime free function. * src/spline.cc: Remove fixTime free function. * tests/free-time-trajectory.cc: Add more tests. * tests/spline-optimization.cc: Use a bigger threshold for gradient checking. * tests/testsuite.at: Tag free-time-trajectory test as XFAIL for now. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 211c5b5..58000ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,20 @@ Debug free time trajectory. * include/roboptim/trajectory/free-time-trajectory.hxx: + Debug and clean code. + * include/roboptim/trajectory/trajectory.hh: Add fixTime + free function. + * src/spline.cc: Remove fixTime free function. + * tests/free-time-trajectory.cc: Add more tests. + * tests/spline-optimization.cc: Use a bigger threshold + for gradient checking. + * tests/testsuite.at: Tag free-time-trajectory test as XFAIL + for now. + +2009-07-23 Thomas Moulard <tho...@gm...> + + Debug free time trajectory. + * include/roboptim/trajectory/free-time-trajectory.hxx: Rewrite variationConfigWrtParam. * tests/free-time-trajectory.cc: Display derivatives. diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index fd820c0..a83e5ee 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -89,7 +89,7 @@ namespace roboptim FreeTimeTrajectory<dorder>::impl_compute (typename FreeTimeTrajectory<dorder>::result_t& res , StableTimePoint stp) const throw () { - (*trajectory_) (res, stp.getTime (trajectory_->timeRange ())); + (*this) (res, stp.getTime (this->timeRange ())); } template <unsigned dorder> @@ -112,29 +112,16 @@ namespace roboptim StableTimePoint stp, typename FreeTimeTrajectory<dorder>::size_type order) const throw () { - assert (order >= 0); - double scaled = stp.getTime (trajectory_->timeRange ()); - trajectory_->derivative (derivative, scaled, order); - derivative *= std::pow (this->timeScale (), 0. + order); + return this->impl_derivative (derivative, + stp.getTime (this->timeRange ()), + order); } template <unsigned dorder> typename FreeTimeTrajectory<dorder>::jacobian_t FreeTimeTrajectory<dorder>::variationConfigWrtParam (double t) const throw () { - double t_min = this->getLowerBound (this->timeRange ()); - double scaled = this->scaleTime (t); - jacobian_t jac = trajectory_->variationConfigWrtParam (scaled); - - // Last column corresponds to derivative wrt lambda_{p+1} - vector_t dGamma0_dt = trajectory_->derivative (scaled, 1); - dGamma0_dt *= (t - t_min); - - // Fill last column of Jacobian with dGamma0_dt - size_type timeScalingIndex = getTimeScalingIndex (); - for (size_type i = 0; i < jac.size1(); ++i) - jac (i, timeScalingIndex) = dGamma0_dt (i); - return jac; + return this->variationDerivWrtParam (t, 0.); } template <unsigned dorder> @@ -142,19 +129,16 @@ namespace roboptim FreeTimeTrajectory<dorder>::variationConfigWrtParam (StableTimePoint stp) const throw () { - return this->variationConfigWrtParam (stp.getTime (trajectory_->timeRange ())); + return this->variationConfigWrtParam (stp.getTime (this->timeRange ())); } + //FIXME: check that! template <unsigned dorder> typename FreeTimeTrajectory<dorder>::jacobian_t FreeTimeTrajectory<dorder>::variationDerivWrtParam (double t, size_type order) const throw () { using namespace boost::numeric::ublas; - - if (!order) - return variationConfigWrtParam (t); - value_type scaled = this->scaleTime (t); double tMin = this->getLowerBound (this->timeRange ()); @@ -180,15 +164,15 @@ namespace roboptim const throw () { return this->variationDerivWrtParam - (stp.getTime (trajectory_->timeRange ()), order); + (stp.getTime (this->timeRange ()), order); } template <unsigned dorder> typename FreeTimeTrajectory<dorder>::value_type FreeTimeTrajectory<dorder>::singularPointAtRank (size_type rank) const { - double t_min = this->getLowerBound (this->timeRange ()); - return t_min + (trajectory_->singularPointAtRank (rank) - t_min) + double tMin = this->getLowerBound (this->timeRange ()); + return tMin + (trajectory_->singularPointAtRank (rank) - tMin) / this->timeScale (); } @@ -216,8 +200,7 @@ namespace roboptim assert (p[0] > 0.); this->parameters_ = p; - this->timeRange_ = makeInterval(getLowerBound (trajectory_->timeRange ()), - p[0] * getUpperBound (trajectory_->timeRange ())); + this->timeRange_ = detail::scaleInterval (*trajectory_, this->timeScale ()); this->trajectory_->setParameters (removeScaleFromParameters (p)); } @@ -237,6 +220,7 @@ namespace roboptim value_type tmin = getLowerBound (this->trajectory_->timeRange ()); value_type tmax = getUpperBound (this->trajectory_->timeRange ()); + unscaled = detail::fixTime (unscaled, *this); assert (tMin <= unscaled && unscaled <= tMax); value_type res = tmin + (unscaled - tMin) / timeScale (); @@ -257,6 +241,7 @@ namespace roboptim value_type tmin = getLowerBound (this->trajectory_->timeRange ()); value_type tmax = getUpperBound (this->trajectory_->timeRange ()); + scaled = detail::fixTime (scaled, *this); assert (tmin <= scaled && scaled <= tmax); value_type res = tMin + (scaled - tmin) * timeScale (); diff --git a/include/roboptim/trajectory/trajectory.hh b/include/roboptim/trajectory/trajectory.hh index c720caa..5754eb9 100644 --- a/include/roboptim/trajectory/trajectory.hh +++ b/include/roboptim/trajectory/trajectory.hh @@ -30,6 +30,25 @@ namespace roboptim { + namespace detail + { + template <typename T> + double fixTime (double t, const T& trajectory); + + template <typename T> + double fixTime (double t, const T& trajectory) + { + static const double epsilon = 1e-5; + const double tmin = Function::getLowerBound (trajectory.timeRange ()); + const double tmax = Function::getUpperBound (trajectory.timeRange ()); + if (t < tmin && (t + epsilon) >= tmin) + return tmin; + if (t > tmax && (t - epsilon) <= tmax) + return tmax; + return t; + } + } // end of namespace detail. + /// \addtogroup roboptim_meta_function /// @{ diff --git a/src/spline.cc b/src/spline.cc index c605009..9d3de11 100644 --- a/src/spline.cc +++ b/src/spline.cc @@ -23,21 +23,6 @@ namespace roboptim { - namespace detail - { - // Allow small underflow and overflow of t. - double fixTime (double t, const Spline& spline) - { - static const double epsilon = 1e-5; - const double tmin = Function::getLowerBound (spline.timeRange ()); - const double tmax = Function::getUpperBound (spline.timeRange ()); - if (t < tmin && (t + epsilon) >= tmin) - return tmin; - if (t > tmax && (t - epsilon) <= tmax) - return tmax; - return t; - } - } // end of namespace detail. //FIXME: defined_lc_in has to be true (false untested). Spline::Spline (interval_t tr, size_type outputSize, const vector_t& p, diff --git a/tests/free-time-trajectory.cc b/tests/free-time-trajectory.cc index aac541b..478015f 100644 --- a/tests/free-time-trajectory.cc +++ b/tests/free-time-trajectory.cc @@ -76,13 +76,37 @@ void printTable (const Spline& spline, const freeTime_t& freeTimeTraj) fmter % "N/A"; fmter % freeTimeTraj.derivative (t, 1)[0]; - std:: cout << fmter << std::endl; } std::cout << "\\---------------------------------------" << "---------------------------------------/" << std::endl << std::endl; + std::cout << "Gradient check." << std::endl; + + for (double t = fttTmin; t <= fttTmax + 1e-3; t += .1) + { + if (t > fttTmax) + t = fttTmax; + + Spline::vector_t x (1); + x[0] = t; + + try + { + std::cout << "Spline gradient." << std::endl; + if (tmin <= t && t <= tmax) + checkGradientAndThrow (spline, 0, x); + std::cout << "Free time trajectory gradient." << std::endl; + checkGradientAndThrow (freeTimeTraj, 0, x); + } + catch (BadGradient& bg) + { + std::cout << bg << std::endl; + } + } + std::cout << std::endl; + std::cout << "Variation of the derivative w.r.t to parameters:" << std::endl; format fmterDeriv ("%1% %|50t|%2%"); diff --git a/tests/spline-optimization.cc b/tests/spline-optimization.cc index 0fd3f42..b55a229 100644 --- a/tests/spline-optimization.cc +++ b/tests/spline-optimization.cc @@ -93,36 +93,20 @@ int run_test () SplineLength cost (spline, costInterval); // Check cost gradient. + try { Function::vector_t x (params.size ()); x.clear (); - if (! checkGradient (cost, 0, x)) - { - FiniteDifferenceGradient fdfunction (cost); - DerivableFunction::gradient_t grad = cost.gradient (x, 0); - DerivableFunction::gradient_t fdgrad = fdfunction.gradient (x, 0); - - std::cerr << "Cost: " << cost (x) << std::endl - << "Grad: " << grad << std::endl - << "FD Grad: " << fdgrad << std::endl - << "Difference: " << grad - fdgrad << std::endl; - assert (0 && "Bad gradient"); - } + checkGradientAndThrow (cost, 0, x, 2e-3); x = params; - if (! checkGradient (cost, 0, x)) - { - FiniteDifferenceGradient fdfunction (cost); - DerivableFunction::gradient_t grad = cost.gradient (x, 0); - DerivableFunction::gradient_t fdgrad = fdfunction.gradient (x, 0); - - std::cerr << "Cost: " << cost (x) << std::endl - << "Grad: " << grad << std::endl - << "FD Grad: " << fdgrad << std::endl - << "Difference: " << grad - fdgrad << std::endl; - assert (0 && "Bad gradient"); - } + checkGradientAndThrow (cost, 0, x, 2e-3); } + catch (BadGradient& bg) + { + std::cout << bg << std::endl; + return 1; + } solver_t::problem_t problem (cost); problem.startingPoint () = params; @@ -183,21 +167,15 @@ int run_test () std::cerr << "Parameters (after): " << params << std::endl; // Check cost gradient (final). - { - if (! checkGradient (cost, 0, params)) - { - FiniteDifferenceGradient fdfunction (cost); - DerivableFunction::gradient_t grad = cost.gradient (params, 0); - DerivableFunction::gradient_t fdgrad = fdfunction.gradient (params, 0); - - std::cerr << "Cost: " << cost (params) << std::endl - << "Grad: " << grad << std::endl - << "FD Grad: " << fdgrad << std::endl - << "Difference: " << grad - fdgrad << std::endl; - assert (0 && "Bad gradient"); - } - } - + try + { + checkGradientAndThrow (cost, 0, params, 2e-3); + } + catch (BadGradient& bg) + { + std::cout << bg << std::endl; + return 1; + } std::cout << (gnuplot << unset ("multiplot")); return 0; diff --git a/tests/testsuite.at b/tests/testsuite.at index 523aecd..6541760 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -32,7 +32,7 @@ CHECK_STDOUT([simple], [Check basic features.]) CHECK_STDOUT([spline], [Check Spline class.]) CHECK_STDOUT([spline-gradient], [Check Spline gradient.]) CHECK_STDOUT([spline-optimization], [Optimize a Spline with Cfsqp.]) -CHECK_STDOUT([free-time-trajectory], [Check free time trajectory.]) +CHECK_STDOUT([free-time-trajectory], [Check free time trajectory.], [false], [true]) CHECK_STDOUT([spline-optimization-time], [Optimize a free time trajectory.], [false], [true]) # End of testsuite.at commit d54d72128bb2da227d970fa804bb6dc3f34e3b52 Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 14:26:41 2009 +0900 Debug free time trajectory. * include/roboptim/trajectory/free-time-trajectory.hxx: Rewrite variationConfigWrtParam. * tests/free-time-trajectory.cc: Display derivatives. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 34f4a2d..211c5b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-07-23 Thomas Moulard <tho...@gm...> + Debug free time trajectory. + * include/roboptim/trajectory/free-time-trajectory.hxx: + Rewrite variationConfigWrtParam. + * tests/free-time-trajectory.cc: Display derivatives. + +2009-07-23 Thomas Moulard <tho...@gm...> + Debug free time trajectory and add stable time point. * include/roboptim/trajectory/free-time-trajectory.hh, * include/roboptim/trajectory/free-time-trajectory.hxx: diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index 1f5ce6f..fd820c0 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -19,6 +19,9 @@ # define ROBOPTIM_TRAJECTORY_FREETIMETRAJECTORY_HXX # include <cmath> +# include <boost/numeric/ublas/matrix.hpp> +# include <boost/numeric/ublas/matrix_proxy.hpp> + namespace roboptim { namespace detail @@ -110,7 +113,7 @@ namespace roboptim typename FreeTimeTrajectory<dorder>::size_type order) const throw () { assert (order >= 0); - double scaled = stp.getTime (this->timeRange ()); + double scaled = stp.getTime (trajectory_->timeRange ()); trajectory_->derivative (derivative, scaled, order); derivative *= std::pow (this->timeScale (), 0. + order); } @@ -139,7 +142,7 @@ namespace roboptim FreeTimeTrajectory<dorder>::variationConfigWrtParam (StableTimePoint stp) const throw () { - return this->variationConfigWrtParam (stp.getTime (this->timeRange ())); + return this->variationConfigWrtParam (stp.getTime (trajectory_->timeRange ())); } template <unsigned dorder> @@ -147,35 +150,27 @@ namespace roboptim FreeTimeTrajectory<dorder>::variationDerivWrtParam (double t, size_type order) const throw () { + using namespace boost::numeric::ublas; + if (!order) return variationConfigWrtParam (t); - double t_min = this->getLowerBound (this->timeRange ()); - - double scaled = this->scaleTime (t); - jacobian_t jac = - trajectory_->variationDerivWrtParam (scaled, order); + value_type scaled = this->scaleTime (t); - double lambda_p_plus_1_pow_n_minus_1 = 1.; - for (size_type i = 0; i< order - 1; ++i) - lambda_p_plus_1_pow_n_minus_1 *= this->timeScale (); + double tMin = this->getLowerBound (this->timeRange ()); - jac *= lambda_p_plus_1_pow_n_minus_1 * this->timeScale (); + jacobian_t result (this->outputSize (), + this->parameters ().size ()); + result.clear (); - // Fill last column of Jacobian - vector_t lastColumn1 = trajectory_->derivative (scaled, order); - lastColumn1 *= order; + // Compute variation w.r.t time scale (p_0) + column (result, 0) = (t - tMin) * trajectory_->derivative (scaled); - vector_t lastColumn2 = trajectory_->derivative (scaled, order); - lastColumn2 *= this->timeScale () * (t-t_min); + // Fill 1..(n-1) lines with original jacobian. + project (result, range (0, result.size1 ()), range (1, result.size2 ())) + = trajectory_->variationDerivWrtParam (scaled, order); - vector_t lastColumn = - (lastColumn1 + lastColumn2) * lambda_p_plus_1_pow_n_minus_1; - - size_type timeScalingIndex = getTimeScalingIndex (); - for (size_type i = 0; i < jac.size1(); ++i) - jac (i, timeScalingIndex) = lastColumn (i); - return jac; + return result; } template <unsigned dorder> @@ -185,7 +180,7 @@ namespace roboptim const throw () { return this->variationDerivWrtParam - (stp.getTime (this->timeRange ()), order); + (stp.getTime (trajectory_->timeRange ()), order); } template <unsigned dorder> diff --git a/tests/free-time-trajectory.cc b/tests/free-time-trajectory.cc index fb30599..aac541b 100644 --- a/tests/free-time-trajectory.cc +++ b/tests/free-time-trajectory.cc @@ -16,6 +16,7 @@ // along with roboptim. If not, see <http://www.gnu.org/licenses/>. #include <boost/format.hpp> +#include <boost/numeric/ublas/io.hpp> #include <roboptim/core/finite-difference-gradient.hh> @@ -76,12 +77,37 @@ void printTable (const Spline& spline, const freeTime_t& freeTimeTraj) fmter % freeTimeTraj.derivative (t, 1)[0]; - std:: cout << fmter << std::endl; + std:: cout << fmter << std::endl; } std::cout << "\\---------------------------------------" - << "---------------------------------------/" + << "---------------------------------------/" << std::endl << std::endl; + + std::cout << "Variation of the derivative w.r.t to parameters:" << std::endl; + format fmterDeriv ("%1% %|50t|%2%"); + for (double t = fttTmin; t <= fttTmax + 1e-3; t += .1) + { + if (t > fttTmax) + t = fttTmax; + + if (tmin <= t && t <= tmax) + { + Spline::jacobian_t splineVarDeriv = + spline.variationDerivWrtParam (t, 1); + fmterDeriv % splineVarDeriv; + } + else + fmterDeriv % "N/A"; + + freeTime_t::jacobian_t fttVarDeriv = + freeTimeTraj.variationDerivWrtParam (t, 1); + fmterDeriv % fttVarDeriv; + + std::cout << fmterDeriv << std::endl; + } + + std::cout << std::endl; } int run_test () @@ -110,9 +136,9 @@ int run_test () freeTimeTraj.setParameters (params); printTable (spline, freeTimeTraj); -// params[0] = .5; -// freeTimeTraj.setParameters (params); -// printTable (spline, freeTimeTraj); + params[0] = .5; + freeTimeTraj.setParameters (params); + printTable (spline, freeTimeTraj); return 0; } commit ca95fba1be9390c7fbd2021eba8722615bf8138c Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 13:09:04 2009 +0900 Debug free time trajectory and add stable time point. * include/roboptim/trajectory/free-time-trajectory.hh, * include/roboptim/trajectory/free-time-trajectory.hxx: Add stable time point interface and debug. * tests/free-time-trajectory.cc: Add tests. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 8085809..34f4a2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-07-23 Thomas Moulard <tho...@gm...> + + Debug free time trajectory and add stable time point. + * include/roboptim/trajectory/free-time-trajectory.hh, + * include/roboptim/trajectory/free-time-trajectory.hxx: + Add stable time point interface and debug. + * tests/free-time-trajectory.cc: Add tests. + 2009-07-22 Thomas Moulard <tho...@gm...> Add TimeStablePoint interface into FreeTimeTrajectory. diff --git a/include/roboptim/trajectory/free-time-trajectory.hh b/include/roboptim/trajectory/free-time-trajectory.hh index 3caab1c..9d58f4c 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hh +++ b/include/roboptim/trajectory/free-time-trajectory.hh @@ -51,11 +51,15 @@ namespace roboptim /// \brief Import interval type. typedef typename parent_t::interval_t interval_t; + using typename parent_t::operator (); + using typename parent_t::derivative; + /// Constructor with fixed definition interval trajectory /// /// \param traj trajectory defining this one by reparameterization /// \param s time scale - FreeTimeTrajectory (const Trajectory<DerivabilityOrder>& traj, double s) throw (); + FreeTimeTrajectory (const Trajectory<DerivabilityOrder>& traj, value_type s) + throw (); FreeTimeTrajectory (const FreeTimeTrajectory<DerivabilityOrder>& traj) throw (); @@ -72,7 +76,6 @@ namespace roboptim virtual vector_t derivAfterSingularPoint (size_type rank, size_type order) const; - result_t operator () (StableTimePoint argument) const throw () { result_t result (this->outputSize ()); @@ -83,9 +86,9 @@ namespace roboptim void operator () (result_t& result, StableTimePoint argument) const throw () { - assert (isValidResult (result)); + assert (this->isValidResult (result)); this->impl_compute (result, argument); - assert (isValidResult (result)); + assert (this->isValidResult (result)); } gradient_t derivative (StableTimePoint argument, size_type order = 1) const @@ -116,7 +119,7 @@ namespace roboptim /// \brief Get time scale factor. /// \return time scale factor. - double timeScale () const throw (); + value_type timeScale () const throw (); size_type getTimeScalingIndex () const throw () { @@ -151,6 +154,7 @@ namespace roboptim /// \param t input time /// \return new scaled time double scaleTime (double t) const throw (); + double unscaleTime (double t) const throw (); /// \brief Input fixed time trajectory. Trajectory<DerivabilityOrder>* trajectory_; @@ -158,6 +162,32 @@ namespace roboptim /// @} + Function::vector_t + addScaleToParameters (const Function::vector_t& p, + Function::value_type t = 1.); + Function::vector_t + removeScaleFromParameters (const Function::vector_t& v); + + Function::vector_t + addScaleToParameters (const Function::vector_t& p, + Function::value_type t) + { + Function::vector_t res (p.size () + 1); + res[0] = t; + for (unsigned i = 0; i < p.size (); ++i) + res[i + 1] = p[i]; + return res; + } + + Function::vector_t + removeScaleFromParameters (const Function::vector_t& p) + { + Function::vector_t res (p.size () - 1); + for (unsigned i = 1; i < p.size (); ++i) + res[i - 1] = p[i]; + return res; + } + } // end of namespace roboptim. # include <roboptim/trajectory/free-time-trajectory.hxx> diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index 1635da2..1f5ce6f 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -23,40 +23,12 @@ namespace roboptim { namespace detail { - Function::vector_t - addScaleToParams (const Function::vector_t& p, - Function::value_type t = 1.); - - Function::vector_t - removeScaleFromParams (const Function::vector_t& v); - - - Function::vector_t - addScaleToParams (const Function::vector_t& p, - Function::value_type t) - { - Function::vector_t res (p.size () + 1); - res[0] = t; - for (unsigned i = 0; i < p.size (); ++i) - res[i + 1] = p[i]; - return res; - } - - Function::vector_t - removeScaleFromParams (const Function::vector_t& p) - { - Function::vector_t res (p.size () - 1); - for (unsigned i = 1; i < p.size (); ++i) - res[i - 1] = p[i]; - return res; - } - Function::value_type scaleTime (Function::value_type unscaled, Function::value_type min, Function::value_type scale) { - return min + scale * (unscaled - min); + return min + (unscaled - min) * scale; } template <unsigned dorder> @@ -75,10 +47,9 @@ namespace roboptim template <unsigned dorder> FreeTimeTrajectory<dorder>::FreeTimeTrajectory - (const Trajectory<dorder>& traj, double s) - throw () + (const Trajectory<dorder>& traj, value_type s) throw () : Trajectory<dorder> (detail::scaleInterval (traj, s), traj.outputSize (), - detail::addScaleToParams (traj.parameters (), s)), + addScaleToParameters (traj.parameters (), s)), trajectory_ (traj.clone ()) { assert (s != 0. && !std::isinf (s) && !std::isnan (s)); @@ -107,7 +78,7 @@ namespace roboptim FreeTimeTrajectory<dorder>::impl_compute (typename FreeTimeTrajectory<dorder>::result_t& res , double t) const throw () { - (*trajectory_) (t); + (*trajectory_) (res, this->scaleTime (t)); } template <unsigned dorder> @@ -115,7 +86,7 @@ namespace roboptim FreeTimeTrajectory<dorder>::impl_compute (typename FreeTimeTrajectory<dorder>::result_t& res , StableTimePoint stp) const throw () { - this->impl_compute (stp.getTime (this->timeRange ())); + (*trajectory_) (res, stp.getTime (trajectory_->timeRange ())); } template <unsigned dorder> @@ -125,13 +96,10 @@ namespace roboptim double t, typename FreeTimeTrajectory<dorder>::size_type order) const throw () { - double scaled = scaleTime (t); + assert (order >= 0); + double scaled = this->scaleTime (t); trajectory_->derivative (derivative, scaled, order); - - double coef = 1.; - for (size_t i = 0; i < order; ++i) - coef *= this->timeScale (); //FIXME: timeScale? - derivative *= coef; + derivative *= std::pow (this->timeScale (), 0. + order); } template <unsigned dorder> @@ -141,7 +109,10 @@ namespace roboptim StableTimePoint stp, typename FreeTimeTrajectory<dorder>::size_type order) const throw () { - this->impl_derivative (derivative, stp.getTime (this->timeRange ()), order); + assert (order >= 0); + double scaled = stp.getTime (this->timeRange ()); + trajectory_->derivative (derivative, scaled, order); + derivative *= std::pow (this->timeScale (), 0. + order); } template <unsigned dorder> @@ -149,7 +120,7 @@ namespace roboptim FreeTimeTrajectory<dorder>::variationConfigWrtParam (double t) const throw () { double t_min = this->getLowerBound (this->timeRange ()); - double scaled = scaleTime (t); + double scaled = this->scaleTime (t); jacobian_t jac = trajectory_->variationConfigWrtParam (scaled); // Last column corresponds to derivative wrt lambda_{p+1} @@ -181,7 +152,7 @@ namespace roboptim double t_min = this->getLowerBound (this->timeRange ()); - double scaled = scaleTime (t); + double scaled = this->scaleTime (t); jacobian_t jac = trajectory_->variationDerivWrtParam (scaled, order); @@ -247,16 +218,16 @@ namespace roboptim void FreeTimeTrajectory<dorder>::setParameters (const vector_t& p) throw () { - assert (p[0] >= 0.); + assert (p[0] > 0.); this->parameters_ = p; this->timeRange_ = makeInterval(getLowerBound (trajectory_->timeRange ()), p[0] * getUpperBound (trajectory_->timeRange ())); - this->trajectory_->setParameters (detail::removeScaleFromParams (p)); + this->trajectory_->setParameters (removeScaleFromParameters (p)); } template <unsigned dorder> - double + typename FreeTimeTrajectory<dorder>::value_type FreeTimeTrajectory<dorder>::timeScale () const throw () { return this->parameters_[0]; @@ -266,14 +237,34 @@ namespace roboptim double FreeTimeTrajectory<dorder>::scaleTime (double unscaled) const throw () { - value_type tmin = getLowerBound (this->timeRange ()); - value_type tmax = getUpperBound (this->timeRange ()); - value_type tMin = getLowerBound (this->trajectory_->timeRange ()); - value_type tMax = getUpperBound (this->trajectory_->timeRange ()); + value_type tMin = getLowerBound (this->timeRange ()); + value_type tMax = getUpperBound (this->timeRange ()); + value_type tmin = getLowerBound (this->trajectory_->timeRange ()); + value_type tmax = getUpperBound (this->trajectory_->timeRange ()); + + assert (tMin <= unscaled && unscaled <= tMax); + + value_type res = tmin + (unscaled - tMin) / timeScale (); + + if (res > tmax) + res = tmax; + else if (res < tmin) + res = tmin; + return res; + } + + template <unsigned dorder> + double + FreeTimeTrajectory<dorder>::unscaleTime (double scaled) const throw () + { + value_type tMin = getLowerBound (this->timeRange ()); + value_type tMax = getUpperBound (this->timeRange ()); + value_type tmin = getLowerBound (this->trajectory_->timeRange ()); + value_type tmax = getUpperBound (this->trajectory_->timeRange ()); - assert (tmin <= unscaled && unscaled <= tmax); + assert (tmin <= scaled && scaled <= tmax); - value_type res = tMin + (unscaled - tmin) / timeScale (); + value_type res = tMin + (scaled - tmin) * timeScale (); if (res > tMax) res = tMax; diff --git a/tests/free-time-trajectory.cc b/tests/free-time-trajectory.cc index 8ccdf25..fb30599 100644 --- a/tests/free-time-trajectory.cc +++ b/tests/free-time-trajectory.cc @@ -15,10 +15,105 @@ // You should have received a copy of the GNU Lesser General Public License // along with roboptim. If not, see <http://www.gnu.org/licenses/>. +#include <boost/format.hpp> + +#include <roboptim/core/finite-difference-gradient.hh> + +#include <roboptim/trajectory/free-time-trajectory.hh> +#include <roboptim/trajectory/fwd.hh> +#include <roboptim/trajectory/spline.hh> +#include <roboptim/trajectory/trajectory-cost.hh> + #include "common.hh" +using boost::format; +using boost::io::group; + +using namespace roboptim; + + +typedef FreeTimeTrajectory<Spline::derivabilityOrder> freeTime_t; + + +void printTable (const Spline& spline, const freeTime_t& freeTimeTraj); + +void printTable (const Spline& spline, const freeTime_t& freeTimeTraj) +{ + double tmin = Function::getLowerBound (spline.timeRange ()); + double tmax = Function::getUpperBound (spline.timeRange ()); + double fttTmin = Function::getLowerBound (freeTimeTraj.timeRange ()); + double fttTmax = Function::getUpperBound (freeTimeTraj.timeRange ()); + + std::cout << format ("Spline range: [%1%, %2%]") % tmin % tmax << std::endl + << format ("FTT range: [%1%, %2%]") % fttTmin % fttTmax << std::endl; + + format fmter ("| %1% %|6t||| %2% %|20t|| %3% %|35t||| %4% %|55t|| %5% %|79t||"); + std::cout << "/---------------------------------------" + << "---------------------------------------\\" << std::endl + << fmter + % "T" % "Value" % "Value (ftt)" + % "Derivative" % "Derivative (ftt)" + << std::endl + << "----------------------------------------" + << "----------------------------------------" + << std::endl; + + for (double t = fttTmin; t <= fttTmax + 1e-3; t += .1) + { + if (t > fttTmax) + t = fttTmax; + + fmter % t; + if (tmin <= t && t <= tmax) + fmter % spline (t)[0]; + else + fmter % "N/A"; + fmter % freeTimeTraj (t)[0]; + if (tmin <= t && t <= tmax) + fmter % spline.derivative (t, 1)[0]; + else + fmter % "N/A"; + fmter % freeTimeTraj.derivative (t, 1)[0]; + + + std:: cout << fmter << std::endl; + } + std::cout << "\\---------------------------------------" + << "---------------------------------------/" + << std::endl << std::endl; + +} + int run_test () { + Spline::vector_t params (5); + + // Scale. + params[0] = 1.; + // Initial position. + params[1] = 0.; + // Control point 1. + params[2] = 25.; + // Control point 2. + params[3] = 75.; + // Final position. + params[4] = 100.; + + // Make trajectories. + Spline::interval_t timeRange = Spline::makeInterval (0., 4.); + Spline spline (timeRange, 1, removeScaleFromParameters (params), "before"); + FreeTimeTrajectory<Spline::derivabilityOrder> freeTimeTraj (spline, 1.); + + printTable (spline, freeTimeTraj); + + params[0] = 2.; + freeTimeTraj.setParameters (params); + printTable (spline, freeTimeTraj); + +// params[0] = .5; +// freeTimeTraj.setParameters (params); +// printTable (spline, freeTimeTraj); + return 0; } commit 757e9e9de4b63f7269ac059951a6559b039ee531 Author: Thomas Moulard <tho...@gm...> Date: Wed Jul 22 15:10:52 2009 +0900 Add TimeStablePoint interface into FreeTimeTrajectory. * include/roboptim/trajectory/free-time-trajectory.hh, * include/roboptim/trajectory/free-time-trajectory.hxx: Add TimeStablePoint interface. * include/roboptim/trajectory/limit-speed.hxx: Use new interface. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 89faae2..8085809 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-07-22 Thomas Moulard <tho...@gm...> + + Add TimeStablePoint interface into FreeTimeTrajectory. + * include/roboptim/trajectory/free-time-trajectory.hh, + * include/roboptim/trajectory/free-time-trajectory.hxx: + Add TimeStablePoint interface. + * include/roboptim/trajectory/limit-speed.hxx: Use new interface. + 2009-07-17 Thomas Moulard <tho...@gm...> Add missing include. diff --git a/include/roboptim/trajectory/free-time-trajectory.hh b/include/roboptim/trajectory/free-time-trajectory.hh index 80c5719..3caab1c 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hh +++ b/include/roboptim/trajectory/free-time-trajectory.hh @@ -65,13 +65,52 @@ namespace roboptim virtual jacobian_t variationConfigWrtParam (double t) const throw (); virtual jacobian_t variationDerivWrtParam (double t, size_type order) const throw (); + virtual value_type singularPointAtRank (size_type rank) const; virtual vector_t derivBeforeSingularPoint (size_type rank, size_type order) const; virtual vector_t derivAfterSingularPoint (size_type rank, size_type order) const; - //FIXME: add stable time point gradient computation. + + result_t operator () (StableTimePoint argument) const throw () + { + result_t result (this->outputSize ()); + result.clear (); + (*this) (result, argument); + return result; + } + + void operator () (result_t& result, StableTimePoint argument) const throw () + { + assert (isValidResult (result)); + this->impl_compute (result, argument); + assert (isValidResult (result)); + } + + gradient_t derivative (StableTimePoint argument, size_type order = 1) const + throw () + { + gradient_t derivative (this->derivativeSize ()); + derivative.clear (); + this->derivative (derivative, argument, order); + return derivative; + } + + void derivative (gradient_t& derivative, + StableTimePoint argument, + size_type order = 1) const + throw () + { + assert (order <= Trajectory<DerivabilityOrder>::derivabilityOrder + && this->isValidDerivative (derivative)); + this->impl_derivative (derivative, argument, order); + assert (this->isValidDerivative (derivative)); + } + + virtual jacobian_t variationConfigWrtParam (StableTimePoint tp) const throw (); + virtual jacobian_t variationDerivWrtParam (StableTimePoint tp, size_type order) + const throw (); virtual void setParameters (const vector_t&) throw (); @@ -84,7 +123,7 @@ namespace roboptim return 0; } - ROBOPTIM_IMPLEMENT_CLONE(FreeTimeTrajectory<DerivabilityOrder>) + ROBOPTIM_IMPLEMENT_CLONE (FreeTimeTrajectory<DerivabilityOrder>) /// \brief Display the function on the specified output stream. /// @@ -96,6 +135,9 @@ namespace roboptim void impl_compute (result_t&, double) const throw (); void impl_derivative (gradient_t& g, double x, size_type order) const throw (); + void impl_compute (result_t&, StableTimePoint) const throw (); + void impl_derivative (gradient_t& g, StableTimePoint, size_type order) + const throw (); private: /// \brief Scale input time argument. diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index 017c50d..1635da2 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -107,7 +107,15 @@ namespace roboptim FreeTimeTrajectory<dorder>::impl_compute (typename FreeTimeTrajectory<dorder>::result_t& res , double t) const throw () { - (*trajectory_) (scaleTime (t)); + (*trajectory_) (t); + } + + template <unsigned dorder> + void + FreeTimeTrajectory<dorder>::impl_compute + (typename FreeTimeTrajectory<dorder>::result_t& res , StableTimePoint stp) const throw () + { + this->impl_compute (stp.getTime (this->timeRange ())); } template <unsigned dorder> @@ -127,6 +135,16 @@ namespace roboptim } template <unsigned dorder> + void + FreeTimeTrajectory<dorder>::impl_derivative + (typename FreeTimeTrajectory<dorder>::gradient_t& derivative, + StableTimePoint stp, + typename FreeTimeTrajectory<dorder>::size_type order) const throw () + { + this->impl_derivative (derivative, stp.getTime (this->timeRange ()), order); + } + + template <unsigned dorder> typename FreeTimeTrajectory<dorder>::jacobian_t FreeTimeTrajectory<dorder>::variationConfigWrtParam (double t) const throw () { @@ -147,6 +165,14 @@ namespace roboptim template <unsigned dorder> typename FreeTimeTrajectory<dorder>::jacobian_t + FreeTimeTrajectory<dorder>::variationConfigWrtParam (StableTimePoint stp) + const throw () + { + return this->variationConfigWrtParam (stp.getTime (this->timeRange ())); + } + + template <unsigned dorder> + typename FreeTimeTrajectory<dorder>::jacobian_t FreeTimeTrajectory<dorder>::variationDerivWrtParam (double t, size_type order) const throw () { @@ -182,6 +208,16 @@ namespace roboptim } template <unsigned dorder> + typename FreeTimeTrajectory<dorder>::jacobian_t + FreeTimeTrajectory<dorder>::variationDerivWrtParam (StableTimePoint stp, + size_type order) + const throw () + { + return this->variationDerivWrtParam + (stp.getTime (this->timeRange ()), order); + } + + template <unsigned dorder> typename FreeTimeTrajectory<dorder>::value_type FreeTimeTrajectory<dorder>::singularPointAtRank (size_type rank) const { diff --git a/include/roboptim/trajectory/limit-speed.hxx b/include/roboptim/trajectory/limit-speed.hxx index f803d68..a3a644c 100644 --- a/include/roboptim/trajectory/limit-speed.hxx +++ b/include/roboptim/trajectory/limit-speed.hxx @@ -47,11 +47,7 @@ namespace roboptim boost::scoped_ptr<T> updatedTrajectory (trajectory_.clone ()); updatedTrajectory->setParameters (p); - - //FIXME: should be done in updatedTrajectory! - value_type t = - timePoint_.getTime (updatedTrajectory->timeRange ()); - res[0] = norm_2 (updatedTrajectory->derivative (t)); + res[0] = norm_2 (updatedTrajectory->derivative (timePoint_)); } template <typename T> ----------------------------------------------------------------------- Summary of changes: ChangeLog | 37 ++++ .../roboptim/trajectory/free-time-trajectory.hh | 80 ++++++++- .../roboptim/trajectory/free-time-trajectory.hxx | 181 ++++++++++---------- include/roboptim/trajectory/limit-speed.hxx | 6 +- include/roboptim/trajectory/trajectory.hh | 19 ++ src/spline.cc | 15 -- tests/free-time-trajectory.cc | 145 ++++++++++++++++ tests/spline-optimization.cc | 56 ++----- tests/testsuite.at | 2 +- 9 files changed, 390 insertions(+), 151 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-23 07:57:42
|
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". The branch, core has been updated via 3f3c267127fb151702e2d6e955f4d8da03af721e (commit) from 418a767ab2f1fd2e490077fc8e1fedaf3502b13b (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 3f3c267127fb151702e2d6e955f4d8da03af721e Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 16:57:16 2009 +0900 Clean finite difference gradient code. * src/finite-difference-gradient.cc: Fix typo and use norm_inf from uBlas instead of computing it manually. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 2f29542..26acf40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-07-23 Thomas Moulard <tho...@gm...> + Clean finite difference gradient code. + * src/finite-difference-gradient.cc: Fix typo and use + norm_inf from uBlas instead of computing it manually. + +2009-07-23 Thomas Moulard <tho...@gm...> + Enhance finite difference computation. * include/roboptim/core/finite-difference-gradient.hh: Add BadGradient exception class and add checkGradientAndThrow diff --git a/src/finite-difference-gradient.cc b/src/finite-difference-gradient.cc index f8cd62e..f15f779 100644 --- a/src/finite-difference-gradient.cc +++ b/src/finite-difference-gradient.cc @@ -33,13 +33,8 @@ namespace roboptim maxDelta_ (), threshold_ (threshold) { - gradient_t delta = analyticalGradient - finiteDifferenceGradient; - for (unsigned i = 0; i < delta.size (); ++i) - { - delta[i] = fabs (delta[i]); - if (maxDelta_ < delta[i]) - maxDelta_ = delta[i]; - } + using boost::numeric::ublas::norm_inf; + maxDelta_ = norm_inf (analyticalGradient - finiteDifferenceGradient); } BadGradient::~BadGradient () throw () @@ -54,7 +49,7 @@ namespace roboptim << "Finite difference gradient: " << finiteDifferenceGradient_ << iendl << "Max. delta: " << maxDelta_ << iendl - << "Max. allowed delta): " << threshold_ << decindent; + << "Max. allowed delta: " << threshold_ << decindent; return o; } ----------------------------------------------------------------------- Summary of changes: ChangeLog | 6 ++++++ src/finite-difference-gradient.cc | 11 +++-------- 2 files changed, 9 insertions(+), 8 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-23 07:00:58
|
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". The branch, core has been updated via 418a767ab2f1fd2e490077fc8e1fedaf3502b13b (commit) from 3e805364b175388f3cc1c0c5cd9bd3e38cad9e41 (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 418a767ab2f1fd2e490077fc8e1fedaf3502b13b Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 16:00:37 2009 +0900 Enhance finite difference computation. * include/roboptim/core/finite-difference-gradient.hh: Add BadGradient exception class and add checkGradientAndThrow free function. * src/finite-difference-gradient.cc: Implement new class and free function. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 0def12e..2f29542 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2009-07-23 Thomas Moulard <tho...@gm...> + Enhance finite difference computation. + * include/roboptim/core/finite-difference-gradient.hh: + Add BadGradient exception class and add checkGradientAndThrow + free function. + * src/finite-difference-gradient.cc: Implement new class and free + function. + +2009-07-23 Thomas Moulard <tho...@gm...> + Enhance finite difference gradient computaton. * include/roboptim/core/finite-difference-gradient.hh: Add missing const in checkGradient signature, fix default diff --git a/include/roboptim/core/finite-difference-gradient.hh b/include/roboptim/core/finite-difference-gradient.hh index 14371e6..599e57b 100644 --- a/include/roboptim/core/finite-difference-gradient.hh +++ b/include/roboptim/core/finite-difference-gradient.hh @@ -17,12 +17,68 @@ #ifndef ROBOPTIM_CORE_FINITE_DIFFERENCE_GRADIENT_HH # define ROBOPTIM_CORE_FINITE_DIFFERENCE_GRADIENT_HH +# include <stdexcept> # include <roboptim/core/fwd.hh> # include <roboptim/core/derivable-function.hh> namespace roboptim { + /// \brief Default threshold for checkGradient. + static const double finiteDifferenceThreshold = 1e-4; + /// \brief Default epsilon for finite difference class. + static const double finiteDifferenceEpsilon = 1e-8; + + /// \brief Exception thrown when a gradient check fail. + class BadGradient : public std::runtime_error + { + public: + /// \brief Import vector. + typedef DerivableFunction::vector_t vector_t; + /// \brief Import gradient. + typedef DerivableFunction::gradient_t gradient_t; + /// \brief Import value_type. + typedef DerivableFunction::value_type value_type; + + /// \brief Default constructor. + BadGradient (const vector_t& x, + const gradient_t& analyticalGradient, + const gradient_t& finiteDifferenceGradient, + const value_type& threshold); + + virtual ~BadGradient () throw (); + + /// \brief Display the exception on the specified output stream. + /// + /// \param o output stream used for display + /// \return output stream + virtual std::ostream& print (std::ostream& o) const throw (); + + + /// \brief Gradient has been computed for this point. + vector_t x_; + + /// \brief Analytical gradient. + gradient_t analyticalGradient_; + + /// \brief Gradient computed through finite differences. + gradient_t finiteDifferenceGradient_; + + /// \brief Maximum error. + value_type maxDelta_; + + /// \brief Allowed threshold. + value_type threshold_; + }; + + /// \brief Override operator<< to handle exception display. + /// + /// \param o output stream used for display + /// \param f function to be displayed + /// \return output stream + std::ostream& operator<< (std::ostream& o, const BadGradient& f); + + /// \addtogroup roboptim_function /// @{ @@ -49,7 +105,9 @@ namespace roboptim /// using finite differences. /// \param f function that will e wrapped /// \param e epsilon used in finite difference computation - FiniteDifferenceGradient (const Function& f, value_type e = 1e-8) throw (); + FiniteDifferenceGradient (const Function& f, + value_type e = finiteDifferenceEpsilon) + throw (); ~FiniteDifferenceGradient () throw (); protected: @@ -73,11 +131,19 @@ namespace roboptim /// \param x point where the gradient will be evaluated /// \param threshold maximum tolerated error /// \return true if valid, false if not - bool checkGradient (const DerivableFunction& function, - int functionId, - const Function::vector_t& x, - Function::value_type threshold = 1e-4) throw (); + bool checkGradient + (const DerivableFunction& function, + int functionId, + const Function::vector_t& x, + Function::value_type threshold = finiteDifferenceThreshold) + throw (); + void checkGradientAndThrow + (const DerivableFunction& function, + int functionId, + const Function::vector_t& x, + Function::value_type threshold = finiteDifferenceThreshold) + throw (BadGradient); /// Example shows finite differences gradient use. /// \example finite-difference-gradient.cc diff --git a/src/finite-difference-gradient.cc b/src/finite-difference-gradient.cc index 224244a..f8cd62e 100644 --- a/src/finite-difference-gradient.cc +++ b/src/finite-difference-gradient.cc @@ -15,10 +15,57 @@ // You should have received a copy of the GNU Lesser General Public License // along with roboptim. If not, see <http://www.gnu.org/licenses/>. +#include <boost/numeric/ublas/io.hpp> + +#include <roboptim/core/indent.hh> #include <roboptim/core/finite-difference-gradient.hh> namespace roboptim { + BadGradient::BadGradient (const vector_t& x, + const gradient_t& analyticalGradient, + const gradient_t& finiteDifferenceGradient, + const value_type& threshold) + : std::runtime_error ("bad gradient"), + x_ (x), + analyticalGradient_ (analyticalGradient), + finiteDifferenceGradient_ (finiteDifferenceGradient), + maxDelta_ (), + threshold_ (threshold) + { + gradient_t delta = analyticalGradient - finiteDifferenceGradient; + for (unsigned i = 0; i < delta.size (); ++i) + { + delta[i] = fabs (delta[i]); + if (maxDelta_ < delta[i]) + maxDelta_ = delta[i]; + } + } + + BadGradient::~BadGradient () throw () + {} + + std::ostream& + BadGradient::print (std::ostream& o) const throw () + { + o << this->what () << incindent << iendl + << "X: " << x_ << iendl + << "Analytical gradient: " << analyticalGradient_ << iendl + << "Finite difference gradient: " << finiteDifferenceGradient_ + << iendl + << "Max. delta: " << maxDelta_ << iendl + << "Max. allowed delta): " << threshold_ << decindent; + return o; + } + + std::ostream& + operator<< (std::ostream& o, const BadGradient& bg) + { + return bg.print (o); + } + + + FiniteDifferenceGradient::FiniteDifferenceGradient (const Function& adaptee, value_type epsilon) throw () @@ -62,10 +109,11 @@ namespace roboptim } - bool checkGradient (const DerivableFunction& function, - int i, - const Function::vector_t& x, - Function::value_type threshold) throw () + bool + checkGradient (const DerivableFunction& function, + int i, + const Function::vector_t& x, + Function::value_type threshold) throw () { FiniteDifferenceGradient fdfunction (function); DerivableFunction::gradient_t grad = function.gradient (x, i); @@ -77,4 +125,19 @@ namespace roboptim return true; } + void + checkGradientAndThrow (const DerivableFunction& function, + int i, + const Function::vector_t& x, + Function::value_type threshold) + throw (BadGradient) + { + FiniteDifferenceGradient fdfunction (function); + DerivableFunction::gradient_t grad = function.gradient (x, i); + DerivableFunction::gradient_t fdgrad = fdfunction.gradient (x, i); + + if (!checkGradient (function, i, x, threshold)) + throw BadGradient (x, grad, fdgrad, threshold); + } + } // end of namespace roboptim ----------------------------------------------------------------------- Summary of changes: ChangeLog | 9 +++ .../roboptim/core/finite-difference-gradient.hh | 76 ++++++++++++++++++-- src/finite-difference-gradient.cc | 71 +++++++++++++++++- 3 files changed, 147 insertions(+), 9 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-23 06:05:39
|
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". The branch, core has been updated via 3e805364b175388f3cc1c0c5cd9bd3e38cad9e41 (commit) from 6c7ea9d13dd20234aebd4ca93b3ab1f44d0cb4bb (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 3e805364b175388f3cc1c0c5cd9bd3e38cad9e41 Author: Thomas Moulard <tho...@gm...> Date: Thu Jul 23 15:05:06 2009 +0900 Enhance finite difference gradient computaton. * include/roboptim/core/finite-difference-gradient.hh: Add missing const in checkGradient signature, fix default epsilon and threshold. * src/finite-difference-gradient.cc: Remove useless test in finite difference gradient computation, be more strict about allowed epsilon values. * tests/finite-difference-gradient.stdout: Regenerate. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 77eb97f..0def12e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-07-23 Thomas Moulard <tho...@gm...> + + Enhance finite difference gradient computaton. + * include/roboptim/core/finite-difference-gradient.hh: + Add missing const in checkGradient signature, fix default + epsilon and threshold. + * src/finite-difference-gradient.cc: Remove useless + test in finite difference gradient computation, be + more strict about allowed epsilon values. + * tests/finite-difference-gradient.stdout: Regenerate. + 2009-07-15 Thomas Moulard <tho...@gm...> Display function's names in Gnuplot. diff --git a/include/roboptim/core/finite-difference-gradient.hh b/include/roboptim/core/finite-difference-gradient.hh index 74121ea..14371e6 100644 --- a/include/roboptim/core/finite-difference-gradient.hh +++ b/include/roboptim/core/finite-difference-gradient.hh @@ -49,7 +49,7 @@ namespace roboptim /// using finite differences. /// \param f function that will e wrapped /// \param e epsilon used in finite difference computation - FiniteDifferenceGradient (const Function& f, value_type e = 1e-4) throw (); + FiniteDifferenceGradient (const Function& f, value_type e = 1e-8) throw (); ~FiniteDifferenceGradient () throw (); protected: @@ -73,10 +73,10 @@ namespace roboptim /// \param x point where the gradient will be evaluated /// \param threshold maximum tolerated error /// \return true if valid, false if not - bool checkGradient (DerivableFunction& function, + bool checkGradient (const DerivableFunction& function, int functionId, const Function::vector_t& x, - Function::value_type threshold = .001) throw (); + Function::value_type threshold = 1e-4) throw (); /// Example shows finite differences gradient use. diff --git a/src/finite-difference-gradient.cc b/src/finite-difference-gradient.cc index e53b545..224244a 100644 --- a/src/finite-difference-gradient.cc +++ b/src/finite-difference-gradient.cc @@ -26,7 +26,8 @@ namespace roboptim adaptee_ (adaptee), epsilon_ (epsilon) { - assert (epsilon != 0.); + // Avoid meaningless values for epsilon such as 0 or NaN. + assert (epsilon != 0. && epsilon == epsilon); } FiniteDifferenceGradient::~FiniteDifferenceGradient () throw () @@ -57,15 +58,11 @@ namespace roboptim result_t resEps = adaptee_ (xEps); gradient (j) = (resEps[idFunction] - res[idFunction]) / epsilon_; - - // Avoid returning NaN if gradient is almost null. - if (gradient (j) != gradient (j)) - gradient (j) = 0.; } } - bool checkGradient (DerivableFunction& function, + bool checkGradient (const DerivableFunction& function, int i, const Function::vector_t& x, Function::value_type threshold) throw () diff --git a/tests/finite-difference-gradient.stdout b/tests/finite-difference-gradient.stdout index 5e101c8..dc7e8dc 100644 --- a/tests/finite-difference-gradient.stdout +++ b/tests/finite-difference-gradient.stdout @@ -1,243 +1,243 @@ #Check gradient at x = -10 # Good #[1](-20) -#[1](-19.9999) +#[1](-20) # Bad #[1](-8) -#[1](-19.9999) +#[1](-20) # Circle #[1](-0.839072) -#[1](-0.839099) +#[1](-0.839072) +#[1](-0.544021) #[1](-0.544021) -#[1](-0.543979) #Check gradient at x = -9 # Good #[1](-18) -#[1](-17.9999) +#[1](-18) # Bad #[1](-3) -#[1](-17.9999) +#[1](-18) # Circle #[1](-0.91113) -#[1](-0.91111) +#[1](-0.91113) #[1](0.412118) -#[1](0.412164) +#[1](0.412119) #Check gradient at x = -8 # Good #[1](-16) -#[1](-15.9999) +#[1](-16) # Bad #[1](2) -#[1](-15.9999) +#[1](-16) # Circle #[1](-0.1455) -#[1](-0.145451) +#[1](-0.1455) +#[1](0.989358) #[1](0.989358) -#[1](0.989366) #Check gradient at x = -7 # Good #[1](-14) -#[1](-13.9999) +#[1](-14) # Bad #[1](7) -#[1](-13.9999) +#[1](-14) # Circle #[1](0.753902) -#[1](0.753935) +#[1](0.753902) +#[1](0.656987) #[1](0.656987) -#[1](0.656949) #Check gradient at x = -6 # Good #[1](-12) -#[1](-11.9999) +#[1](-12) # Bad #[1](12) -#[1](-11.9999) +#[1](-12) # Circle #[1](0.96017) -#[1](0.960156) +#[1](0.96017) +#[1](-0.279415) #[1](-0.279415) -#[1](-0.279464) #Check gradient at x = -5 # Good #[1](-10) -#[1](-9.9999) +#[1](-10) # Bad #[1](17) -#[1](-9.9999) +#[1](-10) # Circle #[1](0.283662) -#[1](0.283614) +#[1](0.283662) +#[1](-0.958924) #[1](-0.958924) -#[1](-0.958938) #Check gradient at x = -4 # Good #[1](-8) -#[1](-7.9999) +#[1](-8) # Bad #[1](22) -#[1](-7.9999) +#[1](-8) # Circle #[1](-0.653644) -#[1](-0.653681) +#[1](-0.653644) +#[1](-0.756802) #[1](-0.756802) -#[1](-0.75677) #Check gradient at x = -3 # Good #[1](-6) -#[1](-5.9999) +#[1](-6) # Bad #[1](27) -#[1](-5.9999) +#[1](-6) # Circle #[1](-0.989992) -#[1](-0.989985) +#[1](-0.989992) +#[1](0.14112) #[1](0.14112) -#[1](0.14117) #Check gradient at x = -2 # Good #[1](-4) -#[1](-3.9999) +#[1](-4) # Bad #[1](32) -#[1](-3.9999) +#[1](-4) # Circle #[1](-0.416147) -#[1](-0.416101) +#[1](-0.416147) +#[1](0.909297) #[1](0.909297) -#[1](0.909318) #Check gradient at x = -1 # Good #[1](-2) -#[1](-1.9999) +#[1](-2) # Bad #[1](37) -#[1](-1.9999) +#[1](-2) # Circle #[1](0.540302) -#[1](0.540344) +#[1](0.540302) +#[1](0.841471) #[1](0.841471) -#[1](0.841444) #Check gradient at x = 0 # Good #[1](0) -#[1](0.0001) +#[1](1e-08) # Bad #[1](42) -#[1](0.0001) +#[1](1e-08) # Circle #[1](1) #[1](1) #[1](-0) -#[1](-5e-05) +#[1](0) #Check gradient at x = 1 # Good #[1](2) -#[1](2.0001) +#[1](2) # Bad #[1](47) -#[1](2.0001) +#[1](2) # Circle #[1](0.540302) -#[1](0.54026) +#[1](0.540302) +#[1](-0.841471) #[1](-0.841471) -#[1](-0.841498) #Check gradient at x = 2 # Good #[1](4) -#[1](4.0001) +#[1](4) # Bad #[1](52) -#[1](4.0001) +#[1](4) # Circle #[1](-0.416147) -#[1](-0.416192) +#[1](-0.416147) +#[1](-0.909297) #[1](-0.909297) -#[1](-0.909277) #Check gradient at x = 3 # Good #[1](6) -#[1](6.0001) +#[1](6) # Bad #[1](57) -#[1](6.0001) +#[1](6) # Circle #[1](-0.989992) -#[1](-0.99) +#[1](-0.989992) +#[1](-0.14112) #[1](-0.14112) -#[1](-0.141071) #Check gradient at x = 4 # Good #[1](8) -#[1](8.0001) +#[1](8) # Bad #[1](62) -#[1](8.0001) +#[1](8) # Circle #[1](-0.653644) -#[1](-0.653606) +#[1](-0.653644) +#[1](0.756802) #[1](0.756802) -#[1](0.756835) #Check gradient at x = 5 # Good #[1](10) -#[1](10.0001) +#[1](10) # Bad #[1](67) -#[1](10.0001) +#[1](10) # Circle #[1](0.283662) -#[1](0.28371) +#[1](0.283662) +#[1](0.958924) #[1](0.958924) -#[1](0.95891) #Check gradient at x = 6 # Good #[1](12) -#[1](12.0001) +#[1](12) # Bad #[1](72) -#[1](12.0001) +#[1](12) # Circle #[1](0.96017) -#[1](0.960184) +#[1](0.96017) #[1](0.279415) -#[1](0.279367) +#[1](0.279416) #Check gradient at x = 7 # Good #[1](14) -#[1](14.0001) +#[1](14) # Bad #[1](77) -#[1](14.0001) +#[1](14) # Circle #[1](0.753902) -#[1](0.753869) +#[1](0.753902) +#[1](-0.656987) #[1](-0.656987) -#[1](-0.657024) #Check gradient at x = 8 # Good #[1](16) -#[1](16.0001) +#[1](16) # Bad #[1](82) -#[1](16.0001) +#[1](16) # Circle #[1](-0.1455) -#[1](-0.14555) +#[1](-0.1455) +#[1](-0.989358) #[1](-0.989358) -#[1](-0.989351) #Check gradient at x = 9 # Good #[1](18) -#[1](18.0001) +#[1](18) # Bad #[1](87) -#[1](18.0001) +#[1](18) # Circle #[1](-0.91113) -#[1](-0.911151) +#[1](-0.91113) #[1](-0.412118) -#[1](-0.412073) +#[1](-0.412119) # Times at x = [2](-10,-10) #[2](-10,-10) #[2](-10,-10) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 11 ++ .../roboptim/core/finite-difference-gradient.hh | 6 +- src/finite-difference-gradient.cc | 9 +- tests/finite-difference-gradient.stdout | 158 ++++++++++---------- 4 files changed, 96 insertions(+), 88 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-17 05:05:41
|
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". The branch, trajectory has been updated via 3f7373f2c344ea0b64890e57c82cff5d59786e74 (commit) via cfe9e62ea7875b941dcfdd3f4acf9cb210373487 (commit) from 1b2a4e6e267b977063316a041715c92b2f5c805b (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 3f7373f2c344ea0b64890e57c82cff5d59786e74 Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 17 14:05:06 2009 +0900 Add missing include. * include/Makefile.am: Distribute missing include. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 07aba6c..89faae2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-17 Thomas Moulard <tho...@gm...> + Add missing include. + * include/Makefile.am: Distribute missing include. + +2009-07-17 Thomas Moulard <tho...@gm...> + Debug time optimization. * include/Makefile.am: Distribute new header. * include/roboptim/trajectory/free-time-trajectory.hxx: Debug. diff --git a/include/Makefile.am b/include/Makefile.am index 29cc3ee..b8b3019 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -11,6 +11,7 @@ nobase_include_HEADERS = \ roboptim/trajectory/limit-speed.hxx \ roboptim/trajectory/spline.hh \ roboptim/trajectory/spline-length.hh \ + roboptim/trajectory/stable-time-point.hh \ roboptim/trajectory/state-cost.hh \ roboptim/trajectory/state-cost.hxx \ roboptim/trajectory/trajectory-cost.hh \ commit cfe9e62ea7875b941dcfdd3f4acf9cb210373487 Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 17 14:03:26 2009 +0900 Debug time optimization. * include/Makefile.am: Distribute new header. * include/roboptim/trajectory/free-time-trajectory.hxx: Debug. * include/roboptim/trajectory/fwd.hh: Remove GenericTrajectory. * include/roboptim/trajectory/limit-speed.hh: Template the constraint by the trajectory type. * include/roboptim/trajectory/limit-speed.hxx: New. * include/roboptim/trajectory/stable-time-point.hh: Check that alpha is between 0 and 1. * src/Makefile.am: Remove limit-speed.cc from sources. * src/limit-speed.cc: Remove. * tests/spline-time-optimization.cc: Debug. * tests/testsuite.at: Tag spline-time-optimization as XFAIL for now. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 908fd4f..07aba6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2009-07-17 Thomas Moulard <tho...@gm...> + Debug time optimization. + * include/Makefile.am: Distribute new header. + * include/roboptim/trajectory/free-time-trajectory.hxx: Debug. + * include/roboptim/trajectory/fwd.hh: Remove GenericTrajectory. + * include/roboptim/trajectory/limit-speed.hh: Template the constraint + by the trajectory type. + * include/roboptim/trajectory/limit-speed.hxx: New. + * include/roboptim/trajectory/stable-time-point.hh: Check that alpha is + between 0 and 1. + * src/Makefile.am: Remove limit-speed.cc from sources. + * src/limit-speed.cc: Remove. + * tests/spline-time-optimization.cc: Debug. + * tests/testsuite.at: Tag spline-time-optimization as XFAIL for now. + +2009-07-17 Thomas Moulard <tho...@gm...> + Add stable time point class. * include/roboptim/trajectory/free-time-trajectory.hh: Placeholder for stable time point gradient evaluation. diff --git a/include/Makefile.am b/include/Makefile.am index da18d02..29cc3ee 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -8,6 +8,7 @@ nobase_include_HEADERS = \ roboptim/trajectory/freeze.hxx \ roboptim/trajectory/fwd.hh \ roboptim/trajectory/limit-speed.hh \ + roboptim/trajectory/limit-speed.hxx \ roboptim/trajectory/spline.hh \ roboptim/trajectory/spline-length.hh \ roboptim/trajectory/state-cost.hh \ diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index 0db7e01..017c50d 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -211,7 +211,11 @@ namespace roboptim void FreeTimeTrajectory<dorder>::setParameters (const vector_t& p) throw () { + assert (p[0] >= 0.); + this->parameters_ = p; + this->timeRange_ = makeInterval(getLowerBound (trajectory_->timeRange ()), + p[0] * getUpperBound (trajectory_->timeRange ())); this->trajectory_->setParameters (detail::removeScaleFromParams (p)); } @@ -226,9 +230,20 @@ namespace roboptim double FreeTimeTrajectory<dorder>::scaleTime (double unscaled) const throw () { - return detail::scaleTime (unscaled, - getLowerBound (this->timeRange ()), - this->timeScale ()); + value_type tmin = getLowerBound (this->timeRange ()); + value_type tmax = getUpperBound (this->timeRange ()); + value_type tMin = getLowerBound (this->trajectory_->timeRange ()); + value_type tMax = getUpperBound (this->trajectory_->timeRange ()); + + assert (tmin <= unscaled && unscaled <= tmax); + + value_type res = tMin + (unscaled - tmin) / timeScale (); + + if (res > tMax) + res = tMax; + else if (res < tMin) + res = tMin; + return res; } template <unsigned dorder> diff --git a/include/roboptim/trajectory/fwd.hh b/include/roboptim/trajectory/fwd.hh index 8cf1c25..584fb66 100644 --- a/include/roboptim/trajectory/fwd.hh +++ b/include/roboptim/trajectory/fwd.hh @@ -23,8 +23,6 @@ namespace roboptim template <unsigned dorder> class Trajectory; - typedef Trajectory<2> GenericTrajectory; - template <typename T> class StateCost; diff --git a/include/roboptim/trajectory/limit-speed.hh b/include/roboptim/trajectory/limit-speed.hh index 2c6a989..17ef6dc 100644 --- a/include/roboptim/trajectory/limit-speed.hh +++ b/include/roboptim/trajectory/limit-speed.hh @@ -25,15 +25,19 @@ namespace roboptim { - struct LimitSpeed : public DerivableFunction + template <typename T> + class LimitSpeed : public DerivableFunction { - LimitSpeed (StableTimePoint timePoint, const GenericTrajectory& spline) throw (); + public: + + LimitSpeed (StableTimePoint timePoint, const T& spline) throw (); ~LimitSpeed () throw (); template <typename F, typename CLIST> - static void addToProblem (const GenericTrajectory&, + static void addToProblem (const T&, Problem<F, CLIST>&, - typename Function::interval_t); + typename Function::interval_t, + unsigned); protected: void impl_compute (result_t& res, const argument_t& p) const throw (); @@ -41,24 +45,9 @@ namespace roboptim const throw (); private: StableTimePoint timePoint_; - const GenericTrajectory& trajectory_; + const T& trajectory_; }; - - template <typename F, typename CLIST> - void - LimitSpeed::addToProblem (const GenericTrajectory& trajectory, - Problem<F, CLIST>& problem, - typename Function::interval_t vRange) - { - using namespace boost; - for (double i = 0; i < 1.; i += 0.1) - { - shared_ptr<LimitSpeed> speed (new LimitSpeed (i * tMax, trajectory)); - problem.addConstraint - (static_pointer_cast<DerivableFunction> (speed), - vRange); - } - } } // end of namespace roboptim. +# include <roboptim/trajectory/limit-speed.hxx> #endif //! ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH diff --git a/include/roboptim/trajectory/limit-speed.hxx b/include/roboptim/trajectory/limit-speed.hxx new file mode 100644 index 0000000..f803d68 --- /dev/null +++ b/include/roboptim/trajectory/limit-speed.hxx @@ -0,0 +1,92 @@ +// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA. +// +// This file is part of the roboptim. +// +// roboptim is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// roboptim is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with roboptim. If not, see <http://www.gnu.org/licenses/>. + +#ifndef ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HXX +# define ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HXX +# include <boost/numeric/ublas/vector.hpp> +# include <boost/scoped_ptr.hpp> + +# include <roboptim/core/finite-difference-gradient.hh> + +# include <roboptim/trajectory/trajectory.hh> + +namespace roboptim +{ + template <typename T> + LimitSpeed<T>::LimitSpeed (StableTimePoint timePoint, + const T& trajectory) throw () + : DerivableFunction (trajectory.parameters ().size (), 1, "limit speed"), + timePoint_ (timePoint), + trajectory_ (trajectory) + {} + + template <typename T> + LimitSpeed<T>::~LimitSpeed () throw () + {} + + template <typename T> + void + LimitSpeed<T>::impl_compute (result_t& res, const argument_t& p) const throw () + { + using namespace boost::numeric::ublas; + res.clear (); + + boost::scoped_ptr<T> updatedTrajectory (trajectory_.clone ()); + updatedTrajectory->setParameters (p); + + //FIXME: should be done in updatedTrajectory! + value_type t = + timePoint_.getTime (updatedTrajectory->timeRange ()); + res[0] = norm_2 (updatedTrajectory->derivative (t)); + } + + template <typename T> + void + LimitSpeed<T>::impl_gradient (gradient_t& grad, const argument_t& p, size_type i) + const throw () + { + assert (i == 0); + grad.clear (); + + //FIXME: compute gradient analytically. + FiniteDifferenceGradient fdfunction (*this); + fdfunction.gradient (grad, p, 0); + } + + template <typename T> + template <typename F, typename CLIST> + void + LimitSpeed<T>::addToProblem (const T& trajectory, + Problem<F, CLIST>& problem, + typename Function::interval_t vRange, + unsigned nConstraints) + { + using namespace boost; + if (nConstraints == 0) + return; + for (double i = 0; i < 1.; i += 1. / nConstraints) + { + shared_ptr<LimitSpeed> speed (new LimitSpeed (i * tMax, trajectory)); + problem.addConstraint + (static_pointer_cast<DerivableFunction> (speed), + vRange); + } + } +} // end of namespace roboptim. + + +#endif //! ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HXX diff --git a/include/roboptim/trajectory/stable-time-point.hh b/include/roboptim/trajectory/stable-time-point.hh index 8ac86ac..ce9256a 100644 --- a/include/roboptim/trajectory/stable-time-point.hh +++ b/include/roboptim/trajectory/stable-time-point.hh @@ -31,16 +31,23 @@ namespace roboptim explicit StableTimePoint (value_type alpha) : alpha_ (alpha) - {} + { + assert (alpha_ >= 0. && alpha <= 1.); + } const value_type& getAlpha () const { return alpha_; } - value_type getTime (value_type tmax) const + value_type getTime (Function::interval_t timeRange) const { - return alpha_ * tmax; + value_type tmin = Function::getLowerBound (timeRange); + value_type tmax = Function::getUpperBound (timeRange); + + value_type res = tmin + alpha_ * (tmax - tmin); + res = (res > tmax) ? tmax : ((res < tmin) ? tmin : res); + return res; } private: value_type alpha_; diff --git a/src/Makefile.am b/src/Makefile.am index e29e350..a4ea844 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,7 +10,6 @@ lib_LTLIBRARIES = libroboptim-trajectory.la libroboptim_trajectory_la_SOURCES = \ doc.hh \ - limit-speed.cc \ spline.cc \ spline-length.cc diff --git a/src/limit-speed.cc b/src/limit-speed.cc deleted file mode 100644 index 3b71ec6..0000000 --- a/src/limit-speed.cc +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA. -// -// This file is part of the roboptim. -// -// roboptim is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// roboptim is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with roboptim. If not, see <http://www.gnu.org/licenses/>. - -#include <boost/numeric/ublas/vector.hpp> -#include <boost/scoped_ptr.hpp> - -#include <roboptim/core/finite-difference-gradient.hh> - -#include <roboptim/trajectory/trajectory.hh> - -#include "roboptim/trajectory/limit-speed.hh" - -namespace roboptim -{ - LimitSpeed::LimitSpeed (StableTimePoint timePoint, - const GenericTrajectory& spline) throw () - : DerivableFunction (1 + spline.parameters ().size (), 1, "limit speed"), - timePoint_ (timePoint), - trajectory_ (spline) - {} - - LimitSpeed::~LimitSpeed () throw () - {} - - void - LimitSpeed::impl_compute (result_t& res, const argument_t& p) const throw () - { - using namespace boost::numeric::ublas; - res.clear (); - - boost::scoped_ptr<GenericTrajectory> updatedSpline (trajectory_.clone ()); - updatedSpline->setParameters (p); - - //FIXME: should be done in updatedSpline! - value_type t = - timePoint_.getTime (getUpperBound (updatedSpline->timeRange ())); - res[0] = norm_2 (updatedSpline->derivative (t)); - } - - void - LimitSpeed::impl_gradient (gradient_t& grad, const argument_t& p, size_type i) - const throw () - { - assert (i == 0); - grad.clear (); - - //FIXME: compute gradient analytically. - FiniteDifferenceGradient fdfunction (*this); - fdfunction.gradient (grad, p, 0); - } -} // end of namespace roboptim. diff --git a/tests/spline-time-optimization.cc b/tests/spline-time-optimization.cc index 298c02d..76df7e9 100644 --- a/tests/spline-time-optimization.cc +++ b/tests/spline-time-optimization.cc @@ -39,6 +39,7 @@ typedef Solver<DerivableFunction, constraint_t> solver_t; int run_test () { + using namespace boost; using namespace boost::assign; Spline::vector_t params (4); @@ -68,6 +69,20 @@ int run_test () solver_t::problem_t problem (cost); problem.startingPoint () = freeTimeTraj.parameters (); + { + // Be sure that scale is positive. + Function::matrix_t a (1, problem.function ().inputSize ()); + Function::vector_t b (1); + a.clear (), b.clear (); + a(0, 0) = 1.; + shared_ptr<NumericLinearFunction> speedPositivity + (new NumericLinearFunction (a, b)); + problem.addConstraint + (static_pointer_cast<DerivableFunction> (speedPositivity), + Function::makeLowerInterval (0.)); + } + + typedef Freeze<DerivableFunction, constraint_t, LinearFunction> freeze_t; freeze_t freeze (problem, list_of <freeze_t::frozenArgument_t> @@ -75,6 +90,10 @@ int run_test () (params.size (), params[params.size () - 1])); freeze (); + + Function::interval_t vRange (0., 100.); + LimitSpeed<FreeTimeTrajectory<Spline::derivabilityOrder> >::addToProblem (freeTimeTraj, problem, vRange, 10); + SolverFactory<solver_t> factory ("cfsqp", problem); solver_t& solver = factory (); @@ -84,10 +103,10 @@ int run_test () << "Parameters (before): " << freeTimeTraj.parameters () << std::endl; - solver_t::result_t res = solver.minimum (); - std::cout << solver << std::endl; + solver_t::result_t res = solver.minimum (); + switch (res.which ()) { case GenericSolver::SOLVER_VALUE: diff --git a/tests/testsuite.at b/tests/testsuite.at index 59f145c..523aecd 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -33,6 +33,6 @@ CHECK_STDOUT([spline], [Check Spline class.]) CHECK_STDOUT([spline-gradient], [Check Spline gradient.]) CHECK_STDOUT([spline-optimization], [Optimize a Spline with Cfsqp.]) CHECK_STDOUT([free-time-trajectory], [Check free time trajectory.]) -CHECK_STDOUT([spline-optimization-time], [Optimize a free time trajectory.]) +CHECK_STDOUT([spline-optimization-time], [Optimize a free time trajectory.], [false], [true]) # End of testsuite.at ----------------------------------------------------------------------- Summary of changes: ChangeLog | 21 +++++ include/Makefile.am | 2 + .../roboptim/trajectory/free-time-trajectory.hxx | 21 ++++- include/roboptim/trajectory/fwd.hh | 2 - include/roboptim/trajectory/limit-speed.hh | 31 ++----- include/roboptim/trajectory/limit-speed.hxx | 92 ++++++++++++++++++++ include/roboptim/trajectory/stable-time-point.hh | 13 ++- src/Makefile.am | 1 - src/limit-speed.cc | 65 -------------- tests/spline-time-optimization.cc | 23 +++++- tests/testsuite.at | 2 +- 11 files changed, 175 insertions(+), 98 deletions(-) create mode 100644 include/roboptim/trajectory/limit-speed.hxx delete mode 100644 src/limit-speed.cc hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-17 02:13:30
|
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". The branch, trajectory has been updated via 1b2a4e6e267b977063316a041715c92b2f5c805b (commit) from 2a4f88859fdda871811385c69c1278256ec77d4a (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 1b2a4e6e267b977063316a041715c92b2f5c805b Author: Thomas Moulard <tho...@gm...> Date: Fri Jul 17 11:12:56 2009 +0900 Add stable time point class. * include/roboptim/trajectory/free-time-trajectory.hh: Placeholder for stable time point gradient evaluation. * include/roboptim/trajectory/freeze.hh: Fix typo * include/roboptim/trajectory/limit-speed.hh: Use stable time points to handle constraint on free time trajectories. * include/roboptim/trajectory/stable-time-point.hh: Implement stable time points. * src/limit-speed.cc: Modify implementation to use stable time points. * tests/spline-time-optimization.cc: Include LimitSpeed class. * tests/free-time-optimization.stdout: New. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index c795b68..908fd4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2009-07-17 Thomas Moulard <tho...@gm...> + + Add stable time point class. + * include/roboptim/trajectory/free-time-trajectory.hh: + Placeholder for stable time point gradient evaluation. + * include/roboptim/trajectory/freeze.hh: Fix typo + * include/roboptim/trajectory/limit-speed.hh: + Use stable time points to handle constraint on free time trajectories. + * include/roboptim/trajectory/stable-time-point.hh: + Implement stable time points. + * src/limit-speed.cc: Modify implementation to use stable time + points. + * tests/spline-time-optimization.cc: Include LimitSpeed class. + * tests/free-time-optimization.stdout: New. + 2009-07-15 Thomas Moulard <tho...@gm...> Debug free-time-trajectory. diff --git a/include/roboptim/trajectory/free-time-trajectory.hh b/include/roboptim/trajectory/free-time-trajectory.hh index 30a6ee1..80c5719 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hh +++ b/include/roboptim/trajectory/free-time-trajectory.hh @@ -18,6 +18,7 @@ #ifndef ROBOPTIM_TRAJECTORY_FREETIMETRAJECTORY_HH # define ROBOPTIM_TRAJECTORY_FREETIMETRAJECTORY_HH # include <roboptim/trajectory/trajectory.hh> +# include <roboptim/trajectory/stable-time-point.hh> namespace roboptim { @@ -70,6 +71,8 @@ namespace roboptim virtual vector_t derivAfterSingularPoint (size_type rank, size_type order) const; + //FIXME: add stable time point gradient computation. + virtual void setParameters (const vector_t&) throw (); /// \brief Get time scale factor. diff --git a/include/roboptim/trajectory/freeze.hh b/include/roboptim/trajectory/freeze.hh index 59495c7..4d13fa7 100644 --- a/include/roboptim/trajectory/freeze.hh +++ b/include/roboptim/trajectory/freeze.hh @@ -25,7 +25,7 @@ namespace roboptim { - /// \brief Add constraints that freezes parmeters. + /// \brief Add constraints that freeze parameters. /// /// This constraint expects a vector of pairs (argument id, value) to /// build a function that will freeze the given arguments to their diff --git a/include/roboptim/trajectory/limit-speed.hh b/include/roboptim/trajectory/limit-speed.hh index ca663c3..2c6a989 100644 --- a/include/roboptim/trajectory/limit-speed.hh +++ b/include/roboptim/trajectory/limit-speed.hh @@ -17,23 +17,48 @@ #ifndef ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH # define ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH +# include <boost/shared_ptr.hpp> + # include <roboptim/core/derivable-function.hh> # include <roboptim/trajectory/fwd.hh> +# include <roboptim/trajectory/stable-time-point.hh> namespace roboptim { struct LimitSpeed : public DerivableFunction { - LimitSpeed (double t, const GenericTrajectory& spline) throw (); + LimitSpeed (StableTimePoint timePoint, const GenericTrajectory& spline) throw (); ~LimitSpeed () throw (); + + template <typename F, typename CLIST> + static void addToProblem (const GenericTrajectory&, + Problem<F, CLIST>&, + typename Function::interval_t); + protected: void impl_compute (result_t& res, const argument_t& p) const throw (); void impl_gradient (gradient_t& grad, const argument_t& p, size_type i) const throw (); private: - double t_; - const GenericTrajectory& spline_; + StableTimePoint timePoint_; + const GenericTrajectory& trajectory_; }; + + template <typename F, typename CLIST> + void + LimitSpeed::addToProblem (const GenericTrajectory& trajectory, + Problem<F, CLIST>& problem, + typename Function::interval_t vRange) + { + using namespace boost; + for (double i = 0; i < 1.; i += 0.1) + { + shared_ptr<LimitSpeed> speed (new LimitSpeed (i * tMax, trajectory)); + problem.addConstraint + (static_pointer_cast<DerivableFunction> (speed), + vRange); + } + } } // end of namespace roboptim. #endif //! ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH diff --git a/include/roboptim/trajectory/limit-speed.hh b/include/roboptim/trajectory/stable-time-point.hh similarity index 51% copy from include/roboptim/trajectory/limit-speed.hh copy to include/roboptim/trajectory/stable-time-point.hh index ca663c3..8ac86ac 100644 --- a/include/roboptim/trajectory/limit-speed.hh +++ b/include/roboptim/trajectory/stable-time-point.hh @@ -15,25 +15,47 @@ // You should have received a copy of the GNU Lesser General Public License // along with roboptim. If not, see <http://www.gnu.org/licenses/>. -#ifndef ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH -# define ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH -# include <roboptim/core/derivable-function.hh> -# include <roboptim/trajectory/fwd.hh> +#ifndef ROBOPTIM_TRAJECTORY_STABLE_TIME_POINT_HH +# define ROBOPTIM_TRAJECTORY_STABLE_TIME_POINT_HH +# include <roboptim/core/function.hh> namespace roboptim { - struct LimitSpeed : public DerivableFunction + class TMax {}; + TMax tMax; + + class StableTimePoint { - LimitSpeed (double t, const GenericTrajectory& spline) throw (); - ~LimitSpeed () throw (); - protected: - void impl_compute (result_t& res, const argument_t& p) const throw (); - void impl_gradient (gradient_t& grad, const argument_t& p, size_type i) - const throw (); + public: + typedef Function::value_type value_type; + + explicit StableTimePoint (value_type alpha) + : alpha_ (alpha) + {} + + const value_type& getAlpha () const + { + return alpha_; + } + + value_type getTime (value_type tmax) const + { + return alpha_ * tmax; + } private: - double t_; - const GenericTrajectory& spline_; + value_type alpha_; }; + + StableTimePoint operator* (Function::value_type alpha, TMax) + { + return StableTimePoint (alpha); + } + + StableTimePoint operator* (TMax, Function::value_type alpha) + { + return StableTimePoint (alpha); + } + } // end of namespace roboptim. -#endif //! ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH +#endif //! ROBOPTIM_TRAJECTORY_STABLE_TIME_POINT_HH diff --git a/src/limit-speed.cc b/src/limit-speed.cc index 2267904..3b71ec6 100644 --- a/src/limit-speed.cc +++ b/src/limit-speed.cc @@ -26,10 +26,11 @@ namespace roboptim { - LimitSpeed::LimitSpeed (double t, const GenericTrajectory& spline) throw () + LimitSpeed::LimitSpeed (StableTimePoint timePoint, + const GenericTrajectory& spline) throw () : DerivableFunction (1 + spline.parameters ().size (), 1, "limit speed"), - t_ (t), - spline_ (spline) + timePoint_ (timePoint), + trajectory_ (spline) {} LimitSpeed::~LimitSpeed () throw () @@ -41,10 +42,13 @@ namespace roboptim using namespace boost::numeric::ublas; res.clear (); - boost::scoped_ptr<GenericTrajectory> updatedSpline (spline_.clone ()); + boost::scoped_ptr<GenericTrajectory> updatedSpline (trajectory_.clone ()); updatedSpline->setParameters (p); - res[0] = norm_2 (updatedSpline->derivative (t_)); + //FIXME: should be done in updatedSpline! + value_type t = + timePoint_.getTime (getUpperBound (updatedSpline->timeRange ())); + res[0] = norm_2 (updatedSpline->derivative (t)); } void diff --git a/tests/spline-optimization-time.stdout b/tests/spline-optimization-time.stdout new file mode 100644 index 0000000..e69de29 diff --git a/tests/spline-time-optimization.cc b/tests/spline-time-optimization.cc index 20f3107..298c02d 100644 --- a/tests/spline-time-optimization.cc +++ b/tests/spline-time-optimization.cc @@ -25,6 +25,7 @@ #include <roboptim/trajectory/free-time-trajectory.hh> #include <roboptim/trajectory/freeze.hh> #include <roboptim/trajectory/fwd.hh> +#include <roboptim/trajectory/limit-speed.hh> #include <roboptim/trajectory/spline-length.hh> #include <roboptim/trajectory/spline.hh> #include <roboptim/trajectory/trajectory-cost.hh> ----------------------------------------------------------------------- Summary of changes: ChangeLog | 15 ++++++ .../roboptim/trajectory/free-time-trajectory.hh | 3 + include/roboptim/trajectory/freeze.hh | 2 +- include/roboptim/trajectory/limit-speed.hh | 31 +++++++++++- .../{limit-speed.hh => stable-time-point.hh} | 50 ++++++++++++++------ src/limit-speed.cc | 14 ++++-- ...tory.stdout => spline-optimization-time.stdout} | 0 tests/spline-time-optimization.cc | 1 + 8 files changed, 93 insertions(+), 23 deletions(-) copy include/roboptim/trajectory/{limit-speed.hh => stable-time-point.hh} (51%) copy tests/{free-time-trajectory.stdout => spline-optimization-time.stdout} (100%) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-15 10:46:41
|
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". The branch, trajectory has been updated via 2a4f88859fdda871811385c69c1278256ec77d4a (commit) from 811331a1ad777e218a0f587e8029c7f3ded3b756 (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 2a4f88859fdda871811385c69c1278256ec77d4a Author: Thomas Moulard <tho...@gm...> Date: Wed Jul 15 19:46:06 2009 +0900 Debug free-time-trajectory. * include/Makefile.am: Distribute new header. * include/roboptim/trajectory/free-time-trajectory.hh, * include/roboptim/trajectory/free-time-trajectory.hxx: Fix implementation. * include/roboptim/trajectory/fwd.hh: Add generic trajectory type. * include/roboptim/trajectory/limit-speed.hh: Copy from include/roboptim/trajectory/fwd.hh. * include/roboptim/trajectory/spline.hh, * include/roboptim/trajectory/trajectory.hh: Add clone. * src/Makefile.am: Compile limit-speed.cc. * src/limit-speed.cc: New. * tests/Makefile.am: Compile new tests. * tests/free-time-trajectory.cc: Copy from include/roboptim/trajectory/fwd.hh. * tests/free-time-trajectory.stdout: New. * tests/spline-optimization.stdout: Regenerate. * tests/spline-time-optimization.cc: New. * tests/spline-time-optimization.stdout: New. * tests/spline.stdout: Regenerate. * tests/testsuite.at: Run new tests. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index c9fc98c..c795b68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,30 @@ 2009-07-15 Thomas Moulard <tho...@gm...> + Debug free-time-trajectory. + * include/Makefile.am: Distribute new header. + * include/roboptim/trajectory/free-time-trajectory.hh, + * include/roboptim/trajectory/free-time-trajectory.hxx: + Fix implementation. + * include/roboptim/trajectory/fwd.hh: Add generic trajectory + type. + * include/roboptim/trajectory/limit-speed.hh: + Copy from include/roboptim/trajectory/fwd.hh. + * include/roboptim/trajectory/spline.hh, + * include/roboptim/trajectory/trajectory.hh: Add clone. + * src/Makefile.am: Compile limit-speed.cc. + * src/limit-speed.cc: New. + * tests/Makefile.am: Compile new tests. + * tests/free-time-trajectory.cc: + Copy from include/roboptim/trajectory/fwd.hh. + * tests/free-time-trajectory.stdout: New. + * tests/spline-optimization.stdout: Regenerate. + * tests/spline-time-optimization.cc: New. + * tests/spline-time-optimization.stdout: New. + * tests/spline.stdout: Regenerate. + * tests/testsuite.at: Run new tests. + +2009-07-15 Thomas Moulard <tho...@gm...> + Make use of function's names in trajectory classes. * include/roboptim/trajectory/spline.hh, * include/roboptim/trajectory/trajectory.hh, diff --git a/include/Makefile.am b/include/Makefile.am index ed29b20..da18d02 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -7,6 +7,7 @@ nobase_include_HEADERS = \ roboptim/trajectory/freeze.hh \ roboptim/trajectory/freeze.hxx \ roboptim/trajectory/fwd.hh \ + roboptim/trajectory/limit-speed.hh \ roboptim/trajectory/spline.hh \ roboptim/trajectory/spline-length.hh \ roboptim/trajectory/state-cost.hh \ diff --git a/include/roboptim/trajectory/free-time-trajectory.hh b/include/roboptim/trajectory/free-time-trajectory.hh index 05e4e46..30a6ee1 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hh +++ b/include/roboptim/trajectory/free-time-trajectory.hh @@ -32,23 +32,34 @@ namespace roboptim class FreeTimeTrajectory : public Trajectory<DerivabilityOrder> { public: + /// \brief Parent type. + typedef Trajectory<DerivabilityOrder> parent_t; + + /// \brief Import value type. + typedef typename parent_t::value_type value_type; + /// \brief Import size type. + typedef typename parent_t::size_type size_type; + /// \brief Import result type. + typedef typename parent_t::result_t result_t; + /// \brief Import gradient type. + typedef typename parent_t::gradient_t gradient_t; + /// \brief Import vector type. + typedef typename parent_t::vector_t vector_t; + /// \brief Import jacobian type. + typedef typename parent_t::jacobian_t jacobian_t; + /// \brief Import interval type. + typedef typename parent_t::interval_t interval_t; + /// Constructor with fixed definition interval trajectory /// /// \param traj trajectory defining this one by reparameterization /// \param s time scale FreeTimeTrajectory (const Trajectory<DerivabilityOrder>& traj, double s) throw (); - virtual ~FreeTimeTrajectory () throw (); + FreeTimeTrajectory (const FreeTimeTrajectory<DerivabilityOrder>& traj) throw (); - virtual vector_t operator () (double) const throw (); + virtual ~FreeTimeTrajectory () throw (); - /// \brief Compute the derivative of the function. - /// - /// Derivative is computed for a certain order, at a given point. - /// \param x point at which the derivative will be computed - /// \param order derivative order (if 0 then function is evaluated) - /// \return derivative vector - virtual vector_t derivative (double x, size_type order) const throw (); virtual jacobian_t variationConfigWrtParam (double t) const throw (); virtual jacobian_t variationDerivWrtParam (double t, size_type order) @@ -59,15 +70,30 @@ namespace roboptim virtual vector_t derivAfterSingularPoint (size_type rank, size_type order) const; + virtual void setParameters (const vector_t&) throw (); + /// \brief Get time scale factor. /// \return time scale factor. double timeScale () const throw (); + size_type getTimeScalingIndex () const throw () + { + return 0; + } + + ROBOPTIM_IMPLEMENT_CLONE(FreeTimeTrajectory<DerivabilityOrder>) + /// \brief Display the function on the specified output stream. /// /// \param o output stream used for display /// \return output stream virtual std::ostream& print (std::ostream& o) const throw (); + + protected: + void impl_compute (result_t&, double) const throw (); + void impl_derivative (gradient_t& g, double x, size_type order) + const throw (); + private: /// \brief Scale input time argument. /// @@ -82,9 +108,7 @@ namespace roboptim double scaleTime (double t) const throw (); /// \brief Input fixed time trajectory. - const Trajectory<DerivabilityOrder>& trajectory_; - /// \brief Store time scaling parameter \f$\textbf{p}_{m+1}\f$. - double timeScale_; + Trajectory<DerivabilityOrder>* trajectory_; }; /// @} diff --git a/include/roboptim/trajectory/free-time-trajectory.hxx b/include/roboptim/trajectory/free-time-trajectory.hxx index 89e00de..0db7e01 100644 --- a/include/roboptim/trajectory/free-time-trajectory.hxx +++ b/include/roboptim/trajectory/free-time-trajectory.hxx @@ -21,65 +21,128 @@ namespace roboptim { + namespace detail + { + Function::vector_t + addScaleToParams (const Function::vector_t& p, + Function::value_type t = 1.); + + Function::vector_t + removeScaleFromParams (const Function::vector_t& v); + + + Function::vector_t + addScaleToParams (const Function::vector_t& p, + Function::value_type t) + { + Function::vector_t res (p.size () + 1); + res[0] = t; + for (unsigned i = 0; i < p.size (); ++i) + res[i + 1] = p[i]; + return res; + } + + Function::vector_t + removeScaleFromParams (const Function::vector_t& p) + { + Function::vector_t res (p.size () - 1); + for (unsigned i = 1; i < p.size (); ++i) + res[i - 1] = p[i]; + return res; + } + + Function::value_type + scaleTime (Function::value_type unscaled, + Function::value_type min, + Function::value_type scale) + { + return min + scale * (unscaled - min); + } + + template <unsigned dorder> + Function::interval_t + scaleInterval (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); + return Function::makeInterval (min, max); + } + + } // end of namespace detail + template <unsigned dorder> FreeTimeTrajectory<dorder>::FreeTimeTrajectory (const Trajectory<dorder>& traj, double s) throw () - : Trajectory<dorder> - (std::make_pair (traj.timeRange ().first, - scaleTime (traj.timeRange ().second)), - traj.m, traj.parameters ()), - trajectory_ (traj), - timeScale_ (s) + : Trajectory<dorder> (detail::scaleInterval (traj, s), traj.outputSize (), + detail::addScaleToParams (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) + throw () + : Trajectory<dorder> (traj.timeRange (), traj.outputSize (), + traj.parameters ()), + trajectory_ (traj.trajectory_->clone ()) { - assert (timeScale_ != 0. - && std::isinf (timeScale_) - && std::isnan (timeScale_)); } template <unsigned dorder> FreeTimeTrajectory<dorder>::~FreeTimeTrajectory () throw () { + delete trajectory_; } template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::vector_t - FreeTimeTrajectory<dorder>::operator () (double t) const throw () + void + FreeTimeTrajectory<dorder>::impl_compute + (typename FreeTimeTrajectory<dorder>::result_t& res , double t) const throw () { - return trajectory_ (scaleTime (t)); + (*trajectory_) (scaleTime (t)); } template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::vector_t - FreeTimeTrajectory<dorder>::derivative (double t, size_type order) const throw () + void + FreeTimeTrajectory<dorder>::impl_derivative + (typename FreeTimeTrajectory<dorder>::gradient_t& derivative, + double t, + typename FreeTimeTrajectory<dorder>::size_type order) const throw () { double scaled = scaleTime (t); - vector_t d = trajectory_.deriv (scaled, order); + trajectory_->derivative (derivative, scaled, order); double coef = 1.; for (size_t i = 0; i < order; ++i) - coef *= ; - outDerivative *= coef; + coef *= this->timeScale (); //FIXME: timeScale? + derivative *= coef; } template <unsigned dorder> typename FreeTimeTrajectory<dorder>::jacobian_t FreeTimeTrajectory<dorder>::variationConfigWrtParam (double t) const throw () { - double t_min = timeRange ().first; + double t_min = this->getLowerBound (this->timeRange ()); double scaled = scaleTime (t); - jacobian_t jac = trajectory_.variationConfigWrtParam (scale); + jacobian_t jac = trajectory_->variationConfigWrtParam (scaled); // Last column corresponds to derivative wrt lambda_{p+1} - vector_t dGamma0_dt = trajectory_.derivative (scaled, 1); + vector_t dGamma0_dt = trajectory_->derivative (scaled, 1); dGamma0_dt *= (t - t_min); // Fill last column of Jacobian with dGamma0_dt size_type timeScalingIndex = getTimeScalingIndex (); for (size_type i = 0; i < jac.size1(); ++i) jac (i, timeScalingIndex) = dGamma0_dt (i); + return jac; } template <unsigned dorder> @@ -90,41 +153,41 @@ namespace roboptim if (!order) return variationConfigWrtParam (t); - double t_min = timeRange ().first; + double t_min = this->getLowerBound (this->timeRange ()); double scaled = scaleTime (t); jacobian_t jac = - trajectory_.variationDerivWrtParam (scaled, order); + trajectory_->variationDerivWrtParam (scaled, order); double lambda_p_plus_1_pow_n_minus_1 = 1.; for (size_type i = 0; i< order - 1; ++i) - lambda_p_plus_1_pow_n_minus_1 *= timeScale_; - } - outJacobian *= lambda_p_plus_1_pow_n_minus_1 * timeScale_; + lambda_p_plus_1_pow_n_minus_1 *= this->timeScale (); + + jac *= lambda_p_plus_1_pow_n_minus_1 * this->timeScale (); - // Fill last column of Jacobian - vector_t lastColumn1 = trajectory_.derivative (scaled, order, lastColumn1); - lastColumn1 *= order; + // Fill last column of Jacobian + vector_t lastColumn1 = trajectory_->derivative (scaled, order); + lastColumn1 *= order; - vector_t lastColumn2 = trajectory_.derivative (scaled, order, lastColumn2); - lastColumn2 *= timeScale_ * (t-t_min); + vector_t lastColumn2 = trajectory_->derivative (scaled, order); + lastColumn2 *= this->timeScale () * (t-t_min); - vector_t lastColumn = - (lastColumn1 + lastColumn2) * lambda_p_plus_1_pow_n_minus_1; + vector_t lastColumn = + (lastColumn1 + lastColumn2) * lambda_p_plus_1_pow_n_minus_1; - size_type timeScalingIndex = getTimeScalingIndex (); - for (size_type i = 0; i < jac.size1(); ++i) - jac (i, timeScalingIndex) = lastColumn (i); - return jac; -} + size_type timeScalingIndex = getTimeScalingIndex (); + for (size_type i = 0; i < jac.size1(); ++i) + jac (i, timeScalingIndex) = lastColumn (i); + return jac; + } template <unsigned dorder> typename FreeTimeTrajectory<dorder>::value_type FreeTimeTrajectory<dorder>::singularPointAtRank (size_type rank) const { - double t_min = timeRange ().first; - return t_min + (trajectory_.singularPointAtRank (rank) - t_min) - / timeScale_; + double t_min = this->getLowerBound (this->timeRange ()); + return t_min + (trajectory_->singularPointAtRank (rank) - t_min) + / this->timeScale (); } template <unsigned dorder> @@ -133,7 +196,7 @@ namespace roboptim size_type order) const { - return trajectory_.derivBeforeSingularPoint (rank, order); + return trajectory_->derivBeforeSingularPoint (rank, order); } template <unsigned dorder> @@ -141,23 +204,31 @@ namespace roboptim FreeTimeTrajectory<dorder>::derivAfterSingularPoint (size_type rank, size_type order) const { - return trajectory_.derivAfterSingularPoint (rank, order); + return trajectory_->derivAfterSingularPoint (rank, order); + } + + template <unsigned dorder> + void + FreeTimeTrajectory<dorder>::setParameters (const vector_t& p) throw () + { + this->parameters_ = p; + this->trajectory_->setParameters (detail::removeScaleFromParams (p)); } template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::double + double FreeTimeTrajectory<dorder>::timeScale () const throw () { - return timeScale_; + return this->parameters_[0]; } template <unsigned dorder> - typename FreeTimeTrajectory<dorder>::double + double FreeTimeTrajectory<dorder>::scaleTime (double unscaled) const throw () { - double min = timeRange ().first; - double scaled = min + timeScale_ * (unscaled - min); - return scaled; + return detail::scaleTime (unscaled, + getLowerBound (this->timeRange ()), + this->timeScale ()); } template <unsigned dorder> diff --git a/include/roboptim/trajectory/fwd.hh b/include/roboptim/trajectory/fwd.hh index 584fb66..8cf1c25 100644 --- a/include/roboptim/trajectory/fwd.hh +++ b/include/roboptim/trajectory/fwd.hh @@ -23,6 +23,8 @@ namespace roboptim template <unsigned dorder> class Trajectory; + typedef Trajectory<2> GenericTrajectory; + template <typename T> class StateCost; diff --git a/include/roboptim/trajectory/fwd.hh b/include/roboptim/trajectory/limit-speed.hh similarity index 56% copy from include/roboptim/trajectory/fwd.hh copy to include/roboptim/trajectory/limit-speed.hh index 584fb66..ca663c3 100644 --- a/include/roboptim/trajectory/fwd.hh +++ b/include/roboptim/trajectory/limit-speed.hh @@ -15,25 +15,25 @@ // You should have received a copy of the GNU Lesser General Public License // along with roboptim. If not, see <http://www.gnu.org/licenses/>. -#ifndef ROBOPTIM_TRAJECTORY_FWD_HH -# define ROBOPTIM_TRAJECTORY_FWD_HH +#ifndef ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH +# define ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH +# include <roboptim/core/derivable-function.hh> +# include <roboptim/trajectory/fwd.hh> namespace roboptim { - template <unsigned dorder> - class Trajectory; - - template <typename T> - class StateCost; - - template <typename T> - class SumCost; - - template <typename T> - class TrajectoryCost; - - class Spline; - class SplineLength; + struct LimitSpeed : public DerivableFunction + { + LimitSpeed (double t, const GenericTrajectory& spline) throw (); + ~LimitSpeed () throw (); + protected: + void impl_compute (result_t& res, const argument_t& p) const throw (); + void impl_gradient (gradient_t& grad, const argument_t& p, size_type i) + const throw (); + private: + double t_; + const GenericTrajectory& spline_; + }; } // end of namespace roboptim. -#endif //! ROBOPTIM_TRAJECTORY_FWD_HH +#endif //! ROBOPTIM_TRAJECTORY_LIMIT_SPEED_HH diff --git a/include/roboptim/trajectory/spline.hh b/include/roboptim/trajectory/spline.hh index 6211c4b..82cc16b 100644 --- a/include/roboptim/trajectory/spline.hh +++ b/include/roboptim/trajectory/spline.hh @@ -73,6 +73,8 @@ namespace roboptim virtual vector_t derivAfterSingularPoint (size_type rank, size_type order) const; + ROBOPTIM_IMPLEMENT_CLONE(Spline) + /// \brief Display the function on the specified output stream. /// /// \param o output stream used for display diff --git a/include/roboptim/trajectory/trajectory.hh b/include/roboptim/trajectory/trajectory.hh index e6548d1..c720caa 100644 --- a/include/roboptim/trajectory/trajectory.hh +++ b/include/roboptim/trajectory/trajectory.hh @@ -22,6 +22,12 @@ # include <roboptim/trajectory/fwd.hh> # include <roboptim/core/n-times-derivable-function.hh> +# define ROBOPTIM_IMPLEMENT_CLONE(C) \ + virtual C* clone () const throw () \ + { \ + return new C (*this); \ + } + namespace roboptim { /// \addtogroup roboptim_meta_function @@ -154,8 +160,9 @@ namespace roboptim const = 0; /// \} - virtual std::ostream& print (std::ostream&) const throw (); + virtual Trajectory<DerivabilityOrder>* clone () const throw () = 0; + virtual std::ostream& print (std::ostream&) const throw (); protected: Trajectory (interval_t, size_type, const vector_t&, std::string name = std::string ()) throw (); diff --git a/src/Makefile.am b/src/Makefile.am index a4ea844..e29e350 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,6 +10,7 @@ lib_LTLIBRARIES = libroboptim-trajectory.la libroboptim_trajectory_la_SOURCES = \ doc.hh \ + limit-speed.cc \ spline.cc \ spline-length.cc diff --git a/src/limit-speed.cc b/src/limit-speed.cc new file mode 100644 index 0000000..2267904 --- /dev/null +++ b/src/limit-speed.cc @@ -0,0 +1,61 @@ +// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA. +// +// This file is part of the roboptim. +// +// roboptim is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// roboptim is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with roboptim. If not, see <http://www.gnu.org/licenses/>. + +#include <boost/numeric/ublas/vector.hpp> +#include <boost/scoped_ptr.hpp> + +#include <roboptim/core/finite-difference-gradient.hh> + +#include <roboptim/trajectory/trajectory.hh> + +#include "roboptim/trajectory/limit-speed.hh" + +namespace roboptim +{ + LimitSpeed::LimitSpeed (double t, const GenericTrajectory& spline) throw () + : DerivableFunction (1 + spline.parameters ().size (), 1, "limit speed"), + t_ (t), + spline_ (spline) + {} + + LimitSpeed::~LimitSpeed () throw () + {} + + void + LimitSpeed::impl_compute (result_t& res, const argument_t& p) const throw () + { + using namespace boost::numeric::ublas; + res.clear (); + + boost::scoped_ptr<GenericTrajectory> updatedSpline (spline_.clone ()); + updatedSpline->setParameters (p); + + res[0] = norm_2 (updatedSpline->derivative (t_)); + } + + void + LimitSpeed::impl_gradient (gradient_t& grad, const argument_t& p, size_type i) + const throw () + { + assert (i == 0); + grad.clear (); + + //FIXME: compute gradient analytically. + FiniteDifferenceGradient fdfunction (*this); + fdfunction.gradient (grad, p, 0); + } +} // end of namespace roboptim. diff --git a/tests/Makefile.am b/tests/Makefile.am index 33dee61..5a3a950 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -36,6 +36,16 @@ check_PROGRAMS += spline-optimization spline_optimization_SOURCES = spline-optimization.cc $(COMMON_SOURCES) spline_optimization_LDADD = $(top_builddir)/src/libroboptim-trajectory.la +# free-time-trajectory +check_PROGRAMS += free-time-trajectory +free_time_trajectory_SOURCES = free-time-trajectory.cc $(COMMON_SOURCES) +free_time_trajectory_LDADD = $(top_builddir)/src/libroboptim-trajectory.la + +# spline-time-optimization +check_PROGRAMS += spline-time-optimization +spline_time_optimization_SOURCES = spline-time-optimization.cc $(COMMON_SOURCES) +spline_time_optimization_LDADD = $(top_builddir)/src/libroboptim-trajectory.la + .PHONY: generate-reference @@ -59,7 +69,9 @@ generate-reference: # Distribute reference files. EXTRA_DIST += \ + free-time-trajectory.stdout \ simple.stdout \ spline-gradient.stdout \ spline-optimization.stdout \ + spline-optimization-time.stdout \ spline.stdout diff --git a/include/roboptim/trajectory/fwd.hh b/tests/free-time-trajectory.cc similarity index 66% copy from include/roboptim/trajectory/fwd.hh copy to tests/free-time-trajectory.cc index 584fb66..8ccdf25 100644 --- a/include/roboptim/trajectory/fwd.hh +++ b/tests/free-time-trajectory.cc @@ -15,25 +15,11 @@ // You should have received a copy of the GNU Lesser General Public License // along with roboptim. If not, see <http://www.gnu.org/licenses/>. -#ifndef ROBOPTIM_TRAJECTORY_FWD_HH -# define ROBOPTIM_TRAJECTORY_FWD_HH +#include "common.hh" -namespace roboptim +int run_test () { - template <unsigned dorder> - class Trajectory; + return 0; +} - template <typename T> - class StateCost; - - template <typename T> - class SumCost; - - template <typename T> - class TrajectoryCost; - - class Spline; - class SplineLength; -} // end of namespace roboptim. - -#endif //! ROBOPTIM_TRAJECTORY_FWD_HH +GENERATE_TEST () diff --git a/tests/free-time-trajectory.stdout b/tests/free-time-trajectory.stdout new file mode 100644 index 0000000..e69de29 diff --git a/tests/spline-optimization.stdout b/tests/spline-optimization.stdout index ea8c069..4e6ef69 100644 --- a/tests/spline-optimization.stdout +++ b/tests/spline-optimization.stdout @@ -19,7 +19,7 @@ set terminal wxt persist set multiplot layout 1,2 set grid -plot '-' with line +plot '-' title 'before' with line 0.000000 0.000000 0.000008 0.000033 0.000065 0.000260 @@ -423,7 +423,7 @@ plot '-' with line 100.000000 100.000000 e -plot '-' with line +plot '-' title 'after' with line -0.000000 -0.000000 0.000011 0.000011 0.000086 0.000086 diff --git a/tests/spline-time-optimization.cc b/tests/spline-time-optimization.cc new file mode 100644 index 0000000..20f3107 --- /dev/null +++ b/tests/spline-time-optimization.cc @@ -0,0 +1,130 @@ +// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA. +// +// This file is part of the roboptim. +// +// roboptim is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// roboptim is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with roboptim. If not, see <http://www.gnu.org/licenses/>. + +#include <boost/assign/list_of.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/numeric/ublas/io.hpp> + +#include <roboptim/core/finite-difference-gradient.hh> +#include <roboptim/core/solver-factory.hh> + +#include <roboptim/trajectory/free-time-trajectory.hh> +#include <roboptim/trajectory/freeze.hh> +#include <roboptim/trajectory/fwd.hh> +#include <roboptim/trajectory/spline-length.hh> +#include <roboptim/trajectory/spline.hh> +#include <roboptim/trajectory/trajectory-cost.hh> + +#include "common.hh" + +using namespace roboptim; + +typedef boost::mpl::vector<DerivableFunction, LinearFunction> constraint_t; +typedef Solver<DerivableFunction, constraint_t> solver_t; + +int run_test () +{ + using namespace boost::assign; + Spline::vector_t params (4); + + // Initial position. + params[0] = 0.; + // Control point 1. + params[1] = 25.; + // Control point 2. + params[2] = 75.; + // Final position. + params[3] = 100.; + + // Make trajectories. + Spline::interval_t timeRange = Spline::makeInterval (0., 4.); + Spline spline (timeRange, 1, params, "before"); + FreeTimeTrajectory<Spline::derivabilityOrder> freeTimeTraj (spline, 1.); + + // Define cost. + Function::matrix_t a (1, freeTimeTraj.parameters ().size ()); + a.clear (); + a (0, 0) = 1.; + Function::vector_t b (1); + b.clear (); + roboptim::NumericLinearFunction cost (a, b); + + // Create problem. + solver_t::problem_t problem (cost); + problem.startingPoint () = freeTimeTraj.parameters (); + + typedef Freeze<DerivableFunction, constraint_t, LinearFunction> freeze_t; + freeze_t freeze (problem, + list_of <freeze_t::frozenArgument_t> + (1, params[0]) + (params.size (), params[params.size () - 1])); + freeze (); + + SolverFactory<solver_t> factory ("cfsqp", problem); + solver_t& solver = factory (); + + + std::cout << "Cost function (before): " << cost (freeTimeTraj.parameters ()) + << std::endl + << "Parameters (before): " << freeTimeTraj.parameters () + << std::endl; + + solver_t::result_t res = solver.minimum (); + + std::cout << solver << std::endl; + + switch (res.which ()) + { + case GenericSolver::SOLVER_VALUE: + { + Result& result = boost::get<Result> (res); + FreeTimeTrajectory<Spline::derivabilityOrder> optimizedTrajectory = + freeTimeTraj; + optimizedTrajectory.setParameters (result.x); + std::cout << "Parameters (after): " << optimizedTrajectory.parameters () + << std::endl; + break; + } + + case GenericSolver::SOLVER_NO_SOLUTION: + { + std::cout << "No solution" << std::endl; + return 1; + } + case GenericSolver::SOLVER_VALUE_WARNINGS: + { + ResultWithWarnings& result = boost::get<ResultWithWarnings> (res); + FreeTimeTrajectory<Spline::derivabilityOrder> optimizedTrajectory = + freeTimeTraj; + optimizedTrajectory.setParameters (result.x); + std::cout << result << std::endl; + std::cout << "Parameters (after): " << optimizedTrajectory.parameters () + << std::endl; + break; + } + + case GenericSolver::SOLVER_ERROR: + { + SolverError& result = boost::get<SolverError> (res); + std::cout << result << std::endl; + return 1; + } + } + return 0; +} + +GENERATE_TEST () diff --git a/tests/spline-time-optimization.stdout b/tests/spline-time-optimization.stdout new file mode 100644 index 0000000..093069b --- /dev/null +++ b/tests/spline-time-optimization.stdout @@ -0,0 +1,42 @@ +Cost function (before): [1](1) +Parameters (before): [5](1,0,25,75,100) +Problem: + Numeric linear function + A = [1,5]((1,0,0,0,0)) + B = [1](0) + Argument's bounds: (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf) + Argument's scales: 1, 1, 1, 1, 1 + Number of constraints: 2 + Constraint 0 + Numeric linear function + A = [1,5]((0,1,0,0,0)) + B = [1](-0) + Bounds: (0, 0) + Scales: 1 + Initial value: [1](0) + + Constraint 1 + Numeric linear function + A = [1,5]((0,0,0,0,1)) + B = [1](-100) + Bounds: (0, 0) + Scales: 1 + Initial value: [1](0) + + Starting point: [5](1,0,25,75,100) + Starting value: [1](1) + Infinity value (for all functions): inf +CFSQP specific variables: + Nineq: 0 + Nineqn: 0 + Neq: 2 + Neqn: 2 + Mode: 100 + Iprint: 0 + Miter: 500 + Bigbnd: 1e+10 + Eps: 1e-08 + Epseqn: 1e-08 + Udelta: 1e-08 + CFSQP constraints: (0, 1), (1, 1) +Parameters (after): [5](-1e+10,-2.95264e-14,25,75,100) diff --git a/tests/spline.stdout b/tests/spline.stdout index fbe686b..9c12328 100644 --- a/tests/spline.stdout +++ b/tests/spline.stdout @@ -13,7 +13,7 @@ #!/usr/bin/gnuplot # Generated by RobOptim core library 0.2 set terminal wxt persist -plot '-' with line +plot '-' title 'spline' with line 0.000000 0.000000 0.000004 0.000008 0.000033 0.000067 diff --git a/tests/testsuite.at b/tests/testsuite.at index 1a1b998..59f145c 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -32,5 +32,7 @@ CHECK_STDOUT([simple], [Check basic features.]) CHECK_STDOUT([spline], [Check Spline class.]) CHECK_STDOUT([spline-gradient], [Check Spline gradient.]) CHECK_STDOUT([spline-optimization], [Optimize a Spline with Cfsqp.]) +CHECK_STDOUT([free-time-trajectory], [Check free time trajectory.]) +CHECK_STDOUT([spline-optimization-time], [Optimize a free time trajectory.]) # End of testsuite.at ----------------------------------------------------------------------- Summary of changes: ChangeLog | 25 +++ include/Makefile.am | 1 + .../roboptim/trajectory/free-time-trajectory.hh | 48 +++++-- .../roboptim/trajectory/free-time-trajectory.hxx | 167 ++++++++++++++------ include/roboptim/trajectory/fwd.hh | 2 + .../roboptim/trajectory/{fwd.hh => limit-speed.hh} | 34 ++-- include/roboptim/trajectory/spline.hh | 2 + include/roboptim/trajectory/trajectory.hh | 9 +- src/Makefile.am | 1 + src/limit-speed.cc | 61 +++++++ tests/Makefile.am | 12 ++ tests/{simple.cc => free-time-trajectory.cc} | 4 - .../{simple.stdout => free-time-trajectory.stdout} | 0 tests/spline-optimization.stdout | 4 +- tests/spline-time-optimization.cc | 130 +++++++++++++++ tests/spline-time-optimization.stdout | 42 +++++ tests/spline.stdout | 2 +- tests/testsuite.at | 2 + 18 files changed, 461 insertions(+), 85 deletions(-) copy include/roboptim/trajectory/{fwd.hh => limit-speed.hh} (56%) create mode 100644 src/limit-speed.cc copy tests/{simple.cc => free-time-trajectory.cc} (92%) copy tests/{simple.stdout => free-time-trajectory.stdout} (100%) create mode 100644 tests/spline-time-optimization.cc create mode 100644 tests/spline-time-optimization.stdout hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-07-15 05:48:44
|
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". The branch, trajectory has been updated via 811331a1ad777e218a0f587e8029c7f3ded3b756 (commit) from 1627fe75da1fd9eb74269a45a77daa151265cfae (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 811331a1ad777e218a0f587e8029c7f3ded3b756 Author: Thomas Moulard <tho...@gm...> Date: Wed Jul 15 14:48:05 2009 +0900 Make use of function's names in trajectory classes. * include/roboptim/trajectory/spline.hh, * include/roboptim/trajectory/trajectory.hh, * include/roboptim/trajectory/trajectory.hxx: Add function name to constructor with default value. * include/roboptim/trajectory/visualization/trajectory.hh: Display function name. * src/spline.cc: Pass function name to parent class. * tests/spline-optimization.cc: Set function's names. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 51b29f3..c9fc98c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2009-07-15 Thomas Moulard <tho...@gm...> + Make use of function's names in trajectory classes. + * include/roboptim/trajectory/spline.hh, + * include/roboptim/trajectory/trajectory.hh, + * include/roboptim/trajectory/trajectory.hxx: + Add function name to constructor with default value. + * include/roboptim/trajectory/visualization/trajectory.hh: + Display function name. + * src/spline.cc: Pass function name to parent class. + * tests/spline-optimization.cc: Set function's names. + +2009-07-15 Thomas Moulard <tho...@gm...> + Use fixed-point display in Gnuplot. * include/roboptim/trajectory/visualization/trajectory.hh, * tests/spline-gradient.cc: diff --git a/include/roboptim/trajectory/spline.hh b/include/roboptim/trajectory/spline.hh index 8db372c..6211c4b 100644 --- a/include/roboptim/trajectory/spline.hh +++ b/include/roboptim/trajectory/spline.hh @@ -53,7 +53,7 @@ namespace roboptim /// \param dimension spline dimension /// \param parameters vector of parameters defining control points Spline (interval_t timeRange, size_type dimension, - const vector_t& parameters) throw (); + const vector_t& parameters, std::string name = "spline") throw (); /// \brief Copy constructor. /// \param spline spline that will be copied diff --git a/include/roboptim/trajectory/trajectory.hh b/include/roboptim/trajectory/trajectory.hh index a3d93f8..e6548d1 100644 --- a/include/roboptim/trajectory/trajectory.hh +++ b/include/roboptim/trajectory/trajectory.hh @@ -59,8 +59,6 @@ namespace roboptim /// \brief Import interval type. typedef typename parent_t::interval_t interval_t; - - Trajectory (interval_t, size_type, const vector_t&) throw (); virtual ~Trajectory () throw (); /// \name Accessing parameters, and state. @@ -157,7 +155,11 @@ namespace roboptim /// \} virtual std::ostream& print (std::ostream&) const throw (); + protected: + Trajectory (interval_t, size_type, const vector_t&, + std::string name = std::string ()) throw (); + interval_t timeRange_; vector_t parameters_; size_type singularPoints_; diff --git a/include/roboptim/trajectory/trajectory.hxx b/include/roboptim/trajectory/trajectory.hxx index 86a4aa6..a8a657b 100644 --- a/include/roboptim/trajectory/trajectory.hxx +++ b/include/roboptim/trajectory/trajectory.hxx @@ -23,9 +23,10 @@ namespace roboptim template <unsigned dorder> Trajectory<dorder>::Trajectory (interval_t tr, size_type outputSize, - const vector_t& p) + const vector_t& p, + std::string name) throw () - : parent_t (outputSize), + : parent_t (outputSize, name), timeRange_ (tr), parameters_ (p), singularPoints_ () diff --git a/include/roboptim/trajectory/visualization/trajectory.hh b/include/roboptim/trajectory/visualization/trajectory.hh index 468444e..428056a 100644 --- a/include/roboptim/trajectory/visualization/trajectory.hh +++ b/include/roboptim/trajectory/visualization/trajectory.hh @@ -71,7 +71,9 @@ namespace roboptim Function::value_type max = Function::getUpperBound (traj.timeRange ()); Function::discreteInterval_t interval (min, max, step); - std::string str = "plot '-' with line\n"; + std::string str = (boost::format ("plot '-' title '%1%' with line\n") + % traj.getName ()).str (); + traj.foreach (interval, PlotTrajectory<Trajectory<N> > (traj, str)); str += "e\n"; return Command (str); diff --git a/src/spline.cc b/src/spline.cc index 1f68975..c605009 100644 --- a/src/spline.cc +++ b/src/spline.cc @@ -40,9 +40,10 @@ namespace roboptim } // end of namespace detail. //FIXME: defined_lc_in has to be true (false untested). - Spline::Spline (interval_t tr, size_type outputSize, const vector_t& p) + Spline::Spline (interval_t tr, size_type outputSize, const vector_t& p, + std::string name) throw () - : Trajectory<4> (tr, outputSize, p), + : Trajectory<4> (tr, outputSize, p, name), spline_ (), nbp_ (p.size () / outputSize) { diff --git a/tests/spline-optimization.cc b/tests/spline-optimization.cc index 351c72d..0fd3f42 100644 --- a/tests/spline-optimization.cc +++ b/tests/spline-optimization.cc @@ -56,7 +56,9 @@ int run_test () // Final position. params[6] = 100., params[7] = 100.; - Spline spline (std::make_pair (0., 4.), 2, params); + Spline::interval_t timeRange = Spline::makeInterval (0., 4.); + + Spline spline (timeRange, 2, params, "before"); discreteInterval_t interval (0., 4., 0.01); std::cout @@ -149,9 +151,9 @@ int run_test () case GenericSolver::SOLVER_VALUE: { Result& result = boost::get<Result> (res); - spline.setParameters (result.x); + Spline optimizedSpline (timeRange, 2, result.x, "after"); params = result.x; - gnuplot << plot_xy (spline); + gnuplot << plot_xy (optimizedSpline); break; } @@ -163,10 +165,10 @@ int run_test () case GenericSolver::SOLVER_VALUE_WARNINGS: { ResultWithWarnings& result = boost::get<ResultWithWarnings> (res); - spline.setParameters (result.x); + Spline optimizedSpline (timeRange, 2, result.x, "after"); params = result.x; std::cerr << result << std::endl; - gnuplot << plot_xy (spline); + gnuplot << plot_xy (optimizedSpline); break; } ----------------------------------------------------------------------- Summary of changes: ChangeLog | 12 ++++++++++++ include/roboptim/trajectory/spline.hh | 2 +- include/roboptim/trajectory/trajectory.hh | 6 ++++-- include/roboptim/trajectory/trajectory.hxx | 5 +++-- .../trajectory/visualization/trajectory.hh | 4 +++- src/spline.cc | 5 +++-- tests/spline-optimization.cc | 12 +++++++----- 7 files changed, 33 insertions(+), 13 deletions(-) hooks/post-receive -- roboptim |