Mujoco KDL Wrapper  0.2.2
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)
float clamp_joint (float value, tuple[float, float] limit)
tuple[kdl.JntArray, kdl.JntArray] joint_limit_arrays (mjk.Robot robot)
dict[str, list[float]] build_waypoints (mjk.Env env, mjk.Robot robot)
None apply_pd_gravity (mjk.Robot robot, 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 step_once (mjk.Robot robot, mjk.SimulateViewer|None viewer)
bool run_phase (mjk.Env env, mjk.Robot robot, Phase phase, mjk.SimulateViewer|None viewer, mjk.VideoRecorder|None recorder, int record_every, list[int] step_counter, 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 BALL_RADIUS = 0.007
int NUM_BALLS = 36
float POUR_TILT_RAD = 1.95
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

Table pour example ported from src/examples/ex_table_pour.cpp.

Function Documentation

◆ apply_pd_gravity()

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

Definition at line 207 of file ex_table_pour.py.

Referenced by run_phase().

◆ as_list()

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

Definition at line 125 of file ex_table_pour.py.

Referenced by build_waypoints().

◆ ball_object()

mjk.SceneObject ex_table_pour.ball_object ( int index)

Definition at line 75 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 238 of file ex_table_pour.py.

Referenced by main().

◆ bottle_attachment()

mjk.AttachmentSpec ex_table_pour.bottle_attachment ( str bottle_path)

Definition at line 50 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 88 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(), clamp_joint(), jnt(), and joint_limit_arrays().

Referenced by main().

◆ clamp()

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

Definition at line 129 of file ex_table_pour.py.

Referenced by clamp_joint(), and run_phase().

◆ clamp_joint()

float ex_table_pour.clamp_joint ( float value,
tuple[float, float] limit )

Definition at line 133 of file ex_table_pour.py.

References clamp().

Referenced by build_waypoints().

◆ gripper_attachment()

mjk.AttachmentSpec ex_table_pour.gripper_attachment ( str gripper_path)

Definition at line 42 of file ex_table_pour.py.

Referenced by build_env().

◆ jnt()

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

Definition at line 118 of file ex_table_pour.py.

Referenced by build_waypoints().

◆ 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 220 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 216 of file ex_table_pour.py.

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 224 of file ex_table_pour.py.

Referenced by main().

◆ receiver_object()

mjk.SceneObject ex_table_pour.receiver_object ( str receiver_path)

Definition at line 67 of file ex_table_pour.py.

Referenced by build_env().

◆ run_phase()

bool ex_table_pour.run_phase ( mjk.Env env,
mjk.Robot robot,
Phase phase,
mjk.SimulateViewer | None viewer,
mjk.VideoRecorder | None recorder,
int record_every,
list[int] step_counter,
dict state )

Definition at line 260 of file ex_table_pour.py.

References apply_pd_gravity(), clamp(), lerp(), max_abs_joint_err(), and step_once().

Referenced by main().

◆ step_once()

bool ex_table_pour.step_once ( mjk.Robot robot,
mjk.SimulateViewer | None viewer )

Definition at line 254 of file ex_table_pour.py.

Referenced by run_phase().

◆ table_object()

mjk.SceneObject ex_table_pour.table_object ( str table_path)

Definition at line 58 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 20 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 13 of file ex_table_pour.py.

◆ IK_TOL

int ex_table_pour.IK_TOL = 3e-3

Definition at line 23 of file ex_table_pour.py.

◆ JUG_X

float ex_table_pour.JUG_X = 0.30

Definition at line 16 of file ex_table_pour.py.

◆ JUG_Y

float ex_table_pour.JUG_Y = 0.14

Definition at line 17 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 25 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 24 of file ex_table_pour.py.

◆ NUM_BALLS

int ex_table_pour.NUM_BALLS = 36

Definition at line 21 of file ex_table_pour.py.

◆ POUR_TILT_RAD

float ex_table_pour.POUR_TILT_RAD = 1.95

Definition at line 22 of file ex_table_pour.py.

◆ RETREAT_X

float ex_table_pour.RETREAT_X = JUG_X - 0.08

Definition at line 18 of file ex_table_pour.py.

◆ RETREAT_Y

float ex_table_pour.RETREAT_Y = JUG_Y - 0.08

Definition at line 19 of file ex_table_pour.py.

◆ ROBOT_BACK_X

float ex_table_pour.ROBOT_BACK_X = -0.26

Definition at line 15 of file ex_table_pour.py.

◆ TABLE_Z

float ex_table_pour.TABLE_Z = 0.70

Definition at line 14 of file ex_table_pour.py.