Ask Your Question
0

Cannot set custom ROS_HOME in launch file

asked 2012-12-22 02:27:29 -0600

Alexey Ozhigov gravatar image

updated 2014-01-28 17:14:38 -0600

ngrennan gravatar image

Hi!

I want to have a current directory for my node different than ~/.ros, so that when I create files in my node providing only local file name, they are saved relevant to my given $ROS_HOME. I tried the following launch file:

<?xml version="1.0"?>
<launch>
   <env name="ROS_HOME" value="/home/alex" />
   <node name="test" type="test.py" pkg="simple_pcl" output="screen"/>
</launch>

But the file I am creating still appears in ~/.ros. Here is the node source:

#!/usr/bin/python

import os

if __name__ == '__main__':
    os.system('touch test_file')

I also tried setting ROS_HOME inside node entry:

<?xml version="1.0"?>
<launch>
  <node name="test" type="test.py" pkg="simple_pcl" output="screen">
    <env name="ROS_HOME" value="/home/alex" />
  </node>
</launch>

also without success. What do you think is the problem?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2012-12-22 15:40:52 -0600

tfoote gravatar image

According to the docs it sets the location where ROS tools write data. I don't believe it changes the current working directory where your program is launched. All the core ROS tools evaluate for the existance of ROS_HOME and default to ~/.ros if it is not set. If your program reads ROS_HOME inside it's run, you can reproduce the same policy.

edit flag offensive delete link more
0

answered 2012-12-22 14:24:48 -0600

Alexey Ozhigov gravatar image

I have put $HOME as an example, but the idea is to set it to $(find <package_name>), so that nodes launched from the file create files w.r.t. location of the package containing that launch file. Exporting ROS_HOME outside launch file from bash would of course be one of the options, but I would like to be able to use env tag, since ROS documentation on ROS_HOME says it should work as expected, at least as I expect it to work.

edit flag offensive delete link more

Comments

tfoote's explanation makes perfect sense to me. I would say the doc. is quite vague on the purpose of ROS_HOME: On ROS/EnvironmentVariables page it says: By default, ROS writes data to ~/.ros. This location can be changed by setting ROS_HOME. No such phrasing as ROS tools, just ROS.

Alexey Ozhigov gravatar imageAlexey Ozhigov ( 2012-12-23 02:24:31 -0600 )edit

Any ros node started with the roslaunch runs as if it were started (e.g. via rosrun) from the ROS_HOME directory.

SL Remy gravatar imageSL Remy ( 2012-12-23 03:42:34 -0600 )edit
0

answered 2012-12-22 11:37:31 -0600

joq gravatar image

You probably have to define it in your shell before calling roslaunch:

export ROS_HOME=/home/alex

Setting it to your home directory is probably not the best choice.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-12-22 02:27:29 -0600

Seen: 862 times

Last updated: Dec 22 '12