ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Writing a ROS command-line utility in C++ - what is the difference compared to writing a ROS node in C++ ?

asked 2016-07-20 08:53:22 -0500

Galto2000 gravatar image

Howdy folks

So far I have written ROS nodes in C++ and invoked them in launch files.

Now I want to write a ROS command-line utility for off-line processing rosbag files in C++ (using the rosbag C++ API), which doesn't interact with any other nodes per se.

More in particular I want to write a utility that looks for camera_info messages in a given bagfile and change camera calibration and distortion parameters.

My question is: Do I write a command-line utility just like I would write a node in C++, within the catkin build framework? What's different between writing a utility and writing a node in C++? Does anyone know of a good C++ example that I can learn from?

Thanks in advance


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-20 09:10:05 -0500

dornhege gravatar image

Yes, everything is the same. At the end you just write a normal C++ program using the ROS libraries. Just skip actually connecting to anything, e.g., no need for NodeHandles, etc.

For your specific problem: rosbag filter might already be able to do that, so you won't need to write any specific utility.

edit flag offensive delete link more


Thanks for your reply and pointing me to rosbag filter - I'll give it a try.

Galto2000 gravatar image Galto2000  ( 2016-07-20 12:25:03 -0500 )edit

Worked like a champ - thanks again!

Galto2000 gravatar image Galto2000  ( 2016-07-21 19:49:23 -0500 )edit

Question Tools

1 follower


Asked: 2016-07-20 08:53:22 -0500

Seen: 135 times

Last updated: Jul 20 '16