{"id":19414439,"url":"https://github.com/ethz-adrl/towr","last_synced_at":"2025-05-16T10:07:38.637Z","repository":{"id":38433437,"uuid":"117434408","full_name":"ethz-adrl/towr","owner":"ethz-adrl","description":"A light-weight, Eigen-based C++ library for trajectory optimization for legged robots.","archived":false,"fork":false,"pushed_at":"2023-04-17T14:37:35.000Z","size":5380,"stargazers_count":976,"open_issues_count":26,"forks_count":238,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-04-19T13:14:15.508Z","etag":null,"topics":["biped","collocation","computer-graphics","eigen","ifopt","ipopt","legged-robots","locomotion","motion-planning","nonlinear-programming","physics-based-animation","quadruped","robot","ros","snopt","trajectory-optimization","xpp"],"latest_commit_sha":null,"homepage":"http://wiki.ros.org/towr","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethz-adrl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-01-14T13:53:05.000Z","updated_at":"2025-04-13T18:17:29.000Z","dependencies_parsed_at":"2024-04-14T00:48:35.428Z","dependency_job_id":null,"html_url":"https://github.com/ethz-adrl/towr","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethz-adrl%2Ftowr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethz-adrl%2Ftowr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethz-adrl%2Ftowr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethz-adrl%2Ftowr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethz-adrl","download_url":"https://codeload.github.com/ethz-adrl/towr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509476,"owners_count":22082891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["biped","collocation","computer-graphics","eigen","ifopt","ipopt","legged-robots","locomotion","motion-planning","nonlinear-programming","physics-based-animation","quadruped","robot","ros","snopt","trajectory-optimization","xpp"],"created_at":"2024-11-10T12:38:07.472Z","updated_at":"2025-05-16T10:07:33.629Z","avatar_url":"https://github.com/ethz-adrl.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg align=\"right\" src=\"https://i.imgur.com/qI1Jfyl.gif\" width=\"55%\"/\u003e\n\n[\u003cimg src=\"https://i.imgur.com/qliQVx1.png\" /\u003e](https://ieeexplore.ieee.org/document/8283570 \"Go to RA-L paper\")\n\n*A light-weight and extensible C++ library for trajectory optimization for legged robots.*\n\n[![Build Status](http://build.ros.org/buildStatus/icon?job=Mdev__towr__ubuntu_bionic_amd64)](http://build.ros.org/view/Mdev/job/Mdev__towr__ubuntu_bionic_amd64/)\n[![Documentation](https://img.shields.io/badge/docs-generated-brightgreen.svg)](http://docs.ros.org/kinetic/api/towr/html/)\n[![ROS hosting](https://img.shields.io/badge/ROS-integration-blue.svg)](http://wiki.ros.org/towr)\n![](https://tokei.rs/b1/github/ethz-adrl/towr?category=code)\n[![CodeFactor](https://www.codefactor.io/repository/github/ethz-adrl/towr/badge)](https://www.codefactor.io/repository/github/ethz-adrl/towr)\n[![License BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29#fulltext)\n\nA base-set of variables, costs and constraints that can be combined and extended to formulate trajectory optimization problems for legged systems. These implementations have been used to generate a variety of motions such as monoped hopping, biped walking, or a complete quadruped trotting cycle, while optimizing over the gait and step durations in less than 100ms ([paper](https://ieeexplore.ieee.org/document/8283570/)).  \n\nFeatures:  \n:heavy_check_mark: Intuitive and efficient formulation of variables, cost and constraints using [Eigen].   \n:heavy_check_mark: [ifopt] enables using the high-performance solvers [Ipopt] and [Snopt].  \n:heavy_check_mark: Elegant rviz visualization of motion plans using [xpp].  \n:heavy_check_mark: [ROS]/[catkin] integration (optional).  \n:heavy_check_mark: Light-weight ([~6k lines](https://i.imgur.com/gP3gv34.png) of code) makes it easy to use and extend.  \n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#install\"\u003eInstall\u003c/a\u003e •\n  \u003ca href=\"#run\"\u003eRun\u003c/a\u003e •\n  \u003ca href=\"#develop\"\u003eDevelop\u003c/a\u003e •\n  \u003ca href=\"#contribute\"\u003eContribute\u003c/a\u003e •\n  \u003ca href=\"#publications\"\u003ePublications\u003c/a\u003e •\n  \u003ca href=\"#authors\"\u003eAuthors\u003c/a\u003e\n\u003c/p\u003e\n\n[\u003cimg src=\"https://i.imgur.com/8M4v4aP.gif\" /\u003e](https://youtu.be/0jE46GqzxMM \"Show more examples on Youtube\")\n\n## Install\nThe easiest way to install is through the [ROS binaries](http://wiki.ros.org/towr):\n```bash\nsudo apt-get install ros-\u003cros-distro\u003e-towr-ros\n```\n\nIn case these don't yet exist for your distro, there are two ways to build this code from source:\n* [Option 1](#towr-with-cmake): core library and hopper-example with pure [CMake].\n* [Option 2](#towr-ros-with-catkin) (recommended): core library \u0026 GUI \u0026 ROS-rviz-visualization built with [catkin] and [ROS]. \n\n\n#### \u003ca name=\"towr-with-cmake\"\u003e\u003c/a\u003e Building with CMake\n* Install dependencies [CMake], [Eigen], [Ipopt]:\n  ```bash\n  sudo apt-get install cmake libeigen3-dev coinor-libipopt-dev\n  ```\n  Install [ifopt], by cloning the repo and then: ``cmake .. \u0026\u0026 make install`` on your system. \n\n* Build towr:\n  ```bash\n  git clone https://github.com/ethz-adrl/towr.git \u0026\u0026 cd towr/towr\n  mkdir build \u0026\u0026 cd build\n  cmake .. -DCMAKE_BUILD_TYPE=Release\n  make\n  sudo make install # copies files in this folder to /usr/local/*\n  # sudo xargs rm \u003c install_manifest.txt # in case you want to uninstall the above\n  ```\n\n* Test ([hopper_example.cc](towr/test/hopper_example.cc)): Generates a motion for a one-legged hopper using Ipopt\n  ```bash\n  ./towr-example # or ./towr-test if gtest was found\n  ```\n \n* Use: You can easily customize and add your own constraints and variables to the optimization problem.\n  Herefore, add the following to your *CMakeLists.txt*:\n  ```cmake\n  find_package(towr 1.2 REQUIRED)\n  add_executable(main main.cpp) # Your custom variables, costs and constraints added to TOWR\n  target_link_libraries(main PUBLIC towr::towr) # adds include directories and libraries\n  ```\n\n#### \u003ca name=\"towr-ros-with-catkin\"\u003e\u003c/a\u003e Building with catkin\nWe provide a [ROS]-wrapper for the pure cmake towr library, which adds a keyboard interface to modify goal state and motion types as well as visualizes the produces motions plans in rviz using [xpp]. \n\n* Install dependencies [CMake], [catkin], [Eigen], [Ipopt], [ROS], [xpp], [ncurses], [xterm]:\n  ```bash\n  sudo apt-get install cmake libeigen3-dev coinor-libipopt-dev libncurses5-dev xterm\n  sudo apt-get install ros-\u003cros-distro\u003e-desktop-full ros-\u003cros-distro\u003e-xpp\n  ```\n\n* Build workspace:\n  ```bash\n  cd catkin_workspace/src\n  git clone https://github.com/ethz-adrl/ifopt.git\n  git clone https://github.com/ethz-adrl/towr.git\n  cd ..\n  catkin_make_isolated -DCMAKE_BUILD_TYPE=Release # or `catkin build`\n  source ./devel_isolated/setup.bash\n  ```\n  \n* Use: Include in your catkin project by adding to your *CMakeLists.txt* \n  ```cmake\n  add_compile_options(-std=c++11)\n  find_package(catkin COMPONENTS towr) \n  include_directories(${catkin_INCLUDE_DIRS})\n  target_link_libraries(foo ${catkin_LIBRARIES})\n  ```\n  Add the following to your *package.xml*:\n  ```xml\n  \u003cpackage\u003e\n    \u003cdepend\u003etowr\u003c/depend\u003e\n  \u003c/package\u003e\n  ```\n  \n## Run\n  Launch the program using\n  ```bash\n  roslaunch towr_ros towr_ros.launch  # debug:=true  (to debug with gdb)\n  ```\n  Click in the xterm terminal and hit 'o'. \n  \n  Information about how to tune the paramters can be found [here](http://docs.ros.org/api/towr/html/group__Parameters.html). \n  \n## Develop\n#### Library overview\n * The relevant classes and parameters to build on are collected [modules](http://docs.ros.org/api/towr/html/modules.html).\n * A nice graphical overview as UML can be seen [here](http://docs.ros.org/api/towr/html/inherits.html).\n * The [doxygen documentation](http://docs.ros.org/api/towr/html/) provides helpful information for developers.\n\n#### Problem formulation\n * This code formulates the variables, costs and constraints using ifopt, so it makes sense to briefly familiarize with the syntax using [this example].\n * A minimal towr example without ROS, formulating a problem for a one-legged hopper, \n  can be seen [here](towr/test/hopper_example.cc) and is great starting point.\n * We recommend using the ROS infrastructure provided to dynamically visualize, plot and change the problem formulation. To define your own problem using this infrastructure, use this [example](towr_ros/src/towr_ros_app.cc) as a guide. \n \n#### Add your own variables, costs and constraints\n * This library provides a set of variables, costs and constraints to formulate the trajectory optimization problem. An [example formulation](towr/include/towr/nlp_formulation.h) of how to combine these is given, however, this formulation can probably be improved. To add your own e.g. constraint-set, define a class with it's values and derivatives, and then add it to the formulation ```nlp.AddConstraintSet(your_custom_constraints);``` as shown [here](towr/test/hopper_example.cc).\n\n#### Add your own robot\n * Want to add your own robot to towr? Start [here](http://docs.ros.org/en/melodic/api/towr/html/group__Robots.html).\n * To visualize that robot in rviz, see [xpp].\n\n## Contribute\nWe love pull request, whether its new constraint formulations, additional robot models, bug fixes, unit tests or updating the documentation. Please have a look at [CONTRIBUTING.md](CONTRIBUTING.md) for more information.  \nSee here the list of [contributors](https://github.com/ethz-adrl/towr/graphs/contributors) who participated in this project.\n\n## Projects using towr\n * https://github.com/popi-mkx3/popi_project\n\n## Publications\nAll publications underlying this code can be found [here](https://www.alex-winkler.com). \nThe core paper is:\n \n    @article{winkler18,\n      author    = {Winkler, Alexander W and Bellicoso, Dario C and \n                   Hutter, Marco and Buchli, Jonas},\n      title     = {Gait and Trajectory Optimization for Legged Systems \n                   through Phase-based End-Effector Parameterization},\n      journal   = {IEEE Robotics and Automation Letters (RA-L)},\n      year      = {2018},\n      month     = {July},\n      pages     = {1560-1567},\n      volume    = {3},\n      doi       = {10.1109/LRA.2018.2798285},\n    }\n    \nA broader overview of the topic of Trajectory optimization and derivation of \nthe Single-Rigid-Body Dynamics model used in this work: \n[DOI 10.3929/ethz-b-000272432](https://doi.org/10.3929/ethz-b-000272432)  \n\n\n## Authors \n[Alexander W. Winkler](https://www.alex-winkler.com) - Initial Work/Maintainer\n\nThe work was carried out at the following institutions:\n\n[\u003cimg src=\"https://i.imgur.com/aGOnNTZ.png\" height=\"45\" /\u003e](https://www.ethz.ch/en.html \"ETH Zurich\") \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; [\u003cimg src=\"https://i.imgur.com/uCvLs2j.png\" height=\"45\" /\u003e](http://www.adrl.ethz.ch/doku.php \"Agile and Dexterous Robotics Lab\")  \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;[\u003cimg src=\"https://i.imgur.com/gYxWH9p.png\" height=\"45\" /\u003e](http://www.rsl.ethz.ch/ \"Robotic Systems Lab\")\n\n\n[A. W. Winkler]: https://awinkler.github.io/publications.html\n[CMake]: https://cmake.org/cmake/help/v3.0/\n[std_msgs]: http://wiki.ros.org/std_msgs\n[roscpp]: http://wiki.ros.org/roscpp\n[message_generation]: http://wiki.ros.org/message_generation\n[rosbag]: http://wiki.ros.org/rosbag \n[HyQ]: https://www.iit.it/research/lines/dynamic-legged-systems\n[ANYmal]: http://www.rsl.ethz.ch/robots-media/anymal.html\n[ROS]: http://www.ros.org\n[xpp]: http://wiki.ros.org/xpp\n[ifopt_core]: https://github.com/ethz-adrl/ifopt\n[ifopt]: https://github.com/ethz-adrl/ifopt\n[Ipopt]: https://projects.coin-or.org/Ipopt\n[ncurses]: http://invisible-island.net/ncurses/man/ncurses.3x.html\n[xterm]: https://linux.die.net/man/1/xterm\n[Snopt]: http://www.sbsi-sol-optimize.com/asp/sol_product_snopt.htm\n[rviz]: http://wiki.ros.org/rviz\n[catkin]: http://wiki.ros.org/catkin\n[catkin tools]: http://catkin-tools.readthedocs.org/\n[Eigen]: http://eigen.tuxfamily.org\n[this example]: https://github.com/ethz-adrl/ifopt/blob/master/ifopt_core/test/ifopt/test_vars_constr_cost.h\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethz-adrl%2Ftowr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethz-adrl%2Ftowr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethz-adrl%2Ftowr/lists"}