Extracting & Visualizing Robot Data

Extracting & Visualizing Robot Data#

Record a Rosbag#

To record information from your experiment, it can simply be done using rosbag.

rosbag record -o NAME_OF_THE_BAG /introspection_data/names /introspection_data/values 

Once you want to stop recording just cancel it using Ctrl-C

Then copy the file in your development PC

scp -C NAME_OF_THE_BAG pal@development:PATH_TO_SAVE_IT

Visualize variables#

In your development PC you can plot all the data using PlotJuggler.

rosrun plotjuggler PlotJuggler

Once PlotJuggler is open load the bag: File -> Load Data and select the recorded rosbag.

Then select the variable you want to visualize and drag it into the

Record new variables#

In order to record new variables it will be necessary to register them inside your code as follows.

  #include <pal_statistics/pal_statistics.h>
  #include <pal_statistics/pal_statistics_macros.h>
  #include <pal_statistics/registration_utils.h>

  ...

  double aux = 0;
  pal_statistics::RegistrationsRAII registered_variables_;
  REGISTER_VARIABLE("/introspection_data", "example_aux", &aux, &registered_variables_);

  Eigen::Vector3d vec(0,0,0);
  REGISTER_VARIABLE("/introspection_data", "example_vec_x", &vec[0], &registered_variables_);
  REGISTER_VARIABLE("/introspection_data", "example_vec_y", &vec[1], &registered_variables_);
  REGISTER_VARIABLE("/introspection_data", "example_vec_z", &vec[2], &registered_variables_);