Closed osrf-migration closed 9 years ago
Original comment by Jose Luis Rivero (Bitbucket: Jose Luis Rivero, GitHub: j-rivero).
@wjwwood @dirk-thomas quick question: is roslaunch ignoring or cleaning any bash variable defined in .bashrc or using export?
Long version: if I export a BASH variable (GAZEBO_MODEL_PATH) in my .bashrc or using export directly in the bash command line and after that I use roslaunch
to invoke gazebo, looks like gazebo is ignoring the value of that variable.
Original comment by Dirk Thomas (Bitbucket: Dirk Thomas, GitHub: dirk-thomas).
roslaunch
does not care about any shell specific stuff. It simply uses the same environment in which roslaunch
is invoked.
E.g. you can even call FOO=BAR roslaunch ...
and FOO
will be in the environment of every node you start from the launch file.
Original comment by William Woodall (Bitbucket: William Woodall, GitHub: wjwwood).
@j-rivero I'm not sure why that would happen, it would be good to narrow it down to a specific example. I asked the original poster for their launch file on the original question.
On a separate note, http://gazebosim.org/tutorials/?tut=ros_roslaunch#EnvironmentVariable has some rendering problems where the _
's are getting collapsed into italics, like for GAZEBO_MODEL_PATH
it getting rendered as GAZEBOMODELPATH
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
underscores fixed here https://osrf-migration.github.io/gazebo_tutorials-gh-pages/#!/osrf/gazebo_tutorials/pull-request/175
Original comment by William Woodall (Bitbucket: William Woodall, GitHub: wjwwood).
I just confirmed with an example package that in Indigo the GAZEBO_MODEL_PATH
env variable gets through to the program being executed by roslaunch
. So baring the OP doing something strange in the launch file, I think it is unlikely that the env variable is getting stripped or something like that.
Original comment by Jose Luis Rivero (Bitbucket: Jose Luis Rivero, GitHub: j-rivero).
Thanks for the answers Dirk, William. Indeed, it makes all the sense to me not to mess with any shell variable in roslaunch.
I've confirmed that the problem is not present with gazebo2 + ROS Indigo (both from ROS repository) but it is present in gazebo4 using the ros-indigo-gazebo4-ros-pkgs from our osrf repository.
Original comment by Benjamin Blumer (Bitbucket: Benjamin_Blumer).
Hey! I'm O.P. on Gazebo Answers.
What I'm doing is pretty vanilla. I created a simple model directory and set the GAZEBO_MODEL_PATH. I just copied a model out of the .gazebo folder to a different path (following Nate's suggestion in the Answers thread.) It shows up in the insert menu when I run gazebo, but does not when I roslaunch empty_world.
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
I can confirm the problem. I have a source build of gazebo5
and gazebo_ros_pkgs
on trusty/indigo. I have bitbucket.org/osrf/gazebo_models cloned and in my GAZEBO_MODEL_PATH
environment variable:
$ env | grep GAZEBO
GAZEBO_MODEL_PATH=/home/scpeters/osrf/gazebo_models:
If I gazebo --verbose
, then I see the models in the Insert
pane.
If I roslaunch gazebo_ros empty_world.launch gui:=false
and then gzclient --verbose
in a separate, properly sourced terminal, it also works.
The problem seems to be when launching the gazebo gui directly from the launch (gui:=true
) file that causes it to lose the environment variables. I'm looking into this further.
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
The gzclient script in gazebo_ros
sources the gazebo setup.sh script, which overwrites the GAZEBO_MODEL_PATH variable. This was implemented in gazebo pull request 1170 for gazebo4 and higher.
I'll make a pull request to extend the GAZEBO_MODEL_PATH
rather than over-writing it completely.
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
https://bitbucket.org/osrf/gazebo/pull-request/1430/preserve-previous-gazebo_model_path-values/diff
Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).
This has been fixed and released for gazebo 4.1.2 and 5.1.0
Original report (archived issue) by Jose Luis Rivero (Bitbucket: Jose Luis Rivero, GitHub: j-rivero).
For some reason, looks like roslaunch is not using the environment variables defined using both, export or .bashrc definitions. Read this thread for a whole reference.
This is affecting to the tutorial running gazebo with roslaunch.
I found an old ROS issue related to the lost of the PYTHONPATH env variable. Not sure if it is exactly the same case.
As a workaround, I would recommend to use the ENV xml tag inside the roslaunch.