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 UUID config to simulator visual sensors #472

Merged
merged 5 commits into from
Sep 4, 2020

Conversation

Skylion007
Copy link
Contributor

Motivation and Context

Fixes #471

How Has This Been Tested

With existing sensors tests as well as by overriding the UUID

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • My code follows the code style of this project.
  • [] My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Sep 1, 2020
Copy link
Contributor

@eundersander eundersander left a comment

Choose a reason for hiding this comment

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

Can you document how and why to use this somewhere in the code? Even just linking to #471 in the code would help.

Otherwise LGTM.

Copy link
Contributor

@mathfac mathfac left a comment

Choose a reason for hiding this comment

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

Thank you, Aaron! That's longstanding issue for defining several sensors of the same type.

Maybe worth to change Sensor class to fix it once:

self.uuid = self._get_uuid(*args, **kwargs)

To something like this:

         if self.config and hasattr(self.config, "UUID"):
               self.uuid = config.UUID
        else:
               self.uuid = self._get_uuid(*args, **kwargs)


def _get_uuid(self, *args: Any, **kwargs: Any) -> str:
return "rgb"
return self.uuid
Copy link
Contributor

Choose a reason for hiding this comment

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

This all can be done with:

Suggested change
return self.uuid
return self.uuid
if hasattr(self.config, "UUID"):
return config.UUID
else:
return "rgb"

@Skylion007
Copy link
Contributor Author

Skylion007 commented Sep 3, 2020

@mathfac Maybe we should just deprecate _get_uuid and have it be a required part of the YAML sensor config?

if hasattr(self.config, "UUID"):
# We allow any sensor config to override the UUID
self.uuid = self.config.UUID
else:
Copy link
Contributor Author

@Skylion007 Skylion007 Sep 3, 2020

Choose a reason for hiding this comment

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

@mathfac Actually, I am not sure I like this method because calling _get_uuid will return the wrong UUID. We really should remove the internal method INMO

@Skylion007 Skylion007 merged commit 8447cb2 into master Sep 4, 2020
@Skylion007 Skylion007 deleted the yaml_sensor_uuid_config branch September 4, 2020 19:17
dannymcy pushed a commit to dannymcy/habitat-lab that referenced this pull request Jul 8, 2024
* Add UUID config to simulator visual sensors

* Add comments about UUID and add to BumpSensor

* Incorporate suggestions

* Remove unused code

* Make base sensor have overidable UUID
HHYHRHY pushed a commit to SgtVincent/habitat-lab that referenced this pull request Aug 31, 2024
* Add UUID config to simulator visual sensors

* Add comments about UUID and add to BumpSensor

* Incorporate suggestions

* Remove unused code

* Make base sensor have overidable UUID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have Default SensorTypes have a YAML Customizable UUIDs
4 participants