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

Naming log folder

asked 2018-07-04 04:52:53 -0600

WillAndrew gravatar image

updated 2018-07-04 10:45:19 -0600

jayess gravatar image

Hi everyone; Is there any way to specify in my python program the name of the folder to which logs for respective nodes are saved?

As in, when I launch my experiment via roslaunch, I'll see something like the following text:

... logging to /home/user/catkin_ws/src/project/logs/51342e8a-7f6c-11e8-a056-5404a63cee0d/roslaunch-user-desktop-22693.log

My question is whether I can programatically set the name of the folder 51342e8a-7f6c-11e8-a056-5404a63cee0d each time I run the experiment? Ideally the folder name would be the exact date/time the experiment was launched..

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-07-04 15:13:59 -0600

The 51342e8a-7f6c-11e8-a056-5404a63cee0d string is actually a parameter called run_id (you get check it by calling rosparam get /run_id) that is generated uniquely while starting roscore. This parameter should not be changed. What you can change is the path before that (/home/user/catkin_ws/src/project/logs/ in your example) by setting the $ROS_LOG_DIR environment variable. One solution that could work for you is to set this environment variable to the current time programmatically using a script before every launch. Then while collecting these logs you can write a simple script that goes inside each log folder and moves the content one directory level up.

edit flag offensive delete link more

Comments

That sounds like it will work. Seems a shame that there isn't a more elegant (in-built) solution as it's quite an obvious feature.. Anyway, thanks for your help!

WillAndrew gravatar image WillAndrew  ( 2018-07-04 15:24:44 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-07-04 04:52:53 -0600

Seen: 709 times

Last updated: Jul 04 '18