Skip to content

Update rover models using a master template.#244

Merged
gmfricke merged 4 commits into
BCLab-UNM:masterfrom
darrenchurchill:ruby-model-templates
Jan 28, 2019
Merged

Update rover models using a master template.#244
gmfricke merged 4 commits into
BCLab-UNM:masterfrom
darrenchurchill:ruby-model-templates

Conversation

@darrenchurchill
Copy link
Copy Markdown
Contributor

Hi guys,

This pull request would address issue #242 and hopefully make everyone's life a lot easier in maintaining the rover SDF files.

If PR #243 is merged, those updates would need to be included here in the template file.

Included here is:

  1. A template rover model (model.sdf.erb), which requires the rovername and rovercolor variables to be set on execution when converting the template to SDF.
  2. A template rover model config file, which requires the rovername variable to be set on execution when converting the template.
  3. A shell script misc/gen_rover_models.sh to automate the generation of all 8 default rover SDF and config files.
  4. A small update to the sonar sensors, so all the plugins publish messages with unique frame_id's. I'm happy to remove this and submit it separately if you prefer it in a different PR, or don't want the template file.

There are many ways you could template a file like the rover model. Many ROS users use URDF files embedded with an xml macro language called Xacro. However, if you need to stick with SDF, the Gazebo tutorials suggest embedded ruby (ERB), and it's used in a few models in the official gazebo_models repository.

http://gazebosim.org/tutorials?tut=model_structure#ModelSDF.ERB
https://bitbucket.org/osrf/gazebo/src/b54961341ffb938a9f99c9976aed50a771c95216/worlds/flocking.world.erb?at=default
https://bitbucket.org/osrf/gazebo_models/src/default/cart_rigid_suspension/model.rsdf

The current recommended suffix is (.erb) for template files.

Let me know what you think.

This template can be used to generate the rover SDF and config files, meaning only one file for each has to be edited by hand.

Embedded ruby is the recommended templating method for SDF files.

http://gazebosim.org/tutorials?tut=model_structure#ModelSDF.ERB
This updates config files to have proper model names. SDF changes are mostly whitespace and things like a decimal zero (0.0) changing to an integer zero (0). This has no impact on the model's performance.

Some models had an incorrect left_rear_wheel collision geometry. Thor and Zeus' models were very out of date.
@wfvining wfvining self-requested a review January 18, 2019 21:18
Comment thread misc/gen_rover_models.sh

for rover in "${!rovers[@]}"; do
erb -T - rovername=${rover} \
-- ${master_template_config} > ${model_path}/${rover}/model.config
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I like this... didn't realize how easy ruby templating was 😃

Copy link
Copy Markdown
Contributor

@gmfricke gmfricke left a comment

Choose a reason for hiding this comment

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

We have thought about doing this so many times. Thanks for giving us a push.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants