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

Classes

class  ResetRequested
class  Phase

Functions

mjk.AttachmentSpec gripper_attachment (str gripper_path)
mjk.SceneObject cube_object ()
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)
list[float] solve_position_ik (kdl.Chain chain, list[float] seed_values, kdl.Frame target, list[tuple[float, float]] joint_limits)
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)
bool step_once (mjk.Env env, mjk.Robot robot, mjk.SimulateViewer|None viewer, dict state)
bool run_phase (mjk.Env env, mjk.Robot robot, Phase phase, mjk.SimulateViewer|None viewer, dict state)
int main ()

Variables

list HOME = [0.0, 0.2618, 3.1416, -2.2689, 0.0, 0.9599, 1.5708]
float CUBE_X = 0.40
float CUBE_Y = 0.00
float CUBE_HALF_SIZE = 0.02
float CUBE_Z = CUBE_HALF_SIZE
list KP = [100.0, 200.0, 100.0, 200.0, 100.0, 200.0, 100.0]
list KD = [10.0, 20.0, 10.0, 20.0, 10.0, 20.0, 10.0]

Detailed Description

Scripted floor pick example ported from src/examples/ex_pick.cpp.

Joint-impedance control (tau = Kp*e - Kd*qdot + g_kdl) drives scripted
waypoints to grasp and lift a cube. An Env on_reset hook re-homes the arm,
re-poses the cube, and opens the gripper, so the simulate-UI reset button
replays the whole pick.

Function Documentation

◆ apply_pd_gravity()

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

Definition at line 159 of file ex_pick.py.

Referenced by run_phase().

◆ as_list()

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

Definition at line 94 of file ex_pick.py.

Referenced by solve_position_ik().

◆ build_env()

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

Definition at line 63 of file ex_pick.py.

References cube_object(), and gripper_attachment().

Referenced by main().

◆ build_waypoints()

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

Definition at line 139 of file ex_pick.py.

References solve_position_ik().

Referenced by main().

◆ clamp()

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

Definition at line 98 of file ex_pick.py.

Referenced by clamp_joint(), and run_phase().

◆ clamp_joint()

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

Definition at line 102 of file ex_pick.py.

References clamp().

Referenced by solve_position_ik().

◆ cube_object()

mjk.SceneObject ex_pick.cube_object ( )

Definition at line 50 of file ex_pick.py.

Referenced by build_env().

◆ gripper_attachment()

mjk.AttachmentSpec ex_pick.gripper_attachment ( str gripper_path)

Definition at line 42 of file ex_pick.py.

Referenced by build_env().

◆ jnt()

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

Definition at line 87 of file ex_pick.py.

Referenced by solve_position_ik().

◆ lerp()

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

Definition at line 172 of file ex_pick.py.

Referenced by run_phase().

◆ main()

int ex_pick.main ( )

Definition at line 219 of file ex_pick.py.

References build_env(), build_waypoints(), main(), and run_phase().

Referenced by main().

◆ max_abs_joint_err()

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

Definition at line 168 of file ex_pick.py.

Referenced by run_phase().

◆ run_phase()

bool ex_pick.run_phase ( mjk.Env env,
mjk.Robot robot,
Phase phase,
mjk.SimulateViewer | None viewer,
dict state )

Definition at line 190 of file ex_pick.py.

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

Referenced by main().

◆ solve_position_ik()

list[float] ex_pick.solve_position_ik ( kdl.Chain chain,
list[float] seed_values,
kdl.Frame target,
list[tuple[float, float]] joint_limits )

Definition at line 109 of file ex_pick.py.

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

Referenced by build_waypoints().

◆ step_once()

bool ex_pick.step_once ( mjk.Env env,
mjk.Robot robot,
mjk.SimulateViewer | None viewer,
dict state )

Definition at line 176 of file ex_pick.py.

Referenced by run_phase().

Variable Documentation

◆ CUBE_HALF_SIZE

float ex_pick.CUBE_HALF_SIZE = 0.02

Definition at line 22 of file ex_pick.py.

◆ CUBE_X

float ex_pick.CUBE_X = 0.40

Definition at line 20 of file ex_pick.py.

◆ CUBE_Y

float ex_pick.CUBE_Y = 0.00

Definition at line 21 of file ex_pick.py.

◆ CUBE_Z

float ex_pick.CUBE_Z = CUBE_HALF_SIZE

Definition at line 23 of file ex_pick.py.

◆ HOME

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

Definition at line 19 of file ex_pick.py.

◆ KD

list ex_pick.KD = [10.0, 20.0, 10.0, 20.0, 10.0, 20.0, 10.0]

Definition at line 25 of file ex_pick.py.

◆ KP

list ex_pick.KP = [100.0, 200.0, 100.0, 200.0, 100.0, 200.0, 100.0]

Definition at line 24 of file ex_pick.py.