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

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

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

lucasw gravatar image

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

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

Comments

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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

lucasw gravatar image

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

Combining http://askubuntu.com/questions/478029... (works in 16.04 also) and http://answers.ros.org/question/13502... 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="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/x-bag">
  <comment>ROS bag file</comment>
    <icon name="application-x-bag"/>
    <glob-deleteall/>
    <glob pattern="*.bag"/>
  </mime-type>
</mime-info>

~/.local/share/applications/bag.desktop

[Desktop Entry]
Type=Application
Name=RqtBag
# 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"
MimeType=application/x-bag
StartupNotify=true
Terminal=true

Then:

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 https://github.com/ros-visualization/... ). 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:

rqt_bag_launch/launch/rqt_bag.launch:

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

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

Question Tools

2 followers

Stats

Asked: 2017-03-02 17:09:10 -0500

Seen: 587 times

Last updated: Mar 03 '17