[Documentation] [TitleIndex] [WordIndex


Getting Started

Just download the precompiled debian for your ros distro (e.g. kinetic) and playback the bag files:

$ sudo apt-get install ros-kinetic-xpp
$ roslaunch xpp_examples hyq_bag.launch

Also you can always clone the repo into your catkin workspace and build from source, as described here.


Generating messages

The more involved example trajectories shown have been generated with towr, an optimizer for legged robot motions. However, simple motion plans can also be generated by hand as shown below. This example is taken from xpp_examples/monoped_pub.cc. Run it using

$ roslaunch xpp_examples monoped_ex_generate.launch 

   1 #include <ros/ros.h>
   2 #include <xpp_msgs/RobotStateCartesian.h>
   3 #include <xpp_states/robot_state_cartesian.h>
   4 #include <xpp_states/convert.h>
   6 using namespace xpp;
   8 int main(int argc, char *argv[])
   9 {
  10   ros::init(argc, argv, "hopper_publisher");
  11   ros::NodeHandle n;
  12   ros::Publisher state_pub = n.advertise<xpp_msgs::RobotStateCartesian>("state", 1);
  14   // visualize the state of a one-legged hopper
  15   RobotStateCartesian hopper(1);
  17   // publishes a sequence of states for a total duration of T spaced 0.01s apart.
  18   double T = 2.0;
  19   double t = 0.0;
  20   double dt = 0.01;
  21   while (t < T)
  22   {
  23     // base and foot follow half a sine motion up and down
  24     hopper.base_.lin.p_.z()        = 0.7 - 0.05*sin(M_PI/T*t);
  25     hopper.ee_motion_.at(0).p_.z() = 0.1*sin(M_PI/T*t);
  26     hopper.ee_forces_.at(0).z()    = 100;  // Newtons
  27     hopper.ee_contact_.at(0)       = true; // leg in contact
  29     state_pub.publish(Convert::ToRos(hopper));
  31     ros::spinOnce();
  32     ros::Duration(dt).sleep(); // pause loop so visualization has correct speed.
  33     t += dt;
  34   }
  35 }

Plot the motions

The visualized trajectories in the rosbags can be easily plotted.

$ roscd xpp_examples/bags/
$ rqt_bag hyq.bag 

Then simply right-click on xpp/state_des and View -> Plot.


Or load the rosbag in PlotJuggler


Visualize your own robot

To visualize your own URDF is very easy to setup. A minimal example to follow can be seen here:urdf_visualizer_hyq1.cc.


We would be happy to see a pull-request to add your robot. Apart from benefitting the open-source community, this also adds publicity and visibility to you / your lab. The ROS page you can then design for your robot could look similar to this: xpp_hyq.

Packages Overview

The core packages that this ROS stack offers are:

Some optional packages include:


If you use this work in an academic context, please consider citing the code as

  author = {Alexander W. Winkler},
  title  = {{Xpp - A collection of ROS packages for the visualization of legged robots}},
  year   = {2017},
  doi    = {10.5281/zenodo.1037901},
  url    = {https://doi.org/10.5281/zenodo.1037901}

This software has been used in the following publications:


Please post any questions you have at ROS Answers using the tag xpp.

2024-06-15 13:49