Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add env variables in .world files #75

Open
DanielCoelho112 opened this issue Jun 27, 2022 · 5 comments
Open

Add env variables in .world files #75

DanielCoelho112 opened this issue Jun 27, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@DanielCoelho112
Copy link
Owner

Since .world files are in XML format, it is not straightforward to use env variables. I'll leave this for later since it is not critical for now.

@DanielCoelho112 DanielCoelho112 added bug Something isn't working low priority labels Jun 27, 2022
@DanielCoelho112 DanielCoelho112 self-assigned this Jun 27, 2022
@DanielCoelho112 DanielCoelho112 added enhancement New feature or request and removed bug Something isn't working labels Jun 27, 2022
@andrefdre
Copy link
Collaborator

andrefdre commented Nov 22, 2022

After being tired of always needing to change the code to my folder structure in the .world, I searched about this and didn't really find how to use env variables in .world files but I was reading how the world folder structure should be organized and found this link: https://gazebosim.org/api/gazebo/5.1/migrationsdf.html. After some reading I manage to make it work without having to specify my specific folder structure in the code.
I changed in the zshrc from:

export GAZEBO_MODEL_PATH="`rospack find synfeal_bringup`/models:${GAZEBO_MODEL_PATH}"

To this:

export GAZEBO_MODEL_PATH="`rospack find synfeal_bringup`/models:${GAZEBO_MODEL_PATH}":/home/andre/models_3d

And in the .world file I changed from this:

<uri>file:///home/danc/models_3d/santuario/santuario.dae</uri> 

To this:

<uri>model:///localbot/santuario/santuario.dae</uri>

One thing I noticed is that we don't have the same folder structure as they talk about in the link is that for any reason in particular?

In that website they also talk about Ignition Gazebo that from what I can read we could put the world in the cloud and then just use the link in the code, instead of having it in our computer, if I'm not mistaken.

@DanielCoelho112
Copy link
Owner Author

Hi @andrefdre,

if it works, commit.

One thing I noticed is that we don't have the same folder structure as they talk about in the link is that for any reason in particular?

Usually, we remove from the git folder all files that are too large to be pushed to github. But if you have a better way, feel free to change.

In that website they also talk about Ignition Gazebo that from what I can read we could put the world in the cloud and then just use the link in the code, instead of having it in our computer, if I'm not mistaken.

From what I read, Ignition Gazebo is the newer version of Gazebo, so I don't think we should even think about switching...

@miguelriemoliveira
Copy link
Collaborator

Yes, better use the point cloud locally stored for now.

@andrefdre
Copy link
Collaborator

andrefdre commented Nov 23, 2022

I didn't know it was the newer version I just read about it and sounded it could be interesting.

Usually, we remove from the git folder all files that are too large to be pushed to github. But if you have a better way, feel free to change.

Okay, that's what I thought, but then why have the .world files in the GitHub folder? Why not have it together with the rest of the world files? Then you just have to add to the the bashrc file where it is and would remove the need to have the global directory in the .world and just have the relative path and the global one would be in the bashrc. Kind of what it suggested in the gazebo reference.

andrefdre added a commit that referenced this issue Nov 28, 2022
…s with the collection part where I tried to also use the same variable, so if for example I want to save the dataset and the models in an external drive I just need to change the line in the bashrc. I didn't place it in the main branch to get other opinion. #75
@andrefdre andrefdre mentioned this issue Dec 30, 2022
@andrefdre
Copy link
Collaborator

One thing I noticed was that using Gazebo environment variable to everything presents a problem if you have another paths, since we are selecting manually which one we want in the array.

  path=os.environ.get("GAZEBO_MODEL_PATH").split(":") 
  folder_name = f'{path[2]}/models/localbot/{args["model_folder"]}'

But this doesn't have the issue in the .world files, since it searches in every path.
My suggestion is to maintain this for the .world files and for the rest use a normal environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants