Ask Your Question

# specify rosbag save path in launchfile

Hey,

I'm trying to specify the path to which my rosbag files will be written to. The call to launch the datalogging is happening in the launch file. The issue I'm having is I want it to be repeatable on other peoples machines so I don't want to have to include the full file path. ie /home/doug/catkin_ws/src/bagfiles/chatter something like /home/(find user)/catkin_ws/src/bagfiles/chatter would be ideal.

the whole section of code that calls rosbag in the launchfile.

<arg name="data_log" default="true" />

<group if="$(arg data_log)"> <arg name="topics_logged" default="/chatter"/> <node pkg="rosbag" type="record" args="-o /home/doug/catkin_ws/src/bagfiles/chatter /chatter" name="record" output="screen"/> </group>  Thanks for any help! edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted You can use the $(env ...) substitution arg.

So

<node pkg="rosbag" type="record"
args="-o /home/$(env USER)/catkin_ws/src/bagfiles/chatter /chatter" name="record" output="screen"/>  Then again, that user would need to have the directory structure ~/catkin_ws/src/bagfiles/chatter present. I suggest to use something that is definitiely available, i.e. either directly storing into the home directory, or something read-writable by any user... more ## Comments 3 Then again, that user would need to have the directory structure ~/catkin_ws/src/bagfiles/chatter present. Exactly. This is only a partial solution I would say. I suggest to use something that is definitiely available, i.e. either directly storing into the home directory, or something read-writable by any user... why not use a roslauncharg and specify the full path when starting the .launch file? ( 2020-10-05 05:19:38 -0500 )edit 1 @mgruhler Thanks for you help! You should change the ($env USER) to $(env USER) in your response. otherwise that works perfectly! @gvdhoom That's completely fair, but it would be a rare case that someone would call the workspace something other than catkin_ws right? I can just put that in our documentation. Unless, is there another directory that would make more sense for something like this? ( 2020-10-05 13:51:52 -0500 )edit 1 but it would be a rare case that someone would call the workspace something other than catkin_ws right? no, that's not rare at all. At this moment I have 43 workspaces, none of which are called catkin_ws. ( 2020-10-05 14:43:29 -0500 )edit 1 You should change the ($env USER) to \$(env USER) in your response.

@TheMilkman92 whoops, you are right. Sorry about that.

no, that's not rare at all.

I totally agree with @gvdhoorn (though I don't have THAT many workspaces :-D ). I never call my workspaces catkin_ws. This is merely something like a "tutorial convention"...

( 2020-10-06 02:05:53 -0500 )edit

I see @gvdhoorn and @mgruhler, I'll put it outside the workspace in the USER directory. Thanks for the help!

( 2020-10-08 13:55:21 -0500 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2020-10-04 14:36:47 -0500

Seen: 92 times

Last updated: Oct 06 '20