ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Open bags in rqt_bag in by clicking on one in Ubuntu?

asked 2017-03-02 17:09:10 -0600

lucasw gravatar image

updated 2020-11-21 12:15:07 -0600

Can anyone share the steps of making rqt_bag a first class application within Ubuntu and associating the bag extension with it, so they could double click on any bag on the desktop or the ubuntu nautilus file explorer and open it with rqt_bag?

edit retag flag offensive close merge delete


This would basically come down to associating .bag with rqt_bag. That is not ROS specific, apart from the fact that you'll want to make sure that rqt_bag gets started from a shell/session that has sourced the appropriate setup.bash.

gvdhoorn gravatar image gvdhoorn  ( 2017-03-03 02:13:41 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-03 10:04:13 -0600

lucasw gravatar image

updated 2017-03-03 10:22:09 -0600

Combining (works in 16.04 also) and and some additional work has yielded a solution that is almost there:

~/.local/share/mime/packages$ vi application-x-bag.xml:

<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns="">
  <mime-type type="application/x-bag">
  <comment>ROS bag file</comment>
    <icon name="application-x-bag"/>
    <glob pattern="*.bag"/>


[Desktop Entry]
# Exec=bash -c "source ~/catkin_ws/devel/setup.bash; rqt_bag %f"
Exec=bash -c "source ~/catkin_ws/devel/setup.bash; ROS_HOME=`pwd` roslaunch rqt_bag_launch rqt_bag.launch bag:=%f"


update-desktop-database ~/.local/share/applications
update-mime-database ~/.local/share/mime

The commented out Exec that runs rqt_bag directly works only if there is an already running roscore (does rqt_bag really need a roscore if it isn't going to publish anything, just inspect the bag within the gui? Maybe it could have a mode where publishing is disabled and no roscore required -> short answer: no ). In order to make it more usable rqt_bag can be wrapped in a launch file, so roslaunch will start a roscore if no other is available:


<?xml version="1.0"?>
  <arg name="bag" default="" doc="bag file to load"/>
  <node name="rqt_bag" pkg="rqt_bag" type="rqt_bag"
    args="$(arg bag)"/>

If I set Terminal to false in the bag.desktop then the roslaunch and rosmaster processes are still running after exiting rqt_bag, but it looks cleaner without the terminal- is there something different to be done in the Exec to make sure exiting is handled correctly?

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: 2017-03-02 17:09:10 -0600

Seen: 509 times

Last updated: Mar 03 '17