Mujoco KDL Wrapper  0.5.1
MuJoCo + KDL bridge for robot kinematics and dynamics
Loading...
Searching...
No Matches
ex_table_pour Namespace Reference

Classes

class  Phase
class  ResetRequested

Functions

mjk.AttachmentSpec gripper_attachment (str gripper_path)
mjk.AttachmentSpec bottle_attachment (str bottle_path)
mjk.SceneObject table_object (str table_path)
mjk.SceneObject receiver_object (str receiver_path)
mjk.SceneObject ball_object (int index)
tuple[mjk.Env, mjk.Robot] build_env ()
kdl.JntArray jnt (list[float] values)
list[float] as_list (kdl.JntArray q)
float clamp (float value, float low, float high)
tuple[kdl.JntArray, kdl.JntArray] joint_limit_arrays (mjk.Robot robot)
dict[str, list[float]] build_waypoints (mjk.Env env, mjk.Robot robot)
list[float] gravity (kdl.ChainDynParam dyn, q_values)
None pd_gravity (mjk.Robot robot, kdl.ChainDynParam dyn, list[float] target)
float max_abs_joint_err (mjk.Robot robot, list[float] target)
list[float] lerp (list[float] start, list[float] target, float alpha)
None place_balls_in_bottle (mjk.Env env, mjk.Robot robot)
tuple[int, list[float]] balls_in_receiver (mjk.Env env)
bool run_phase (env, robot, fingers, dyn, Phase phase, dict state)
int main ()

Variables

list HOME = [0.0, 0.2618, 3.1416, -2.2689, 0.0, 0.9599, 1.5708]
float TABLE_Z = 0.70
float ROBOT_BACK_X = -0.26
float JUG_X = 0.30
float JUG_Y = 0.14
float RETREAT_X = JUG_X - 0.08
float RETREAT_Y = JUG_Y - 0.08
float JUG_RADIUS = 0.028
float JUG_HEIGHT = 0.084
float BALL_RADIUS = 0.007
int NUM_BALLS = 36
float POUR_TILT_RAD = 1.95
float TILT_OUTLET_Z = TABLE_Z + 0.18
float GRIPPER_CLOSED = 0.82
int MIN_IN_RECEIVER = 24
int IK_TOL = 3e-3
list KP = [120.0, 220.0, 120.0, 220.0, 110.0, 190.0, 90.0]
list KD = [12.0, 22.0, 12.0, 22.0, 11.0, 18.0, 9.0]

Detailed Description

Pour balls into a tabletop receiver; Python counterpart of src/examples/ex_table_pour.cpp.

Headless, it exits 1 if fewer than MIN_IN_RECEIVER balls land in the receiver; --record [out.mp4]
also writes a 1080p MP4 through VideoRecorder (EGL + ffmpeg).

Function Documentation

◆ as_list()

list[float] ex_table_pour.as_list ( kdl.JntArray q)

Definition at line 132 of file ex_table_pour.py.

Referenced by build_waypoints().

◆ ball_object()

mjk.SceneObject ex_table_pour.ball_object ( int index)

Definition at line 84 of file ex_table_pour.py.

Referenced by build_env().

◆ balls_in_receiver()

tuple[int, list[float]] ex_table_pour.balls_in_receiver ( mjk.Env env)

Definition at line 259 of file ex_table_pour.py.

Referenced by main().

◆ bottle_attachment()

mjk.AttachmentSpec ex_table_pour.bottle_attachment ( str bottle_path)

Definition at line 59 of file ex_table_pour.py.

Referenced by build_env().

◆ build_env()

tuple[mjk.Env, mjk.Robot] ex_table_pour.build_env ( )

Definition at line 97 of file ex_table_pour.py.

References ball_object(), bottle_attachment(), gripper_attachment(), receiver_object(), and table_object().

Referenced by main().

◆ build_waypoints()

dict[str, list[float]] ex_table_pour.build_waypoints ( mjk.Env env,
mjk.Robot robot )

Definition at line 151 of file ex_table_pour.py.

References as_list(), jnt(), and joint_limit_arrays().

Referenced by main().

◆ clamp()

float ex_table_pour.clamp ( float value,
float low,
float high )

Definition at line 136 of file ex_table_pour.py.

Referenced by run_phase().

◆ gravity()

list[float] ex_table_pour.gravity ( kdl.ChainDynParam dyn,
q_values )

Definition at line 223 of file ex_table_pour.py.

References jnt().

Referenced by main(), and pd_gravity().

◆ gripper_attachment()

mjk.AttachmentSpec ex_table_pour.gripper_attachment ( str gripper_path)

Definition at line 51 of file ex_table_pour.py.

Referenced by build_env().

◆ jnt()

kdl.JntArray ex_table_pour.jnt ( list[float] values)

