### Merge branch 'export_plot' into 'devel'

```Export plot

See merge request loco-3d/curves!42```
parents 05880e99 d2f18b68
 ... ... @@ -18,48 +18,6 @@ To do so, tools are provided to: The library is template-based, thus generic: the curves can be of any dimension, and can be implemented in double, float ... ---------- Example of use for and end-effector trajectory ------------- The library comes with an helper class to automatically generate end-effector trajectories. For instance, to create a 2 second long trajectory from the point (0,0,0) to (1,1,0), with a waypoint at (0.5,0.5,0.5), one can use the following code: ```cpp typedef std::pair Waypoint; typedef std::vector T_Waypoint; // loading helper class namespace using namespace spline::helpers; // Create waypoints waypoints.push_back(std::make_pair(0., Eigen::Vector3d(0,0,0))); waypoints.push_back(std::make_pair(1., Eigen::Vector3d(0.5,0.5,0.5))); waypoints.push_back(std::make_pair(2., Eigen::Vector3d(1,1,0))); exact_cubic_t* eff_traj = effector_spline(waypoints.begin(),waypoints.end()); // evaluate spline (*eff_traj)(0.); // (0,0,0) (*eff_traj)(2.); // (1,1,0) ``` If rotation of the effector must be considered, the code is almost the same: ```cpp // initial rotation is 0, end rotation is a rotation by Pi around x axis quat_t init_rot(0,0,0,1), end_rot(1,0,0,0); effector_spline_rotation eff_traj_rot(waypoints.begin(),waypoints.end(), init_quat, end_quat); // evaluate spline eff_traj_rot(0.); // (0,0,0,0,0,0,1) eff_traj_rot(1.); // (0.5,0.5,0.5,0.707107,0,0,0.707107) // Pi/2 around x axis eff_traj_rot(2.); // (0,0,0,1,0,0,0) ``` Additional parameters for the same methods an be used to specify parameters for the take off and landing phases: height and duration of the phase, and along which normal. Please refer to the Main.cpp files to see all the unit tests and possibilities offered by the library Installation ------------- ... ... @@ -75,20 +33,18 @@ This package is available as binary in [robotpkg/wip](http://robotpkg.openrobots To handle this with cmake, use the recursive option to clone the repository. For instance, using http: ``` git clone --recursive https://github.com/stonneau/spline.git \$SPLINE_DIR git clone --recursive https://github.com/loco-3d/curves \$CURVES_DIR ``` The library is header only, so the build only serves to build the tests and python bindings: ```sh cd \$SPLINE_DIR && mkdir build && cd build cmake .. && make ../bin/tests cd \$CURVES_DIR && mkdir build && cd build cmake .. && make && make test ``` If everything went fine you should obtain the following output: ```sh performing tests... no errors found 100% tests passed, 0 tests failed out of 3 ``` ### Optional: Python bindings installation To install the Python bindings, in the CMakeLists.txt file, first enable the BUILD_PYTHON_INTERFACE option: ... ... @@ -98,13 +54,18 @@ OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON) Then rebuild the library: ```sh cd \$SPLINE_DIR/build cd \$CURVES_DIR/build cmake -DCMAKE_INSTALL_PREFIX=\${DEVEL_DIR}/install .. make install ``` The python bindings should then be accessible through the package centroidal_dynamics. To see example of use, you can refer to the [test file](https://github.com/stonneau/spline/blob/master/python/test/test.py) which is rather self explanatory: In spite of an exhaustive documentation, please refer to the C++ documentation, which mostly applies to python. For the moment, only bezier curves are binded. Documentation and tutorial ------------- For a python tutorial, you can refer to the [jupyter notebook](https://github.com/loco-3d/curves/blob/devel/python/test/sandbox/test.ipynb) . The [test file](https://github.com/loco-3d/curves/blob/master/python/test/test.py) is more exhaustive and rather self explanatory. Please refer to the C++ manual, which mostly applies to python.
doc/curves.pdf 0 → 100644
This diff is collapsed.

34.7 KB

 ... ... @@ -40,7 +40,7 @@ struct bezier_curve : public curve_abc { typedef typename t_point_t::const_iterator cit_point_t; typedef bezier_curve bezier_curve_t; typedef boost::shared_ptr bezier_curve_ptr_t; typedef piecewise_curve piecewise_curve_t; typedef piecewise_curve piecewise_curve_t; typedef curve_abc curve_abc_t; // parent class typedef typename curve_abc_t::curve_ptr_t curve_ptr_t; ... ...
 ... ... @@ -29,7 +29,7 @@ template typename Point_derivate, typename CurveType> struct piecewise_curve; template ... ... @@ -82,19 +82,19 @@ typedef polynomial polynomial_t; typedef exact_cubic exact_cubic_t; typedef bezier_curve bezier_t; typedef cubic_hermite_spline cubic_hermite_spline_t; typedef piecewise_curve piecewise_t; typedef piecewise_curve piecewise_t; // definition of all curves class with point3 as return type: typedef polynomial polynomial3_t; typedef exact_cubic exact_cubic3_t; typedef bezier_curve bezier3_t; typedef cubic_hermite_spline cubic_hermite_spline3_t; typedef piecewise_curve piecewise3_t; typedef piecewise_curve piecewise3_t; // special curves with return type fixed: typedef SO3Linear SO3Linear_t; typedef SE3Curve SE3Curve_t; typedef piecewise_curve piecewise_SE3_t; typedef piecewise_curve piecewise_SE3_t; } ... ...
 ... ... @@ -25,7 +25,7 @@ namespace curves { /// template , typename Point_derivate = Point > typename Point_derivate = Point, typename CurveType = curve_abc > struct piecewise_curve : public curve_abc { typedef Point point_t; typedef Point_derivate point_derivate_t; ... ... @@ -33,11 +33,12 @@ struct piecewise_curve : public curve_abc > t_point_derivate_t; typedef Time time_t; typedef Numeric num_t; typedef curve_abc curve_t; // parent class typedef curve_abc base_curve_t; // parent class typedef CurveType curve_t; // contained curves base class typedef boost::shared_ptr curve_ptr_t; typedef typename std::vector t_curve_ptr_t; typedef typename std::vector
 ... ... @@ -24,7 +24,16 @@ IF(APPLE) SET_TARGET_PROPERTIES(\${PY_NAME} PROPERTIES SUFFIX ".so") ENDIF(APPLE) INSTALL(TARGETS \${PY_NAME} DESTINATION \${PYTHON_SITELIB}) INSTALL(TARGETS \${PY_NAME} DESTINATION \${PYTHON_SITELIB}/\${PY_NAME}) install (FILES plot/plot.py deploy/__init__.py DESTINATION \${PYTHON_SITELIB}/\${PY_NAME}) install (FILES deploy/optimization/__init__.py DESTINATION \${PYTHON_SITELIB}/\${PY_NAME}/optimization) ADD_PYTHON_UNIT_TEST("python-curves" "python/test/test.py" "python") ADD_PYTHON_UNIT_TEST("python-optimization" "python/test/optimization.py" "python") ADD_PYTHON_UNIT_TEST("python-notebook" "python/test/notebook.py" "python")