From c283a259ecdd4194fc5644d94cc25b806543bd2f Mon Sep 17 00:00:00 2001 From: Diego Ferigo Date: Thu, 22 Oct 2020 11:12:04 +0200 Subject: [PATCH 1/2] Use only IGN_GAZEBO_RESOURCE_PATH env var --- gym_ignition_models/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gym_ignition_models/__init__.py b/gym_ignition_models/__init__.py index dfd5139..2a822be 100644 --- a/gym_ignition_models/__init__.py +++ b/gym_ignition_models/__init__.py @@ -94,10 +94,10 @@ def setup_environment() -> None: raise NotADirectoryError(f"Failed to find path '{models_path}'") # Setup the environment to find the models - if "SDF_PATH" in os.environ: - os.environ["SDF_PATH"] += f":{models_path}" + if "IGN_GAZEBO_RESOURCE_PATH" in os.environ: + os.environ["IGN_GAZEBO_RESOURCE_PATH"] += f":{models_path}" else: - os.environ["SDF_PATH"] = f"{models_path}" + os.environ["IGN_GAZEBO_RESOURCE_PATH"] = f"{models_path}" # Models with mesh files # Workaround for https://github.com/osrf/sdformat/issues/227 @@ -111,10 +111,10 @@ def setup_environment() -> None: if not model_path.exists(): raise NotADirectoryError(f"Failed to find path '{model_path}'") - if "IGN_FILE_PATH" in os.environ: - os.environ["IGN_FILE_PATH"] += f':{model_path}' + if "IGN_GAZEBO_RESOURCE_PATH" in os.environ: + os.environ["IGN_GAZEBO_RESOURCE_PATH"] += f':{model_path}' else: - os.environ["IGN_FILE_PATH"] = f'{model_path}' + os.environ["IGN_GAZEBO_RESOURCE_PATH"] = f'{model_path}' # Setup the environment when the package is imported From 5e320c3ce095d89d09f69fb709d8efa7d244c093 Mon Sep 17 00:00:00 2001 From: Diego Ferigo Date: Thu, 22 Oct 2020 11:11:08 +0200 Subject: [PATCH 2/2] Update README --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 42f6226..bdc02f5 100644 --- a/README.md +++ b/README.md @@ -44,16 +44,23 @@ Only GNU/Linux distributions are currently supported. #### Standalone usage -If you use Ignition Gazebo, you need to execute the following commands (from outside the directory where you cloned this repository): +If you use Ignition Gazebo, you need to specify where the models and their dependent resources are located in the filesystem. +The simulator reads the `IGN_GAZEBO_RESOURCE_PATH` environment variable. + +Execute the following commands from outside the directory where you cloned this repository to temporarily configure your environment: ```sh PKG_DIR=$(python -c "import gym_ignition_models, inspect, os; print(os.path.dirname(inspect.getfile(gym_ignition_models)))") -export SDF_PATH=$PKG_DIR:SDF_PATH +export IGN_GAZEBO_RESOURCE_PATH=$PKG_DIR:$IGN_GAZEBO_RESOURCE_PATH ``` If you want to make this change persistent, add the lines above to your `~/.bashrc`. -**Note:** waiting an [upstream fix](https://bitbucket.org/osrf/sdformat/issues/227/error-loading-meshes-from-a-relative), you also need to add to the `IGN_FILE_PATH` environment variable all the directories that contain model's meshes. +**Note:** waiting an [upstream fix](https://github.com/osrf/sdformat/issues/227), you also need to add +to `IGN_GAZEBO_RESOURCE_PATH` all the directories containing model's meshes. + +**Note:** Alternatively, instead of using `IGN_GAZEBO_RESOURCE_PATH`, you can use `SDF_PATH` for the models and +`IGN_FILE_PATH` for the meshes. #### Python usage