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

A complete overhaul of vehicle and world generation through jinja as well as json. #651

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bperseghetti
Copy link
Member

@bperseghetti bperseghetti commented Nov 9, 2020

This PR allows for full control over modifying models and world files on launch through jinja and optionally json. After more adoption the static world files can be completely removed. This works with PR 16142 from PX4-Autopilot.

Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look like it is trying to solve a lot more problems than just removing static world files. Please clarify what problems the changes are trying to solve for clarity.

About static world files - I don't see much benefit from making the worlds need to be dynamic, since worlds are "static". Therefore, IMHO the toolchain around generating the world file seem like unnecessary complexity being added. For example, I cannot modify the world simply by editing the world file anymore, I have to understand how the generation works.

As we discussed on line, if this is for the workaround with the mavlink_interface not being able to proper configure the serial I would prefer we fix this properly and leave the worlds static.

.gitignore Outdated Show resolved Hide resolved
models/iris/iris.sdf.jinja Outdated Show resolved Hide resolved
models/irlock_beacon/irlock_beacon.sdf Show resolved Hide resolved
models/sun_2/model.config Outdated Show resolved Hide resolved
@@ -0,0 +1,169 @@
#!/usr/bin/env python3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file looks like a duplicate of jinja_gen.py. Why was this file added?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaving jinja_gen.py for now but it will be deleted/deprecated in the future, this allows for generation of models even from json source as well as checking for model options etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bperseghetti let's make this more consistent then. If we are replacing something, let's remove the part being replaced and not leave there as a remaining.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to give a one month phase out to cover any potential unforeseen issues and soft-add any extra desired features before eliminating the other pipeline.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bperseghetti I think these changes should be atomic given that they are part of CI

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So would you like me to then add this one instead into CMake to use for default builds?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, or make this jinja_gen.py? End of the day, it is functionally it is completely redundant right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the reason why I left jinja_gen.py in place for now was this current implementation needs to be changed to allow for default generation from CMake or CMake needs to be modified to use it properly. So they are not actually "redundant". But I'll change CMake I guess if we want to eliminate the other script completely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is not redundant, we can leave it - but I didn't quite understand what you mean by not completely redundant. What is different? As far as I can see, they are both used to generate models from the same template?

.gitignore Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
.gitignore Show resolved Hide resolved
models/iris/iris.sdf.jinja Outdated Show resolved Hide resolved
models/standard_vtol/standard_vtol.sdf.jinja Show resolved Hide resolved
scripts/gen_params.json Show resolved Hide resolved
@@ -0,0 +1,169 @@
#!/usr/bin/env python3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bperseghetti let's make this more consistent then. If we are replacing something, let's remove the part being replaced and not leave there as a remaining.

worlds/baylands.world Show resolved Hide resolved
worlds/gen.world.jinja Show resolved Hide resolved
models/warehouse/warehouse.sdf Show resolved Hide resolved
@hamishwillee
Copy link

This will need docs.

@mrpollo
Copy link

mrpollo commented Nov 11, 2020

Hey @hamishwillee this PR has lots of documentation any ideas where we this could live on our docs?

@bperseghetti bperseghetti requested review from Jaeyoung-Lim and removed request for jkflying November 11, 2020 17:46
@Jaeyoung-Lim
Copy link
Member

Fixes #642


with open(filename_out, 'w') as f_out:
print(('{:s} -> {:s}'.format(args.filename, filename_out)))
f_out.write(result)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I am just not understanding this correctly, but why is this needed if we have jinja_model_gen.py?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to decouple potential errors in the build from new features in the "full options" generator. This is intentionally meant to be extremely simple and used exclusively to build all the defaults with cmake, the other is for user optional generation. We can remove this in the future if desired but for now I think it is important to keep.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bperseghetti Okay, but my comment on having two redundant scripts was precisely coming from having two ways of doing the same functionality and one being untested. I would prefer if the full blown script is still part of the pipeline. Otherwise this will just rot unless somebody is actively using it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I'm completely following what you are saying. Can you elaborate more?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, jinja_cmake_gen.py is completely redundant functionally with jinja_model_gen.py. However, while jinja_cmake_gen.py is tested in our CI pipeline(we run SITL tests with it) jinja_model_gen.py is not being tested. Therefore if we are to make changes in the future to jinja_cmake_gen.py we will need to manually copy the changes into jinja_model_gen.py. Therefore I want to have a single script so that it has lower maintenance overhead. OR we need to add tests that use jinja_model_gen.py as a separate integration test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping separate how I originally intended, there should be no issue with doing that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not clear on what is blocking us from using the full blown script as the single script to do everything. For example when I want to improve the script, which one should I update? do I need to keep track of both?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should never need to worry about keeping jinja_gen.py up to date as any extra changes/editions can be handled with "defaults" in the individual jinja models if they are not explicitly set. And since that is how the default models are created you also do not need to worry about circle CI for jinja_model_gen.py or jinja_world_gen.py as they are "optional". I also re-added back in my Firmware PR the gazebo_sitl_multiple_run.sh so people wanting to use that still can.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would find it hard to see any issue with having both as it provides a cleaner "user experience" by not breaking any current pipelines, still gets tested in CI, and the other generators can be used or not used if desired.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this issue has been resolved. So how can we make sure the generation scripts are being maintained?

…well as json. Adds features to enable wind, dynamically set sun, clouds, models for hitl, and much more.
@@ -25,3 +25,5 @@ models/rover/rover.sdf
models/tiltrotor/tiltrotor.sdf
models/boat/boat.sdf
models/typhoon_h480/typhoon_h480.sdf
models/temp*
worlds/temp*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find my previous review anymore, what is stopping us from moving this to /tmp?


<author>
<name>Benjamin Perseghetti</name>
<email>bperseghetti@rudislabs.com</email>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some models that are under the Apache license. Wouldn't this be problematic if we relabel the model config?

<ambient>0.95 0.95 0.95 1</ambient>
<background>0.3 0.3 0.3 1</background>
<shadows>true</shadows>
</scene>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do appreciate you fixing the lighting in gazebo, but I think this would have been better if it belonged to a separate PR

@bperseghetti bperseghetti removed the request for review from jgoppert November 21, 2020 21:40
@LorenzMeier
Copy link
Member

What is missing here to move this forward?

@Jaeyoung-Lim
Copy link
Member

Jaeyoung-Lim commented Jan 3, 2021

@LorenzMeier This PR includes various changes that are orthogonal and I am slightly uncomfortable with some of the changes.

Therefore I will try to break this down into multiple PRs and get some of the features in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants