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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions habitat/core/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ def __init__(

class RGBSensor(Sensor):
def __init__(self, *args: Any, **kwargs: Any) -> None:
self.uuid = "rgb"
super().__init__(*args, **kwargs)
if "config" in kwargs:
config = kwargs["config"]
if hasattr(config, "UUID"):
self.uuid = config.UUID

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"


def _get_sensor_type(self, *args: Any, **kwargs: Any) -> SensorTypes:
return SensorTypes.COLOR
Expand All @@ -122,10 +127,15 @@ def get_observation(self, *args: Any, **kwargs: Any) -> Any:

class DepthSensor(Sensor):
def __init__(self, *args: Any, **kwargs: Any) -> None:
self.uuid = "depth"
super().__init__(*args, **kwargs)
if "config" in kwargs:
config = kwargs["config"]
if hasattr(config, "UUID"):
self.uuid = config.UUID

def _get_uuid(self, *args: Any, **kwargs: Any) -> str:
return "depth"
return self.uuid

def _get_sensor_type(self, *args: Any, **kwargs: Any) -> SensorTypes:
return SensorTypes.DEPTH
Expand All @@ -139,10 +149,15 @@ def get_observation(self, *args: Any, **kwargs: Any):

class SemanticSensor(Sensor):
def __init__(self, *args: Any, **kwargs: Any) -> None:
self.uuid = "semantic"
super().__init__(*args, **kwargs)
if "config" in kwargs:
config = kwargs["config"]
if hasattr(config, "UUID"):
self.uuid = config.UUID

def _get_uuid(self, *args: Any, **kwargs: Any) -> str:
return "semantic"
return self.uuid

def _get_sensor_type(self, *args: Any, **kwargs: Any) -> SensorTypes:
return SensorTypes.SEMANTIC
Expand Down