Ask Your Question

How to log Clearpath Husky topic values in a text file

asked 2013-10-27 00:58:03 -0500

Marcus Barnet gravatar image

updated 2014-04-20 14:09:43 -0500

ngrennan gravatar image

At the moment, I control my Husky robot by using a wireless joypad as described in Husky-ROS tutorial

 roslaunch clearpath_base example.launch
 roslaunch clearpath_teleop teleop.launch

Since I need to log some parameters (such as left and right linear velocity, encoders ticks, etc..), I use "rostopic echo" and then I re-direct the output to a text file.

For example, I do as follows:

rostopic echo /clearpath/robots/default/cmd_vel >> log-for-vel.txt

After this, I wrote down a bash script which is able to extract only the desired values from the log files.

Typically, each topic file is something like this:

      seq: 778
        secs: 1380713547
        nsecs: 429730892
      frame_id: ''
    left_speed: 0.34
    right_speed: 0.34
    left_accel: 0.5
    right_accel: 0.5
  seq: 779
    secs: 1380713544
    nsecs: 735946893
  frame_id: ''
left_speed: 0.26
right_speed: 0.26
left_accel: 0.5
right_accel: 0.5

And I just need to extract timestamp and left and right velocity information.

Since this is an intricate solution, I would like to know if there is any smarter solution to log these values in a text files without having to redirect the output for each topic. What's the best solution for my problem?

I really hope you can help me!

Thank you very much!

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2013-10-27 04:34:55 -0500

BennyRe gravatar image
edit flag offensive delete link more


I also recommend using rosbag, which lets you record whatever topics you like, and then play them back later in a different ROS environment. You can then use rosbag to save only the values you want in a TXT file, see some of the responses to this question for further instructions for this: I hope this helps! Let me know if you need any more information :) Paul -Clearpath Robotics | Robot Whisperer

PaulvdVorst gravatar image PaulvdVorst  ( 2013-11-01 04:27:25 -0500 )edit

answered 2013-10-29 23:16:35 -0500

cognitiveRobot gravatar image

updated 2013-10-29 23:17:15 -0500

you can have a look at this file. In the main function, u will see, it reads a .log file(would be similar for .txt file) and stores some specific values to publish. Hope it helps.

edit flag offensive delete link more

answered 2013-10-27 06:10:20 -0500

Marcus Barnet gravatar image

Thank you for your reply. However, I've already read about ROS bag, but I've realized that it can't offer the possibility to extract only some fields from topics. I know that I should use ROS API for this kind of task but I wasn't able to write any C++ code because the C++ example on the ROS wiki is very poor for me and it is not a complete example. Is there any full executable C++ sample which I can study and modify it to extract only the field I need? I hope you can help me,

Thank you

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-10-27 00:58:03 -0500

Seen: 365 times

Last updated: Oct 29 '13