ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
752 stars 911 forks source link

Behaviour of `rosbag record` and `rosrun rosbag record` is inconsistent for regex #2232

Open heuristicus opened 2 years ago

heuristicus commented 2 years ago

When running rosbag record from the commandline, I can specify multiple -e arguments to the command, and it will work.

rosbag record -o $HOME/test.bag -e /some/namespace/* -e /other/namespace/*

However, when trying to do the same thing with rosrun or in launch file, an error comes up instead

<launch>
  <node name="rosbag" pkg="rosbag" type="record"
    args="-o $(env HOME)/test.bag
    -e /some/namespace/*
    -e /other/namespace/*
   "/>
</launch>
rosrun rosbag record -o $HOME/test.bag -e /some/namespace/* -e /other/namespace/*

The error:

terminate called after throwing an instance of 'boost::wrapexcept<boost::program_options::multiple_occurrences>'
  what():  option '--regex' cannot be specified more than once
Aborted (core dumped)

Instead, I had to use a chain of | to get the same behaviour

rosrun rosbag record -o $HOME/test.bag -e /some/namespace/*|/other/namespace/*
Petros626 commented 2 years ago

i think in a launch file you must only specify once the argument -e not 2x.

For example:

launch

node name="rosbag" pkg="rosbag" type="record" args="-o $(env HOME)/test.bag -e /some/namespace/ /other/namespace/ "/

/launch