Skip to content

Commit

Permalink
add ability to specify sensors to include / exclude, remove enforcing…
Browse files Browse the repository at this point in the history
… of controller existence due to subsume feature
  • Loading branch information
cremebrule committed Dec 20, 2024
1 parent a1fbadd commit adf7999
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 38 deletions.
10 changes: 10 additions & 0 deletions omnigibson/robots/a1.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def __init__(
reset_joint_pos=None,
# Unique to BaseRobot
obs_modalities=("rgb", "proprio"),
include_sensor_names=None,
exclude_sensor_names=None,
proprio_obs="default",
sensor_config=None,
# Unique to ManipulationRobot
Expand Down Expand Up @@ -70,6 +72,12 @@ def __init__(
Valid options are "all", or a list containing any subset of omnigibson.sensors.ALL_SENSOR_MODALITIES.
Note: If @sensor_config explicitly specifies `modalities` for a given sensor class, it will
override any values specified from @obs_modalities!
include_sensor_names (None or list of str): If specified, substring(s) to check for in all raw sensor prim
paths found on the robot. A sensor must include one of the specified substrings in order to be included
in this robot's set of sensors
exclude_sensor_names (None or list of str): If specified, substring(s) to check against in all raw sensor
prim paths found on the robot. A sensor must not include any of the specified substrings in order to
be included in this robot's set of sensors
proprio_obs (str or list of str): proprioception observation key(s) to use for generating proprioceptive
observations. If str, should be exactly "default" -- this results in the default proprioception
observations being used, as defined by self.default_proprio_obs. See self._get_proprioception_dict
Expand Down Expand Up @@ -128,6 +136,8 @@ def __init__(
action_normalize=action_normalize,
reset_joint_pos=reset_joint_pos,
obs_modalities=obs_modalities,
include_sensor_names=include_sensor_names,
exclude_sensor_names=exclude_sensor_names,
proprio_obs=proprio_obs,
sensor_config=sensor_config,
grasping_mode=grasping_mode,
Expand Down
11 changes: 0 additions & 11 deletions omnigibson/robots/active_camera_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ class ActiveCameraRobot(BaseRobot):
"""

def _validate_configuration(self):
# Make sure a camera controller is specified
assert (
"camera" in self._controllers
), "Controller 'camera' must exist in controllers! Current controllers: {}".format(
list(self._controllers.keys())
)

# run super
super()._validate_configuration()

def _get_proprioception_dict(self):
dic = super()._get_proprioception_dict()

Expand Down
4 changes: 4 additions & 0 deletions omnigibson/robots/behavior_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def __init__(
reset_joint_pos=None,
# Unique to BaseRobot
obs_modalities="rgb",
include_sensor_names=None,
exclude_sensor_names=None,
proprio_obs="default",
# Unique to ManipulationRobot
grasping_mode="assisted",
Expand Down Expand Up @@ -109,6 +111,8 @@ def __init__(
action_normalize=action_normalize,
reset_joint_pos=reset_joint_pos,
obs_modalities=obs_modalities,
include_sensor_names=include_sensor_names,
exclude_sensor_names=exclude_sensor_names,
proprio_obs=proprio_obs,
grasping_mode=grasping_mode,
grasping_direction="upper",
Expand Down
10 changes: 10 additions & 0 deletions omnigibson/robots/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def __init__(
reset_joint_pos=None,
# Unique to BaseRobot
obs_modalities=("rgb", "proprio"),
include_sensor_names=None,
exclude_sensor_names=None,
proprio_obs="default",
sensor_config=None,
# Unique to ManipulationRobot
Expand Down Expand Up @@ -88,6 +90,12 @@ def __init__(
Valid options are "all", or a list containing any subset of omnigibson.sensors.ALL_SENSOR_MODALITIES.
Note: If @sensor_config explicitly specifies `modalities` for a given sensor class, it will
override any values specified from @obs_modalities!
include_sensor_names (None or list of str): If specified, substring(s) to check for in all raw sensor prim
paths found on the robot. A sensor must include one of the specified substrings in order to be included
in this robot's set of sensors
exclude_sensor_names (None or list of str): If specified, substring(s) to check against in all raw sensor
prim paths found on the robot. A sensor must not include any of the specified substrings in order to
be included in this robot's set of sensors
proprio_obs (str or list of str): proprioception observation key(s) to use for generating proprioceptive
observations. If str, should be exactly "default" -- this results in the default proprioception
observations being used, as defined by self.default_proprio_obs. See self._get_proprioception_dict
Expand Down Expand Up @@ -126,6 +134,8 @@ def __init__(
action_normalize=action_normalize,
reset_joint_pos=reset_joint_pos,
obs_modalities=obs_modalities,
include_sensor_names=include_sensor_names,
exclude_sensor_names=exclude_sensor_names,
proprio_obs=proprio_obs,
sensor_config=sensor_config,
grasping_mode=grasping_mode,
Expand Down
10 changes: 10 additions & 0 deletions omnigibson/robots/franka.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def __init__(
reset_joint_pos=None,
# Unique to BaseRobot
obs_modalities=("rgb", "proprio"),
include_sensor_names=None,
exclude_sensor_names=None,
proprio_obs="default",
sensor_config=None,
# Unique to ManipulationRobot
Expand Down Expand Up @@ -72,6 +74,12 @@ def __init__(
Valid options are "all", or a list containing any subset of omnigibson.sensors.ALL_SENSOR_MODALITIES.
Note: If @sensor_config explicitly specifies `modalities` for a given sensor class, it will
override any values specified from @obs_modalities!
include_sensor_names (None or list of str): If specified, substring(s) to check for in all raw sensor prim
paths found on the robot. A sensor must include one of the specified substrings in order to be included
in this robot's set of sensors
exclude_sensor_names (None or list of str): If specified, substring(s) to check against in all raw sensor
prim paths found on the robot. A sensor must not include any of the specified substrings in order to
be included in this robot's set of sensors
proprio_obs (str or list of str): proprioception observation key(s) to use for generating proprioceptive
observations. If str, should be exactly "default" -- this results in the default proprioception
observations being used, as defined by self.default_proprio_obs. See self._get_proprioception_dict
Expand Down Expand Up @@ -192,6 +200,8 @@ def __init__(
action_normalize=action_normalize,
reset_joint_pos=reset_joint_pos,
obs_modalities=obs_modalities,
include_sensor_names=include_sensor_names,
exclude_sensor_names=exclude_sensor_names,
proprio_obs=proprio_obs,
sensor_config=sensor_config,
grasping_mode=grasping_mode,
Expand Down
10 changes: 10 additions & 0 deletions omnigibson/robots/holonomic_base_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def __init__(
reset_joint_pos=None,
# Unique to BaseRobot
obs_modalities=("rgb", "proprio"),
include_sensor_names=None,
exclude_sensor_names=None,
proprio_obs="default",
sensor_config=None,
**kwargs,
Expand Down Expand Up @@ -91,6 +93,12 @@ def __init__(
Valid options are "all", or a list containing any subset of omnigibson.sensors.ALL_SENSOR_MODALITIES.
Note: If @sensor_config explicitly specifies `modalities` for a given sensor class, it will
override any values specified from @obs_modalities!
include_sensor_names (None or list of str): If specified, substring(s) to check for in all raw sensor prim
paths found on the robot. A sensor must include one of the specified substrings in order to be included
in this robot's set of sensors
exclude_sensor_names (None or list of str): If specified, substring(s) to check against in all raw sensor
prim paths found on the robot. A sensor must not include any of the specified substrings in order to
be included in this robot's set of sensors
proprio_obs (str or list of str): proprioception observation key(s) to use for generating proprioceptive
observations. If str, should be exactly "default" -- this results in the default proprioception
observations being used, as defined by self.default_proprio_obs. See self._get_proprioception_dict
Expand Down Expand Up @@ -119,6 +127,8 @@ def __init__(
action_normalize=action_normalize,
reset_joint_pos=reset_joint_pos,
obs_modalities=obs_modalities,
include_sensor_names=include_sensor_names,
exclude_sensor_names=exclude_sensor_names,
proprio_obs=proprio_obs,
sensor_config=sensor_config,
**kwargs,
Expand Down
12 changes: 5 additions & 7 deletions omnigibson/robots/locomotion_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ class LocomotionRobot(BaseRobot):
"""

def _validate_configuration(self):
# We make sure that our base controller exists and is a locomotion controller
assert (
"base" in self._controllers
), "Controller 'base' must exist in controllers! Current controllers: {}".format(list(self._controllers.keys()))
assert isinstance(
self._controllers["base"], LocomotionController
), "Base controller must be a LocomotionController!"
# If we have a base controller, make sure it is a locomotion controller
if "base" in self._controllers:
assert isinstance(
self._controllers["base"], LocomotionController
), "Base controller must be a LocomotionController!"

# run super
super()._validate_configuration()
Expand Down
40 changes: 21 additions & 19 deletions omnigibson/robots/manipulation_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def __init__(
reset_joint_pos=None,
# Unique to BaseRobot
obs_modalities=("rgb", "proprio"),
include_sensor_names=None,
exclude_sensor_names=None,
proprio_obs="default",
sensor_config=None,
# Unique to ManipulationRobot
Expand Down Expand Up @@ -123,6 +125,12 @@ def __init__(
Otherwise, valid options should be part of omnigibson.sensors.ALL_SENSOR_MODALITIES.
Note: If @sensor_config explicitly specifies `modalities` for a given sensor class, it will
override any values specified from @obs_modalities!
include_sensor_names (None or list of str): If specified, substring(s) to check for in all raw sensor prim
paths found on the robot. A sensor must include one of the specified substrings in order to be included
in this robot's set of sensors
exclude_sensor_names (None or list of str): If specified, substring(s) to check against in all raw sensor
prim paths found on the robot. A sensor must not include any of the specified substrings in order to
be included in this robot's set of sensors
proprio_obs (str or list of str): proprioception observation key(s) to use for generating proprioceptive
observations. If str, should be exactly "default" -- this results in the default proprioception
observations being used, as defined by self.default_proprio_obs. See self._get_proprioception_dict
Expand Down Expand Up @@ -178,6 +186,8 @@ def __init__(
action_normalize=action_normalize,
reset_joint_pos=reset_joint_pos,
obs_modalities=obs_modalities,
include_sensor_names=include_sensor_names,
exclude_sensor_names=exclude_sensor_names,
proprio_obs=proprio_obs,
sensor_config=sensor_config,
**kwargs,
Expand All @@ -186,25 +196,17 @@ def __init__(
def _validate_configuration(self):
# Iterate over all arms
for arm in self.arm_names:
# We make sure that our arm controller exists and is a manipulation controller
assert (
"arm_{}".format(arm) in self._controllers
), "Controller 'arm_{}' must exist in controllers! Current controllers: {}".format(
arm, list(self._controllers.keys())
)
assert isinstance(
self._controllers["arm_{}".format(arm)], ManipulationController
), "Arm {} controller must be a ManipulationController!".format(arm)

# We make sure that our gripper controller exists and is a gripper controller
assert (
"gripper_{}".format(arm) in self._controllers
), "Controller 'gripper_{}' must exist in controllers! Current controllers: {}".format(
arm, list(self._controllers.keys())
)
assert isinstance(
self._controllers["gripper_{}".format(arm)], GripperController
), "Gripper {} controller must be a GripperController!".format(arm)
# If we have an arm controller, make sure it is a manipulation controller
if f"arm_{arm}" in self._controllers:
assert isinstance(
self._controllers["arm_{}".format(arm)], ManipulationController
), "Arm {} controller must be a ManipulationController!".format(arm)

# If we have a gripper controller, make sure it is a manipulation controller
if f"gripper_{arm}" in self._controllers:
assert isinstance(
self._controllers["gripper_{}".format(arm)], GripperController
), "Gripper {} controller must be a GripperController!".format(arm)

# run super
super()._validate_configuration()
Expand Down
10 changes: 10 additions & 0 deletions omnigibson/robots/mobile_manipulation_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def __init__(
reset_joint_pos=None,
# Unique to BaseRobot
obs_modalities=("rgb", "proprio"),
include_sensor_names=None,
exclude_sensor_names=None,
proprio_obs="default",
sensor_config=None,
# Unique to ManipulationRobot
Expand Down Expand Up @@ -85,6 +87,12 @@ def __init__(
Valid options are "all", or a list containing any subset of omnigibson.sensors.ALL_SENSOR_MODALITIES.
Note: If @sensor_config explicitly specifies `modalities` for a given sensor class, it will
override any values specified from @obs_modalities!
include_sensor_names (None or list of str): If specified, substring(s) to check for in all raw sensor prim
paths found on the robot. A sensor must include one of the specified substrings in order to be included
in this robot's set of sensors
exclude_sensor_names (None or list of str): If specified, substring(s) to check against in all raw sensor
prim paths found on the robot. A sensor must not include any of the specified substrings in order to
be included in this robot's set of sensors
proprio_obs (str or list of str): proprioception observation key(s) to use for generating proprioceptive
observations. If str, should be exactly "default" -- this results in the default proprioception
observations being used, as defined by self.default_proprio_obs. See self._get_proprioception_dict
Expand Down Expand Up @@ -122,6 +130,8 @@ def __init__(
action_normalize=action_normalize,
reset_joint_pos=reset_joint_pos,
obs_modalities=obs_modalities,
include_sensor_names=include_sensor_names,
exclude_sensor_names=exclude_sensor_names,
proprio_obs=proprio_obs,
sensor_config=sensor_config,
grasping_mode=grasping_mode,
Expand Down
10 changes: 10 additions & 0 deletions omnigibson/robots/r1.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def __init__(
reset_joint_pos=None,
# Unique to BaseRobot
obs_modalities=("rgb", "proprio"),
include_sensor_names=None,
exclude_sensor_names=None,
proprio_obs="default",
sensor_config=None,
# Unique to ManipulationRobot
Expand Down Expand Up @@ -80,6 +82,12 @@ def __init__(
Valid options are "all", or a list containing any subset of omnigibson.sensors.ALL_SENSOR_MODALITIES.
Note: If @sensor_config explicitly specifies `modalities` for a given sensor class, it will
override any values specified from @obs_modalities!
include_sensor_names (None or list of str): If specified, substring(s) to check for in all raw sensor prim
paths found on the robot. A sensor must include one of the specified substrings in order to be included
in this robot's set of sensors
exclude_sensor_names (None or list of str): If specified, substring(s) to check against in all raw sensor
prim paths found on the robot. A sensor must not include any of the specified substrings in order to
be included in this robot's set of sensors
proprio_obs (str or list of str): proprioception observation key(s) to use for generating proprioceptive
observations. If str, should be exactly "default" -- this results in the default proprioception
observations being used, as defined by self.default_proprio_obs. See self._get_proprioception_dict
Expand Down Expand Up @@ -114,6 +122,8 @@ def __init__(
action_normalize=action_normalize,
reset_joint_pos=reset_joint_pos,
obs_modalities=obs_modalities,
include_sensor_names=include_sensor_names,
exclude_sensor_names=exclude_sensor_names,
proprio_obs=proprio_obs,
sensor_config=sensor_config,
grasping_mode=grasping_mode,
Expand Down
Loading

0 comments on commit adf7999

Please sign in to comment.