ros_comm icon indicating copy to clipboard operation
ros_comm copied to clipboard

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

Open heuristicus opened this issue 2 years ago • 1 comments

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/*

heuristicus avatar Mar 11 '22 10:03 heuristicus

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

Petros626 avatar Mar 30 '22 08:03 Petros626