0
$\begingroup$

Rosanswers logo

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

 roscore
 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:

    header: 
      seq: 778
      stamp: 
        secs: 1380713547
        nsecs: 429730892
      frame_id: ''
    left_speed: 0.34
    right_speed: 0.34
    left_accel: 0.5
    right_accel: 0.5
---
header: 
  seq: 779
  stamp: 
    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!


Originally posted by Marcus Barnet on ROS Answers with karma: 287 on 2013-10-27

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You could use the rosbag tool.

See: http://wiki.ros.org/ROS/Tutorials/Recording%20and%20playing%20back%20data


Originally posted by BennyRe with karma: 2949 on 2013-10-27

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by PaulvdVorst on 2013-11-01:
I also recommend using rosbag, which lets you record whatever topics you like, and then play them back later in a different ROS environment. http://wiki.ros.org/rosbag

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: http://answers.ros.org/question/9102/how-to-extract-data-from-bag/?answer=13122

I hope this helps! Let me know if you need any more information :)

Paul -Clearpath Robotics | Robot Whisperer

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.