metasim.cfg.checkers#
Checker config classes.
Base Class
Base class for all checkers. |
Checker Operators
Combine multiple checkers with a logical AND operation. |
|
Combine multiple checkers with a logical OR operation. |
|
Negate the result of a checker. |
Checkers
Check if the object with |
|
Check if the joint with |
|
Check if the object with |
|
Check if the object with |
|
Check if the joint with |
Detectors
Check if the object is in the bounding box detector. |
|
Detect whether the object is in a 3D sphere region. |
BaseChecker#
- class metasim.cfg.checkers.BaseChecker#
Base class for all checkers. Checkers are used to check whether the task is executed successfully.
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- check(handler: BaseSimHandler)#
Check whether the task is executed successfully.
- get_debug_viewers() list[BaseObjCfg] #
Get the viewers to be used for debugging the checker.
AndOp#
- class metasim.cfg.checkers.AndOp#
Combine multiple checkers with a logical AND operation.
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- check(handler: BaseSimHandler) torch.BoolTensor #
Check whether the task is executed successfully.
- get_debug_viewers() list[BaseObjCfg] #
Get the viewers to be used for debugging the checker.
OrOp#
- class metasim.cfg.checkers.OrOp#
Combine multiple checkers with a logical OR operation.
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- check(handler: BaseSimHandler) torch.BoolTensor #
Check whether the task is executed successfully.
- get_debug_viewers() list[BaseObjCfg] #
Get the viewers to be used for debugging the checker.
NotOp#
- class metasim.cfg.checkers.NotOp#
Negate the result of a checker.
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- check(handler: BaseSimHandler) torch.BoolTensor #
Check whether the task is executed successfully.
- get_debug_viewers() list[BaseObjCfg] #
Get the viewers to be used for debugging the checker.
DetectedChecker#
- class metasim.cfg.checkers.DetectedChecker#
Bases:
BaseChecker
Check if the object with
obj_name
is detected by the detector.This class should always be used with a detector.
- obj_name: str#
The name of the object to be checked.
- detector: BaseDetector#
The detector to be used.
- ignore_if_first_check_success: bool#
If True, the checker will ignore the success of the first check. Default to False.
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- check(handler: BaseSimHandler) torch.BoolTensor #
Check whether the task is executed successfully.
- get_debug_viewers() list[BaseObjCfg] #
Get the viewers to be used for debugging the checker.
JointPosChecker#
- class metasim.cfg.checkers.JointPosChecker#
Bases:
BaseChecker
Check if the joint with
joint_name
of the object withobj_name
has positionradian_threshold
units.mode
should be one of “ge”, “le”. “ge” for greater than or equal to, “le” for less than or equal to.radian_threshold
is the threshold for the joint position.
- obj_name: str#
The name of the object to be checked.
- joint_name: str#
The name of the joint to be checked.
- mode: Literal['ge', 'le']#
The mode of the joint position checker. “ge” for greater than or equal to, “le” for less than or equal to.
- radian_threshold: float#
The threshold for the joint position. (in radian)
- check(handler: BaseSimHandler) torch.BoolTensor #
Check whether the task is executed successfully.
- get_debug_viewers() list[BaseObjCfg] #
Get the viewers to be used for debugging the checker.
PositionShiftChecker#
- class metasim.cfg.checkers.PositionShiftChecker#
Bases:
BaseChecker
Check if the object with
obj_name
was moved more thandistance
meters in givenaxis
.distance
is negative for moving towards the negative direction and positive for moving towards the positive direction.max_distance
is the maximum distance the object can move.axis
should be one of “x”, “y”, “z”.
- obj_name: str#
The name of the object to be checked.
- distance: float#
The threshold for the position shift. (in meters)
- bounding_distance: float#
The maximum distance the object can move. (in meters)
- axis: Literal['x', 'y', 'z']#
The axis to detect the position shift along.
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- check(handler: BaseSimHandler) torch.BoolTensor #
Check whether the task is executed successfully.
RotationShiftChecker#
- class metasim.cfg.checkers.RotationShiftChecker#
Bases:
BaseChecker
Check if the object with
obj_name
was rotated more thanradian_threshold
radians around the givenaxis
.radian_threshold
is negative for clockwise rotations and positive for counter-clockwise rotations.radian_threshold
should be in the range of [-pi, pi].axis
should be one of “x”, “y”, “z”. default is “z”.
- obj_name: str#
The name of the object to be checked.
- radian_threshold: float#
The threshold for the rotation. (in radian)
- axis: Literal['x', 'y', 'z']#
The axis to detect the rotation around.
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- check(handler: BaseSimHandler) torch.BoolTensor #
Check whether the task is executed successfully.
JointPosShiftChecker#
- class metasim.cfg.checkers.JointPosShiftChecker#
Bases:
BaseChecker
Check if the joint with
joint_name
of the object withobj_name
was moved more thanthreshold
units.threshold
is negative for moving towards the negative direction and positive for moving towards the positive direction.
- obj_name: str#
The name of the object to be checked.
- joint_name: str#
The name of the joint to be checked.
- threshold: float#
The threshold for the joint position. (in radian)
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- check(handler: BaseSimHandler) torch.BoolTensor #
Check whether the task is executed successfully.
RelativeBboxDetector#
- class metasim.cfg.checkers.RelativeBboxDetector#
Bases:
BaseDetector
Check if the object is in the bounding box detector.
The bbox detector is defined by relative_pos and relative_quat to the base object specified by base_obj_name
The bbox size is defined by checker_lower and checker_upper
If ignore_base_ori is True, the base object orientation is ignored.
- base_obj_name: str#
The name of the base object.
- relative_pos: tuple[float, float, float]#
The relative position (x, y, z) (in m) of the bbox detector to the base object.
- relative_quat: tuple[float, float, float, float]#
The relative rotation (w, x, y, z) of the bbox detector to the base object.
- checker_lower: tuple[float, float, float]#
The lower threshold (x, y, z) (in m) of the bbox detector.
- checker_upper: tuple[float, float, float]#
The upper threshold (x, y, z) (in m) of the bbox detector.
- ignore_base_ori: bool#
If True, the base object orientation is ignored, so the
relative_quat
becomes the absolute rotation of the bbox detector.
- debug_vis: bool#
Visualize the bbox detector. Only supported with IsaacLab for now.
- name: str#
The name of the bbox detector.
- fixed: bool#
The pose of the bbox detector is fixed once reset. Otherwise, it will be updated every step in correspond to the base object. Default to True.
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- is_detected(handler: BaseSimHandler, obj_name: str) torch.BoolTensor #
Check if the object is inside the detector.
- get_debug_viewers() list[BaseObjCfg] #
Get the viewers to be used for debugging the detector.
Relative3DSphereDetector#
- class metasim.cfg.checkers.Relative3DSphereDetector#
Bases:
BaseDetector
Detect whether the object is in a 3D sphere region.
The detector position is defined by relative_pos to the base object specified by base_obj_name
The region size is defined by radius
- base_obj_name: str#
The name of the base object.
- relative_pos: tuple[float, float, float]#
The relative position (x, y, z) (in m) of the 3D sphere detector to the base object.
- radius: float#
The radius (in m) of the 3D sphere detector.
- debug_vis: bool#
Visualize the 3D sphere detector. Not supported for now.
- reset(handler: BaseSimHandler, env_ids: list[int] | None = None)#
The code to run when the environment is reset.
- is_detected(handler: BaseSimHandler, obj_name: str) torch.BoolTensor #
Check if the object is inside the detector.
- get_debug_viewers() list[BaseObjCfg] #
Get the viewers to be used for debugging the detector.