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

added scaling features to wall texture #382

Merged
merged 5 commits into from
Aug 27, 2021

Conversation

xiyuoh
Copy link
Member

@xiyuoh xiyuoh commented Aug 17, 2021

Signed-off-by: xiyuoh [email protected]

New feature implementation

Implemented feature

This PR follows #343 to add scalability to downloaded textures from URL.

Implementation description

As mentioned in #342 the custom textures may be stretched in simulation as their height-to-width ratio may not be coherent with the wall dimensions (walls expect a 2.5m x 1m texture size). This feature implemented allows users to customize texture scales by adding parameters to define these scales.

Before implementation:
Screenshot from 2021-08-17 16-31-04 (1)
You can observe the texture stretching by comparing the wall and floor textures.

After implementation:
Screenshot from 2021-08-17 16-41-52 (1)

The scaling is controlled by three parameters: texture_height, texture_width and texture_scale:
SS2 (1)

  • texture_height and texture_width: dimensions of the texture image. It does not need to be absolute as only their ratio will be calculated, i.e. for square textures, you can enter 1 for both parameters.
    But for images where the ratio may not be easy to compute, users can enter the absolute dimensions directly.
  • texture_scale: how 'zoomed in' you want your texture to be (default is 1)
    For example, if you want your texture width to be 1m, enter 1. If you want your texture width to be 2m, enter 2. The height will be scaled accordingly.
    Special case: If you want your texture image to fit the full wall (texture height = wall height), enter 0.

See some examples below!

For texture_scale = 2 with square textures
Screenshot from 2021-08-17 16-30-28 (1)
SS3 (1)

For texture_scale = 0 with complicated texture dimensions
Screenshot from 2021-08-17 16-31-11 (1)
SS1 (1)

Testing the PR

  1. Open a map in traffic_editor
  2. Add texture URLs and scaling parameters like the examples above
  3. Launch the demo, or run building_map_generator.py gazebo on your yaml map and open the mesh files in gazebo.

Copy link
Contributor

@codebot codebot left a comment

Choose a reason for hiding this comment

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

This is great! Thank you for the clean diff and the great illustrations.

Because there are many .building.yaml files around that people will want to keep using without having to re-open and save them in an updated traffic-editor GUI, can you add checks for the texture_width and other new parameters in the Wall class, so that it won't crash when opening an "old" .building.yaml file? You could test it against the existing demo maps that don't have these "new" parameters. Thanks!

@xiyuoh
Copy link
Member Author

xiyuoh commented Aug 18, 2021

@codebot done, thanks for the feedback!

Signed-off-by: xiyuoh <[email protected]>
@codebot
Copy link
Contributor

codebot commented Aug 27, 2021

Thank you for making the changes so that it works out-of-the-box with existing (old) map files. I just tested it on rmf_demos maps and it looks great. 🎉

@codebot codebot merged commit 63810c7 into open-rmf:main Aug 27, 2021
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.

2 participants