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

Revision history [back]

Combining http://askubuntu.com/questions/478029/adding-mimetypes-in-ubuntu-14-04 (works in 16.04 also) and http://answers.ros.org/question/135021/creating-a-desktop-shortcut-for-a-specific-roslaunch/ 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). 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 additional to be done in the Exec to make sure exiting is handled correctly?

Combining http://askubuntu.com/questions/478029/adding-mimetypes-in-ubuntu-14-04 (works in 16.04 also) and http://answers.ros.org/question/135021/creating-a-desktop-shortcut-for-a-specific-roslaunch/ 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). 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 additional different to be done in the Exec to make sure exiting is handled correctly?

Combining http://askubuntu.com/questions/478029/adding-mimetypes-in-ubuntu-14-04 (works in 16.04 also) and http://answers.ros.org/question/135021/creating-a-desktop-shortcut-for-a-specific-roslaunch/ 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). required -> short answer: no https://github.com/ros-visualization/rqt_common_plugins/issues/238). 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?