Object Interface¶
Object Interfaces for PyBullet simulations. They provide a convenient way to obtain object states and move objects in a simulation.
ObjectInterface¶
-
class
perls2.objects.object_interface.
ObjectInterface
Abstract interface to be implemented for each real and simulated robot.
BulletObjectInterface¶
-
class
perls2.objects.bullet_object_interface.
BulletObjectInterface
(physics_id, obj_id, name='object') Interface to objects in Pybullet.
-
physics_id
¶ physicsClientId from Pybullet
- Type
int
-
obj_id
¶ bodyId from Bullet loadURDF
- Type
int
-
name
¶ identifer for the object, best to keep unique.
- Type
str
-
position
¶ xyz position in world space
- Type
ndarray 3f
-
pose
¶ x,y,z,qx,qy,qz,w pose of the object in world frame.
- Type
ndarray 7f
-
linear_velocity
¶ linear vel. of object in world frame. xdot, ydot, zdot
- Type
ndarray 3f
-
angular_velocity
¶ ang. vel. of object in world frame. wx, wy, wz.
- Type
ndarray 3f
-
property
angular_velocity
Get the angular velocity of the body.
- Returns
A 3-dimensional float32 numpy array.
-
property
linear_velocity
Get the lienar velocity of the body.
- Parameters
body_uid – The body Unique ID.
- Returns
- Return type
A 3-dimensional float32 numpy array.
-
property
orientation
Orientation of object in world frame expressed as quaternion.
-
place
(new_object_pos=None, new_object_orn=None) Places object in new position and orientation.
- Parameters
new_object_pos (list) – 3f new positions for object in world frame.
new_object_orn (list) – 4f new object orientation as quaternion.
Notes
If new_object_pos is None, maintains original position. If new_object_orn is None, maintains original orientation. If both are None, does nothing.
-
property
pose
Pose of object in world frame. Expressed as list 7f position + quaternion.
[x, y, z, qx, qy, qz, w]
-
property
position
Get position of object in world frame.
Returns numpy array
-
reset
() Reset object to last placed pose.
-
set_angular_velocity
(des_angular_vel) Set linear velocity of object. Breaks physics
- Parameters
des_angular_vel (list 3f) – Desired angular velocity as wx, wy, wz
-
set_linear_velocity
(des_linear_vel) Set linear velocity of object. Breaks physics
-
set_orientation
(des_ori) Set position of object in world frame.
- Parameters
des_ori (list) – 4f orientation in world coordinates as quaternion.
- Returns
None
Note: does not check for collisions
-
set_pose
(des_pose) Set pose of object in world frame.
- Parameters
pose (list 7f) – [x,y,z,qx,qy,qz,w] pose in world coordinates
- Returns
None
Note: does not check for collisions
-
set_position
(des_position) Set position of object in world frame.
- Parameters
des_position (list 3f) – xyz position in world coordinates
- Returns
None
Note: does not check for collisions
-