Definition at line 125 of file ex_table_pour.py.

Referenced by build_waypoints(), and gravity().

◆ joint_limit_arrays()

tuple[kdl.JntArray, kdl.JntArray] ex_table_pour.joint_limit_arrays ( mjk.Robot robot)

Definition at line 140 of file ex_table_pour.py.

Referenced by build_waypoints().

◆ lerp()

list[float] ex_table_pour.lerp ( list[float] start,
list[float] target,
float alpha )

Definition at line 241 of file ex_table_pour.py.

Referenced by run_phase().

◆ main()

int ex_table_pour.main ( )

◆ max_abs_joint_err()

float ex_table_pour.max_abs_joint_err ( mjk.Robot robot,
list[float] target )

Definition at line 237 of file ex_table_pour.py.

Referenced by run_phase().

◆ pd_gravity()

None ex_table_pour.pd_gravity ( mjk.Robot robot,
kdl.ChainDynParam dyn,
list[float] target )

Definition at line 229 of file ex_table_pour.py.

References gravity().

Referenced by run_phase().

◆ place_balls_in_bottle()

None ex_table_pour.place_balls_in_bottle ( mjk.Env env,
mjk.Robot robot )

Definition at line 245 of file ex_table_pour.py.

Referenced by main().

◆ receiver_object()

mjk.SceneObject ex_table_pour.receiver_object ( str receiver_path)

Definition at line 76 of file ex_table_pour.py.

Referenced by build_env().

◆ run_phase()

bool ex_table_pour.run_phase ( env,
robot,
fingers,
dyn,
Phase phase,
dict state )
One update() per step: it reads the state and applies the previous cycle's command.

Definition at line 275 of file ex_table_pour.py.

References clamp(), lerp(), max_abs_joint_err(), and pd_gravity().

Referenced by main().

◆ table_object()

mjk.SceneObject ex_table_pour.table_object ( str table_path)

Definition at line 67 of file ex_table_pour.py.

Referenced by build_env().

Variable Documentation

◆ BALL_RADIUS

float ex_table_pour.BALL_RADIUS = 0.007

Definition at line 26 of file ex_table_pour.py.

◆ GRIPPER_CLOSED

float ex_table_pour.GRIPPER_CLOSED = 0.82

Definition at line 30 of file ex_table_pour.py.

◆ HOME

list ex_table_pour.HOME = [0.0, 0.2618, 3.1416, -2.2689, 0.0, 0.9599, 1.5708]

Definition at line 17 of file ex_table_pour.py.

◆ IK_TOL

int ex_table_pour.IK_TOL = 3e-3

Definition at line 32 of file ex_table_pour.py.

◆ JUG_HEIGHT

float ex_table_pour.JUG_HEIGHT = 0.084

Definition at line 25 of file ex_table_pour.py.

◆ JUG_RADIUS

float ex_table_pour.JUG_RADIUS = 0.028

Definition at line 24 of file ex_table_pour.py.

◆ JUG_X

float ex_table_pour.JUG_X = 0.30

Definition at line 20 of file ex_table_pour.py.

◆ JUG_Y

float ex_table_pour.JUG_Y = 0.14

Definition at line 21 of file ex_table_pour.py.

◆ KD

list ex_table_pour.KD = [12.0, 22.0, 12.0, 22.0, 11.0, 18.0, 9.0]

Definition at line 34 of file ex_table_pour.py.

◆ KP

list ex_table_pour.KP = [120.0, 220.0, 120.0, 220.0, 110.0, 190.0, 90.0]

Definition at line 33 of file ex_table_pour.py.

◆ MIN_IN_RECEIVER

int ex_table_pour.MIN_IN_RECEIVER = 24

Definition at line 31 of file ex_table_pour.py.

◆ NUM_BALLS

int ex_table_pour.NUM_BALLS = 36

Definition at line 27 of file ex_table_pour.py.

◆ POUR_TILT_RAD

float ex_table_pour.POUR_TILT_RAD = 1.95

Definition at line 28 of file ex_table_pour.py.

◆ RETREAT_X

float ex_table_pour.RETREAT_X = JUG_X - 0.08

Definition at line 22 of file ex_table_pour.py.

◆ RETREAT_Y

float ex_table_pour.RETREAT_Y = JUG_Y - 0.08

Definition at line 23 of file ex_table_pour.py.

◆ ROBOT_BACK_X

float ex_table_pour.ROBOT_BACK_X = -0.26

Definition at line 19 of file ex_table_pour.py.

◆ TABLE_Z

float ex_table_pour.TABLE_Z = 0.70

Definition at line 18 of file ex_table_pour.py.

◆ TILT_OUTLET_Z

float ex_table_pour.TILT_OUTLET_Z = TABLE_Z + 0.18

Definition at line 29 of file ex_table_pour.py.