pyrcareworld.attributes package#
Submodules#
pyrcareworld.attributes.activelightsensor_attr module#
- class pyrcareworld.attributes.activelightsensor_attr.ActiveLightSensorAttr(env, id: int, data=None)[source]#
Bases:
CameraAttrClass of IR-based depth sensor, which can simulate the noise of real-world depth camera and produce depth image in similar pattern.
pyrcareworld.attributes.base_attr module#
- class pyrcareworld.attributes.base_attr.BaseAttr(env, id: int, data: dict = {})[source]#
Bases:
objectBase attribute class, which includes general functions such as object loading, setting transform, setting parent, etc.
- Copy(new_id: int)[source]#
Duplicate an object.
- Parameters:
new_id β Int, the ID of the new object.
- Returns:
The new duplicated object.
- DoMove(position: list, duration: float, speed_based: bool = True, relative: bool = False)[source]#
Tween movement.
- Parameters:
position β A list of length 3, representing the position.
duration β Float, if speed_based is True, it represents movement duration; otherwise, it represents movement speed.
speed_based β Bool, determines if the movement is speed-based.
relative β Bool, if True, position is relative; otherwise, position is absolute.
- DoRotate(rotation: list, duration: float, speed_based: bool = True, relative: bool = False)[source]#
Tween rotation.
- Parameters:
rotation β A list of length 3, representing the rotation.
duration β Float, if speed_based is True, it represents movement duration; otherwise, it represents movement speed.
speed_based β Bool, determines if the rotation is speed-based.
relative β Bool, if True, rotation is relative; otherwise, rotation is absolute.
- DoRotateQuaternion(quaternion: list, duration: float, speed_based: bool = True, relative: bool = False)[source]#
Tween rotation using quaternion.
- Parameters:
quaternion β A list of length 4, representing the quaternion.
duration β Float, if speed_based is True, it represents movement duration; otherwise, it represents movement speed.
speed_based β Bool, determines if the rotation is speed-based.
relative β Bool, if True, quaternion is relative; otherwise, quaternion is absolute.
- GetLocalPointFromWorld(point: list)[source]#
Transform a point from local coordinates to world coordinates. After calling this method and stepping once, the result will be saved in self.data[βresult_local_pointβ].
- Parameters:
point β A list of length 3, representing the position of a point.
- GetWorldPointFromLocal(point: list)[source]#
Transform a point from world coordinates to local coordinates. After calling this method and stepping once, the result will be saved in self.data[βresult_world_pointβ].
- Parameters:
point β A list of length 3, representing the position of a point.
- LookAt(target: list, world_up: list = None)[source]#
Rotate the transform so the forward vector points at the targetβs current position.
- Parameters:
target β A list of length 3, target to point towards.
world_up β A list of length 3, vector specifying the upward direction.
- Rotate(rotation: list, is_world: bool = True)[source]#
Rotate this object.
- Parameters:
rotation β A list of length 3, representing the euler-angle-format rotation from the current euler angle.
is_world β Bool, True for world coordinate, False for local coordinate.
- SetActive(active: bool)[source]#
Activate/Deactivate this object.
- Parameters:
active β Bool, True for active, False for inactive.
- SetLayer(layer: int)[source]#
Set the layer in Unity of this object. Check https://docs.unity3d.com/Manual/Layers.html to get an idea about layers.
- Parameters:
layer β Int, the number of the layer.
- SetParent(parent_id: int, parent_name: str = '')[source]#
Set the parent of this object.
- Parameters:
parent_id β Int, the ID of the parent object.
parent_name β Str, the name of the parent object.
- SetPosition(position: list = None, is_world: bool = True)[source]#
Set the position of this object.
- Parameters:
position β A list of length 3, representing the target position value of the object.
is_world β Bool, True for world coordinate, False for local coordinate.
- SetRotation(rotation: list = None, is_world: bool = True)[source]#
Set the rotation of this object.
- Parameters:
rotation β A list of length 3, representing the target euler angle value of the object.
is_world β Bool, True for world coordinate, False for local coordinate.
- SetRotationQuaternion(quaternion: list = None, is_world: bool = True)[source]#
Set the rotation of this object using quaternion.
- Parameters:
quaternion β A list of length 4, representing the quaternion from the current pose.
is_world β Bool, True for world coordinate, False for local coordinate.
- SetScale(scale: list = None)[source]#
Set the scale of this object.
- Parameters:
scale β A list of length 3, representing the target scale value of the object.
- SetTransform(position: list = None, rotation: list = None, scale: list = None, is_world: bool = True)[source]#
Set the transform of this object, including position, rotation, scale, and coordinate.
- Parameters:
position β A list of length 3, representing the target position value of the object.
rotation β A list of length 3, representing the target euler angle value of the object.
scale β A list of length 3, representing the target scale value of the object.
is_world β Bool, True for world coordinate, False for local coordinate.
- SetType(attr_type: type)[source]#
Set the attribute type of this object.
- Parameters:
attr_type β Any attribute in pyrcareworld.attributes.
- Returns:
The target attribute.
- Translate(translation: list, is_world: bool = True)[source]#
Translate this object.
- Parameters:
translation β A list of length 3, representing the translation from the current position.
is_world β Bool, True for world coordinate, False for local coordinate.
- parse_message(data: dict)[source]#
Parse messages. This function handles the data sent from Unity and stores it in self.data, which contains the keys in data. This function is called by an internal function at each timestep, so the data is updated every timestep.
- Parameters:
data β Dictionary containing the message data. The keys are: - βnameβ: The name of the object. - βpositionβ: The position of the object in world coordinates. - βrotationβ: The euler angle of the object in world coordinates. - βquaternionβ: The quaternion of the object in world coordinates. - βlocal_positionβ: The position of the object in its parentβs local coordinates. - βlocal_rotationβ: The euler angle of the object in its parentβs local coordinates. - βlocal_quaternionβ: The quaternion of the object in its parentβs local coordinates. - βlocal_to_world_matrixβ: The transformation matrix from local to world coordinates. - βresult_local_pointβ: The result of transforming the object from local to world coordinates. - βresult_world_pointβ: The result of transforming the object from world to local coordinates.
pyrcareworld.attributes.camera_attr module#
- class pyrcareworld.attributes.camera_attr.CameraAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrCamera class. This class is used to control the camera and obtain visual information from the simulation environment.
- The data stored in self.data is a dictionary containing the following keys:
βnameβ: The name of the object.
βpositionβ: The position of the object in world coordinates.
βrotationβ: The euler angle of the object in world coordinates.
βquaternionβ: The quaternion of the object in world coordinates.
βlocal_positionβ: The position of the object in its parentβs local coordinates.
βlocal_rotationβ: The euler angle of the object in its parentβs local coordinates.
βlocal_quaternionβ: The quaternion of the object in its parentβs local coordinates.
βlocal_to_world_matrixβ: The transformation matrix from local to world coordinates.
βresult_local_pointβ: The result of transforming the object from local to world coordinates.
βresult_world_pointβ: The result of transforming the object from world to local coordinates.
- Get2DBBox(width: int = None, height: int = None, fov: float = 60.0, intrinsic_matrix: ndarray = None)[source]#
Get the 2D bounding box of objects in the current camera view.
- Parameters:
width β Int, the width of the image.
height β Int, the height of the image.
fov β Float, the field of view for the camera.
intrinsic_matrix β A ndarray of shape 3x3, representing the camera intrinsic matrix. When this parameter is passed, width, height, and fov will be ignored.
- GetAmodalMask(target_id: int, width: int = None, height: int = None, fov: float = 60.0, intrinsic_matrix: ndarray = None)[source]#
Get the amodal mask image for the target object.
- Parameters:
target_id β The target object ID.
width β Int, the width of the image.
height β Int, the height of the image.
fov β Float, the field of view for the camera.
intrinsic_matrix β A ndarray of shape 3x3, representing the camera intrinsic matrix. When this parameter is passed, width, height, and fov will be ignored.
- GetDepth(zero_dis: float = 0.0, one_dis: float = 1.0, width: int = None, height: int = None, fov: float = 60.0, intrinsic_matrix: ndarray = None)[source]#
Get the depth 8-bit PNG image from the camera. Since each pixel of the depth image returned from this function is 8-bit, the user should limit the depth range (zero_dis and one_dis) for more accurate results.
- Parameters:
zero_dis β The minimum distance in calculation.
one_dis β The maximum distance in calculation.
width β Int, the width of the image.
height β Int, the height of the image.
fov β Float, the field of view for the camera.
intrinsic_matrix β A ndarray of shape 3x3, representing the camera intrinsic matrix. When this parameter is passed, width, height, and fov will be ignored.
- GetDepth16Bit(zero_dis: float = 0.0, one_dis: float = 1.0, width: int = None, height: int = None, fov: float = 60.0, intrinsic_matrix: ndarray = None)[source]#
Get the depth 16-bit PNG image from the camera. Since each pixel of the depth image returned from this function is 16-bit, the user should limit the depth range (zero_dis and one_dis) for more accurate results.
- Parameters:
zero_dis β The minimum distance in calculation.
one_dis β The maximum distance in calculation.
width β Int, the width of the image.
height β Int, the height of the image.
fov β Float, the field of view for the camera.
intrinsic_matrix β A ndarray of shape 3x3, representing the camera intrinsic matrix. When this parameter is passed, width, height, and fov will be ignored.
- GetDepthEXR(width: int = None, height: int = None, fov: float = 60.0, intrinsic_matrix: ndarray = None)[source]#
Get the depth EXR image from the camera. This function returns EXR format image bytes and each pixel is 32-bit.
- Parameters:
width β Int, the width of the image.
height β Int, the height of the image.
fov β Float, the field of view for the camera.
intrinsic_matrix β A ndarray of shape 3x3, representing the camera intrinsic matrix. When this parameter is passed, width, height, and fov will be ignored.
- GetHeatMap(width: int = None, height: int = None, radius: int = 50, fov: float = 60.0, intrinsic_matrix: ndarray = None)[source]#
Get the heat map image.
- Parameters:
width β Int, the width of the image.
height β Int, the height of the image.
radius β The radius of the heat map.
fov β Float, the field of view for the camera.
intrinsic_matrix β A ndarray of shape 3x3, representing the camera intrinsic matrix. When this parameter is passed, width, height, and fov will be ignored.
- GetID(width: int = None, height: int = None, fov: float = 60.0, intrinsic_matrix: ndarray = None)[source]#
Get the instance segmentation mask image. The color for each pixel is computed from object ID, see pyrcareworld.utils.rfunicerse_util.GetColorFromID for more details.
- Parameters:
width β Int, the width of the image.
height β Int, the height of the image.
fov β Float, the field of view for the camera.
intrinsic_matrix β A ndarray of shape 3x3, representing the camera intrinsic matrix. When this parameter is passed, width, height, and fov will be ignored.
- GetNormal(width: int = None, height: int = None, fov: float = 60.0, intrinsic_matrix: ndarray = None)[source]#
Get the normal image in world coordinates.
- Parameters:
width β Int, the width of the image.
height β Int, the height of the image.
fov β Float, the field of view for the camera.
intrinsic_matrix β A ndarray of shape 3x3, representing the camera intrinsic matrix. When this parameter is passed, width, height, and fov will be ignored.
- GetRGB(width: int = None, height: int = None, fov: float = 60.0, intrinsic_matrix: ndarray = None)[source]#
Get the camera RGB image.
- Parameters:
width β Int, the width of the image.
height β Int, the height of the image.
fov β Float, the field of view for the camera.
intrinsic_matrix β A ndarray of shape 3x3, representing the camera intrinsic matrix. When this parameter is passed, width, height, and fov will be ignored.
pyrcareworld.attributes.cloth_attr module#
- class pyrcareworld.attributes.cloth_attr.ClothAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrObi cloth class.
pyrcareworld.attributes.collider_attr module#
- class pyrcareworld.attributes.collider_attr.ColliderAttr(env, id: int, data: dict = {})[source]#
Bases:
GameObjectAttrCollider class for objects that have a collider in Unity.
- AddObiCollider()[source]#
Add an ObiCollider to this Collider. https://obi.virtualmethodstudio.com/manual/6.3/collisions.html
- EnabledAllCollider(enabled: bool)[source]#
Enable or disable all colliders.
- Parameters:
enabled β Bool, True to enable and False to disable.
- SetPhysicMaterial(bounciness: float, dynamicFriction: float, staticFriction: float, frictionCombine: int, bounceCombine: int)[source]#
Set the physical material properties for the collider.
- Parameters:
bounciness β Float, The coefficient of restitution or βbouncinessβ of the collider. A value of 0 means no bounce, while a value of 1 means a perfect bounce.
dynamicFriction β Float, The coefficient of friction when the collider is in motion relative to another collider.
staticFriction β Float, The coefficient of friction when the collider is at rest relative to another collider.
frictionCombine β Int, Defines how friction values should be combined when multiple colliders interact. Possible values: - 0: Average - 1: Maximum - 2: Minimum - 3: Multiply
bounceCombine β Int, Defines how bounce values should be combined when multiple colliders interact. Possible values: - 0: Average - 1: Maximum - 2: Minimum - 3: Multiply
pyrcareworld.attributes.controller_attr module#
- class pyrcareworld.attributes.controller_attr.ControllerAttr(env, id: int, data: dict = {})[source]#
Bases:
ColliderAttrRobot controller class, which will control robot arms, hands, mobile manipulators, etc. The data stored in self.data is a dictionary containing the following keys:
βnumber_of_jointsβ: The number of joints in an articulation.
βnamesβ: The name of each part in an articulation.
βtypesβ: The joint type of each part in an articulation.
βpositionsβ: The position of each part in an articulation.
βrotationsβ: The rotation of each part in an articulation.
βquaternionβ: The quaternion of each part in an articulation.
βlocal_positionsβ: The local position of each part in an articulation.
βlocal_rotationsβ: The local rotation of each part in an articulation.
βlocal_quaternionβ: The local quaternion of each part in an articulation.
βvelocitiesβ: The velocity of each part in an articulation.
βangular_velocitiesβ: The angular velocity of each part in an articulation.
βnumber_of_moveable_jointsβ: The number of moveable joints in an articulation.
βjoint_positionsβ: The joint position of each moveable joint in an articulation.
βjoint_velocitiesβ: The joint velocity of each moveable joint in an articulation.
βjoint_accelerationsβ: The joint accelerations of each moveable joint in an articulation.
βjoint_forceβ: The joint force of each moveable joint in an articulation.
βjoint_lower_limitβ: The joint lower limit of each moveable joint in an articulation.
βjoint_upper_limitβ: The joint upper limit of each moveable joint in an articulation.
βjoint_stiffnessβ: The joint stiffness of each moveable joint in an articulation.
βjoint_dampingβ: The joint damping of each moveable joint in an articulation.
βmove_doneβ: Whether robot arm IK has finished moving.
βrotate_doneβ: Whether robot arm IK has finished rotating.
βgravity_forcesβ: Inverse dynamics force needed to counteract gravity.
βcoriolis_centrifugal_forcesβ: Inverse dynamics force needed to counteract coriolis centrifugal forces.
βdrive_forcesβ: Inverse dynamics drive forces.
- AddJointForce(joint_forces: list)[source]#
Add force to each moveable joint.
- Parameters:
joint_forces β A list of forces, representing the added forces.
- AddJointForceAtPosition(joint_forces: list, force_positions: list)[source]#
Add force to each moveable joint at a given position.
- Parameters:
joint_forces β A list of forces, representing the added forces.
force_positions β A list of positions, representing the positions for forces.
- AddJointTorque(joint_torques: list)[source]#
Add torque to each moveable joint.
- Parameters:
joint_torques β A list of torques, representing the added torques.
- AddRoot6DOF(new_id: int = None)[source]#
Add a 6-DOF root joint to the articulation body. The articulation body is incapable of non-dynamic motion and requires the addition of a 6-DOF root joint for free motion. This must be called when the object is first created.
- Parameters:
new_id β Int, optional new ID for the root joint.
- Returns:
The new root joint as a ControllerAttr instance.
- EnabledNativeIK(enabled: bool)[source]#
Enable or disable the native IK algorithm.
- Parameters:
enabled β Bool, True to enable and False to disable. When enabled, use the IKTatGetDo*** interface to set the end pose. When disabled, use the SetJoint*** interface to move the joints. Native IK can only take effect when it is started during initialization.
- GetIKTargetJointPosition(position: list = None, rotation: list = None, quaternion: list = None, iterate: int = 100)[source]#
Input IK target pose and get the IK calculation results. After calling this method and stepping once, the result will be saved in self.data[βresult_joint_positionβ]
- Parameters:
position β A list of length 3, representing the position of the IK target.
rotation β A list of length 3, representing the euler angle of the IK target.
quaternion β A list of length 4, representing the quaternion of the IK target. If this parameter is specified, rotation will be ignored.
iterate β Int, the number of IK calculation iterations.
- GetJointInverseDynamicsForce()[source]#
Get the joint inverse dynamics force of each moveable joint. Note that this function only works in Unity version >= 2022.1.
- GetJointLocalPointFromWorld(joint_index: int, point: list)[source]#
Transform a point from joint local coordinates to world coordinates. After calling this method and stepping once, the result will be saved in self.data[βresult_joint_local_pointβ]
- Parameters:
joint_index β Int, index of the joint.
point β A list of length 3, representing the position of a point.
- GetJointWorldPointFromLocal(joint_index: int, point: list)[source]#
Transform a point from world coordinates to joint local coordinates. After calling this method and stepping once, the result will be saved in self.data[βresult_joint_world_pointβ]
- Parameters:
joint_index β Int, index of the joint.
point β A list of length 3, representing the position of a point.
- IKTargetDoMove(position: list, duration: float, speed_based: bool = True, relative: bool = False)[source]#
Native IK target movement.
- Parameters:
position β A list of length 3, representing the position.
duration β Float, if speed_based is True, it represents movement duration; otherwise, it represents movement speed.
speed_based β Bool.
relative β Bool, if True, position is relative; otherwise, position is absolute.
- IKTargetDoRotate(rotation: list, duration: float, speed_based: bool = True, relative: bool = False)[source]#
Native IK target rotation.
- Parameters:
rotation β A list of length 3, representing the rotation.
duration β Float, if speed_based is True, it represents movement duration; otherwise, it represents movement speed.
speed_based β Bool.
relative β Bool, if True, rotation is relative; otherwise, rotation is absolute.
- IKTargetDoRotateQuaternion(quaternion: list, duration: float, speed_based: bool = True, relative: bool = False)[source]#
Native IK target rotation using quaternion.
- Parameters:
quaternion β A list of length 4, representing the quaternion.
duration β Float, if speed_based is True, it represents movement duration; otherwise, it represents movement speed.
speed_based β Bool.
relative β Bool, if True, quaternion is relative; otherwise, quaternion is absolute.
- MoveBack(distance: float, speed: float)[source]#
Move the robot backward. Only works if the robot controller has a mobile platform.
- Parameters:
distance β Float, distance.
speed β Float, velocity.
- MoveForward(distance: float, speed: float)[source]#
Move the robot forward. Only works if the robot controller has a mobile platform.
- Parameters:
distance β Float, distance.
speed β Float, velocity.
- SetIKTargetOffset(position: list = None, rotation: list = None, quaternion: list = None)[source]#
Set the new IK target by setting offset to the original target of native IK.
- Parameters:
position β A list of length 3, representing the position offset to the original target.
rotation β A list of length 3, representing the rotation offset to the original target.
quaternion β A list of length 4, representing the quaternion offset to the original target. If this parameter is specified, rotation will be ignored.
- SetImmovable(immovable: bool)[source]#
Set whether the base of the articulation is immovable.
- Parameters:
immovable β Bool, True for immovable, False for movable.
- SetIndexJointPosition(index: int, joint_position: float)[source]#
Set the target joint position for a given joint and move with PD control.
- Parameters:
index β Int, joint index.
joint_position β Float, the target joint position.
- SetIndexJointPositionDirectly(index: int, joint_position: float)[source]#
Set the target joint position for a given joint and move directly.
- Parameters:
index β Int, joint index.
joint_position β Float, the target joint position.
- SetIndexJointVelocity(index: int, joint_velocity: float)[source]#
Set the target joint velocity for a given joint.
- Parameters:
index β Int, joint index.
joint_velocity β A list of float, representing the target joint velocities.
- SetJointDamping(joint_damping: list)[source]#
Set the joint damping for each moveable joint.
- Parameters:
joint_damping β A list of float, each moveable joint damping.
- SetJointDriveForce(joint_drive_forces: list)[source]#
Set the joint drive forces for each moveable joint.
- Parameters:
joint_drive_forces β A list of float, representing the joint drive forces.
- SetJointLimit(joint_upper_limit: list, joint_lower_limit: list)[source]#
Set the joint limit for each moveable joint.
- Parameters:
joint_upper_limit β A list of float, each moveable joint upper limit.
joint_lower_limit β A list of float, each moveable joint lower limit.
- SetJointPosition(joint_positions: list)[source]#
Set the joint position for each moveable joint and move with PD control.
- Parameters:
joint_positions β A list of float, representing the target joint positions.
- SetJointPositionContinue(interval: int, time_joint_positions: list)[source]#
Set the joint position for each moveable joint and move with PD control continuously.
- Parameters:
interval β Float, the time interval.
time_joint_positions β A list of float list, representing the target joint positions at each time step.
- SetJointPositionDirectly(joint_positions: list)[source]#
Set the joint position for each moveable joint and move directly.
- Parameters:
joint_positions β A list of float, representing the target joint positions.
- SetJointStiffness(joint_stiffness: list)[source]#
Set the joint stiffness for each moveable joint.
- Parameters:
joint_stiffness β A list of float, each moveable joint stiffness.
- SetJointUseGravity(use_gravity: bool)[source]#
Set all joints to use or not use gravity.
- Parameters:
use_gravity β Bool, True to use gravity, False to not use gravity.
- SetJointVelocity(joint_velocitys: list)[source]#
Set the joint velocity for each moveable joint.
- Parameters:
joint_velocitys β A list of float, representing the target joint velocities.
pyrcareworld.attributes.custom_attr module#
- class pyrcareworld.attributes.custom_attr.CustomAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrThis is an example of a custom attribute class, without actual functions.
- The data stored in self.data is a dictionary containing the following keys:
βcustom_messageβ: a custom message.
pyrcareworld.attributes.digit_attr module#
- class pyrcareworld.attributes.digit_attr.DigitAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrClass for simulating DIGIT tactile sensor. https://digit.ml/ The data stored in self.data is a dictionary containing the following keys:
βlightβ: Bytes of RGB light image in DIGIT.
βdepthβ: Bytes of depth image in DIGIT.
pyrcareworld.attributes.gameobject_attr module#
- class pyrcareworld.attributes.gameobject_attr.GameObjectAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrBasic game object attribute class.
- The data stored in self.data is a dictionary containing the following keys:
β3d_bounding_boxβ: The 3D bounding box of objects.
- EnabledRender(enabled: bool)[source]#
Enable or disable the rendering system.
- Parameters:
enabled β Bool, True to enable rendering and False to disable rendering.
pyrcareworld.attributes.gelslim_attr module#
- class pyrcareworld.attributes.gelslim_attr.GelSlimAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrClass for simulating GelSlim tactile sensor. https://arxiv.org/abs/1803.00628 The data stored in self.data is a dictionary containing the following keys: - βlightβ: Bytes of RGB light image in GelSlim. - βdepthβ: Bytes of depth image in GelSlim.
pyrcareworld.attributes.graspsim_attr module#
- class pyrcareworld.attributes.graspsim_attr.GraspSimAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrGrasp pose simulation class.
The data stored in self.data is a dictionary containing the following keys: - βdoneβ: Whether the simulation is done. - βpointsβ: The list of grasp points. - βquaternionsβ: The list of grasping pose quaternions. - βwidthβ: The list of gripper width of grasping pose. - βsuccessβ: The list of success or failure of the grasping pose.
- GenerateGraspPose(mesh: str, gripper: str, points: list, normals: list, depth_range_min: float, depth_range_max: float, depth_lerp_count: int, angle_lerp_count: int)[source]#
Generate grasp poses and visualize grasp results.
- Parameters:
mesh β Str, the absolute path to .obj file.
gripper β Str, the name of the gripper.
points β A list of float, representing the grasping points.
normals β A list of float, representing the normals.
depth_range_min β Float, the minimum depth of grasp pose.
depth_range_max β Float, the maximum depth of grasp pose.
depth_lerp_count β Int, the interpolation count of depth.
angle_lerp_count β Int, the interpolation count of angle.
- ShowGraspPose(mesh: str, gripper: str, positions: list, quaternions: list)[source]#
Display grasp poses.
- Parameters:
mesh β Str, the absolute path to .obj file.
gripper β Str, the name of the gripper.
positions β A list of float, representing the grasping positions.
quaternions β A list of float, representing the quaternions.
- StartGraspSim(mesh: str, gripper: str, points: list, normals: list, depth_range_min: float, depth_range_max: float, depth_lerp_count: int, angle_lerp_count: int, parallel_count: int = 100)[source]#
Start simulating grasping.
- Parameters:
mesh β Str, the absolute path to .obj file.
gripper β Str, the name of the gripper.
points β A list of float, representing the grasping points.
normals β A list of float, representing the normals.
depth_range_min β Float, the minimum depth of grasp pose.
depth_range_max β Float, the maximum depth of grasp pose.
depth_lerp_count β Int, the interpolation count of depth.
angle_lerp_count β Int, the interpolation count of angle.
parallel_count β Int, the count of parallel grasping.
- StartGraspTest(mesh: str, gripper: str, points: list, quaternions: list, parallel_count: int = 100)[source]#
Start testing the grasp based on current grasp poses.
- Parameters:
mesh β Str, the absolute path to .obj file.
gripper β Str, the name of the gripper.
points β A list of float, representing the grasping points.
quaternions β A list of float, representing the quaternions.
parallel_count β Int, the count of parallel grasping.
pyrcareworld.attributes.humanbody_attr module#
- class pyrcareworld.attributes.humanbody_attr.HumanbodyAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrHuman body Inverse Kinematic class.
The data stored in self.data is a dictionary containing the following keys: - βmove_doneβ: Whether the movement has finished. - βrotate_doneβ: Whether the rotation has finished.
- HumanIKTargetDoComplete(index: int)[source]#
Make the human body IK target movement/rotation complete directly.
- Parameters:
index β Int, the target for movement. 0 for left hand, 1 for right hand, 2 for left foot, 3 for right foot, 4 for head.
- HumanIKTargetDoKill(index: int)[source]#
Make the human body IK target movement/rotation stop.
- Parameters:
index β Int, the target for movement. 0 for left hand, 1 for right hand, 2 for left foot, 3 for right foot, 4 for head.
- HumanIKTargetDoMove(index: int, position: list, duration: float, speed_based: bool = True, relative: bool = False)[source]#
Human body Inverse Kinematics target movement.
- Parameters:
index β Int, the target for movement. 0 for left hand, 1 for right hand, 2 for left foot, 3 for right foot, 4 for head.
position β A list of length 3, representing the position.
duration β Float, if speed_based is True, it represents movement duration; otherwise, it represents movement speed.
speed_based β Bool, if True, duration represents movement duration; otherwise, it represents movement speed.
relative β Bool, if True, position is relative; otherwise, position is absolute.
- HumanIKTargetDoRotate(index: int, rotation: list, duration: float, speed_based: bool = True, relative: bool = False)[source]#
Human body Inverse Kinematics target rotation.
- Parameters:
index β Int, the target for movement. 0 for left hand, 1 for right hand, 2 for left foot, 3 for right foot, 4 for head.
rotation β A list of length 3, representing the rotation.
duration β Float, if speed_based is True, it represents movement duration; otherwise, it represents movement speed.
speed_based β Bool, if True, duration represents movement duration; otherwise, it represents movement speed.
relative β Bool, if True, rotation is relative; otherwise, rotation is absolute.
- HumanIKTargetDoRotateQuaternion(index: int, quaternion: list, duration: float, speed_based: bool = True, relative: bool = False)[source]#
Human body Inverse Kinematics target rotation using quaternion.
- Parameters:
index β Int, the target for movement. 0 for left hand, 1 for right hand, 2 for left foot, 3 for right foot, 4 for head.
quaternion β A list of length 4, representing the quaternion.
duration β Float, if speed_based is True, it represents movement duration; otherwise, it represents movement speed.
speed_based β Bool, if True, duration represents movement duration; otherwise, it represents movement speed.
relative β Bool, if True, quaternion is relative; otherwise, quaternion is absolute.
pyrcareworld.attributes.light_attr module#
- class pyrcareworld.attributes.light_attr.LightAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrLight attribute class.
- SetColor(color: list)[source]#
Set the color of the light.
- Parameters:
color β A list of length 3, representing the R, G, and B channels, in range [0, 1].
- SetIntensity(light_intensity: float)[source]#
Set the intensity of the light.
- Parameters:
light_intensity β Float, the intensity of the light.
- SetRange(light_range: float)[source]#
Set the range of the light. (Only available when the LightType is LightType.Spot or LightType.Point)
- Parameters:
light_range β Float, the range of the light.
- SetShadow(light_shadow: LightShadow)[source]#
Set the type of shadow.
- Parameters:
light_shadow β LightShadow, the type of shadow.
- class pyrcareworld.attributes.light_attr.LightShadow(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
EnumThe type of shadow, keeping the same name as LightShadows (https://docs.unity3d.com/ScriptReference/LightShadows.html) in Unity.
- Hard = 1#
- NoneShadow = 0#
- Soft = 2#
- class pyrcareworld.attributes.light_attr.LightType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
EnumThe type of light, keeping the same name as LightType (https://docs.unity3d.com/ScriptReference/LightType.html) in Unity.
- Area = 3#
- Directional = 1#
- Disc = 4#
- Point = 2#
- Spot = 0#
pyrcareworld.attributes.omplmanager_attr module#
pyrcareworld.attributes.pointcloud_attr module#
- class pyrcareworld.attributes.pointcloud_attr.PointCloudAttr(env, id: int, data: dict = {})[source]#
Bases:
BaseAttrPoint cloud rendering class.
- SetRadius(radius: float)[source]#
Set the radius for points in a point cloud.
- Parameters:
radius β Float, the radius.
- ShowPointCloud(positions: ndarray = None, colors: ndarray = None, ply_path: str = None, radius: float = 0.01)[source]#
Display point cloud in Unity.
- Parameters:
positions β A list of positions of points in a point cloud.
colors β A list of colors of points (range [0, 1]) in a point cloud.
ply_path β Str, the absolute path of .ply file. If this parameter is specified, positions and colors will be ignored.
radius β Float, the radius of the point cloud.
pyrcareworld.attributes.rigidbody_attr module#
- class pyrcareworld.attributes.rigidbody_attr.RigidbodyAttr(env, id: int, data: dict = {})[source]#
Bases:
ColliderAttrRigid body class.
The data stored in self.data is a dictionary containing the following keys: - βvelocityβ: The velocity of the object. - βangular_velocityβ: The angular velocity of the object.
- AddForce(force: list)[source]#
Add force to this rigid body object.
- Parameters:
force β A list of length 3, representing the force added to this rigid body.
- EnabledMouseDrag(enabled: bool)[source]#
Enable or disable the rigid body Mouse Drag.
- Parameters:
enabled β Bool, enable Mouse Drag or not.
- Link(target_id: int, joint_index: int = 0, mass_scale: float = 1, connected_mass_scale: float = 1)[source]#
Link this rigidbody to another rigidbody or ArticulationBody.
- Parameters:
target_id β Int, the ID of another rigidbody or ControllerAttr.
joint_index β Int, the ID of the ControllerAttr joint.
mass_scale β Float, the scale to apply to the inverse mass and inertia tensor of the body prior to solving the constraints.
connected_mass_scale β Float, the scale to apply to the inverse mass and inertia tensor of the connected body prior to solving the constraints.
- SetAngularDrag(angular_drag: float)[source]#
Set the angular drag of this rigid body object.
- Parameters:
angular_drag β Float, representing the angular drag of this rigid body.
- SetAngularVelocity(angular_velocity: list)[source]#
Set the angular velocity of this rigid body object.
- Parameters:
angular_velocity β A list of length 3, representing the angular velocity of this rigid body.
- SetDrag(drag: float)[source]#
Set the drag of this rigid body object.
- Parameters:
drag β Float, representing the drag of this rigid body.
- SetKinematic(is_kinematic: bool)[source]#
Set the Rigidbody to be kinematic or not.
- Parameters:
is_kinematic β Bool, True if the Rigidbody is kinematic, False otherwise.
- SetMass(mass: float)[source]#
Set the mass of this rigid body object.
- Parameters:
mass β Float, representing the mass of this rigid body.