Skip to content

hylo.manip.planning

Package: hylo-manip · Core contracts

planning

Motion planning for goals: IK over seeds, a collision-free joint path (straight interpolation, else RRT-Connect with shortcut smoothing), a straight Cartesian final approach, hand commands, and time parameterisation to control steps under per-joint velocity and acceleration limits.

LINE_VERBS module-attribute

LINE_VERBS = ('lift', 'retreat', 'push', 'press')

PlannerConfig dataclass

PlannerConfig(control_hz: float = 20.0, max_vel: Any = 1.0, max_acc: Any = 2.0, hand_time: float = 1.0, margin: float = 0.01, table_clearance: float = 0.01, approach_clearance: float = 0.002, self_filter: float = 0.03, near_hand: float = 0.08, line_step: float = 0.01, line_jump: float = 0.25, edge_res: float = 0.03, rrt_step: float = 0.2, rrt_iters: int = 3000, rrt_time: float = 10.0, shortcut_iters: int = 60, ik_random: int = 12, ik_random_more: int = 48, ik_solutions: int = 4, seed: int = 0)

control_hz class-attribute instance-attribute

control_hz: float = 20.0

max_vel class-attribute instance-attribute

max_vel: Any = 1.0

max_acc class-attribute instance-attribute

max_acc: Any = 2.0

hand_time class-attribute instance-attribute

hand_time: float = 1.0

margin class-attribute instance-attribute

margin: float = 0.01

table_clearance class-attribute instance-attribute

table_clearance: float = 0.01

approach_clearance class-attribute instance-attribute

approach_clearance: float = 0.002

self_filter class-attribute instance-attribute

self_filter: float = 0.03

near_hand class-attribute instance-attribute

near_hand: float = 0.08

line_step class-attribute instance-attribute

line_step: float = 0.01

line_jump class-attribute instance-attribute

line_jump: float = 0.25

edge_res class-attribute instance-attribute

edge_res: float = 0.03

rrt_step class-attribute instance-attribute

rrt_step: float = 0.2

rrt_iters class-attribute instance-attribute

rrt_iters: int = 3000

rrt_time class-attribute instance-attribute

rrt_time: float = 10.0

shortcut_iters class-attribute instance-attribute

shortcut_iters: int = 60

ik_random class-attribute instance-attribute

ik_random: int = 12

ik_random_more class-attribute instance-attribute

ik_random_more: int = 48

ik_solutions class-attribute instance-attribute

ik_solutions: int = 4

seed class-attribute instance-attribute

seed: int = 0

Attempt dataclass

Attempt(path: list[ndarray] = list(), info: dict[str, Any] = dict(), why: str = '')

path class-attribute instance-attribute

path: list[ndarray] = field(default_factory=list)

info class-attribute instance-attribute

info: dict[str, Any] = field(default_factory=dict)

why class-attribute instance-attribute

why: str = ''

Planner

Planner(kin: Kinematics, colliders: dict[str, Collider], cfg: PlannerConfig)

robot_points

robot_points(q: dict[str, ndarray], hand: dict[str, Any]) -> dict[str, np.ndarray]

What cameras see of each robot model (every geom of its bodies, fixed base included) at the given joints, per arm; arms sharing a model are posed together and reported once.

obstacles

obstacles(arm: str, q_now: dict[str, ndarray], hand_now: dict[str, Any], table: float | None, scene: ndarray | None, seen_at: Sequence[tuple[dict, dict]] = (), attached: ndarray | None = None) -> Obstacles

Observed points minus the table, the robot (now and at seen_at, the configurations the points were observed in) and what the hand holds (points near the TCP; with attached, points held in the TCP frame, within reach of those points where they are now); arms of other models added as points.

arms_clear

arms_clear(q: dict[str, ndarray], hand: dict[str, Any]) -> str | None

None when the arms at joints q touch neither each other nor the rest of the robot, else a description. Arms in one model: MuJoCo contacts among robot geoms (pairs touching at home and pairs within one hand excepted); arms in different models: each arm's collision samples against the others' surfaces.

edge_free

edge_free(c: Collider, a, b, obs: Obstacles) -> bool

connect

connect(c: Collider, q0, q1, obs: Obstacles, rng) -> tuple[list[np.ndarray] | None, str]

rrt_connect

rrt_connect(c: Collider, q0, q1, obs: Obstacles, rng) -> list[np.ndarray] | None

shortcut

shortcut(c: Collider, path: list[ndarray], obs: Obstacles, rng) -> list[np.ndarray]

line

line(c: Collider, q_start, T0: ndarray, T1: ndarray, obs: Obstacles) -> list[np.ndarray] | None

Joint path following the straight TCP line T0 -> T1 (position lerp, rotation slerp) from q_start. A step whose IK solution jumps more than line_jump is subdivided (up to 16 times finer) before giving up: near joint limits and singular postures the joints move fast per centimetre of TCP travel.

plan_goal

plan_goal(goal, q_now: dict[str, ndarray], hand_now: dict[str, Any], table: float | None, scene: ndarray | None, attached: ndarray | None = None, seen_at: Sequence[tuple[dict, dict]] = ()) -> Attempt

actions

actions(goal, path: list[ndarray], q_now: dict[str, ndarray], hand_keep: dict[str, Any], action_dim: int) -> tuple[np.ndarray, dict[str, Any]]

Timed (T, action_dim) rows: the arm follows the path with hand_before, then holds with hand.

time_parameterize

time_parameterize(path: Sequence[ndarray], vmax: ndarray, amax: ndarray, dt: float) -> np.ndarray

Positions at t = dt, 2 dt, ... along a piecewise-linear joint path, starting and ending at rest, whose finite differences stay within vmax and amax (the profile is slowed down until they do).

check_limits

check_limits(traj: ndarray, q0: ndarray, vmax: ndarray, amax: ndarray, dt: float) -> tuple[float, float]

Largest ratio of finite-difference velocity and acceleration to the limits (starting and ending at rest).

retime_together

retime_together(paths: dict[str, Sequence[ndarray]], kin: Kinematics, vmax: dict[str, ndarray], amax: dict[str, ndarray], dt: float, min_steps: int = 2) -> dict[str, np.ndarray]

Joint trajectories of several arms that start and stop together and keep their TCPs in step: each path is parameterised by its TCP travel (plus a little joint travel, for turns on the spot), and every arm follows one shared minimum-jerk progress profile, lengthened until every arm keeps its velocity and acceleration limits.