Move to end-effector posesΒΆ
Move to individual end-effector poses, then follow a sequence of poses in a square.
With avoid_obstacles=False, the planner computes a direct
point-to-point trajectory and fails if that trajectory collides with the
planning scene.
Set avoid_obstacles=True to search for a collision-free
path around obstacles instead. This search may take longer and produce a less
direct trajectory.
from olo import Client
from olo.spatial import Point, Pose
POSE_OFFSET = 0.1
with Client() as client:
robot = client.robot()
arm = robot.kinematics
# Read the current end-effector pose.
start = arm.pose()
# Move along the x-axis without obstacle avoidance.
target = Pose(
position=Point(
x=start.position.x + POSE_OFFSET,
y=start.position.y,
z=start.position.z,
),
orientation=start.orientation,
)
arm.move_pose(target, avoid_obstacles=False)
# Move along the y-axis with obstacle avoidance.
target = Pose(
position=Point(
x=start.position.x + POSE_OFFSET,
y=start.position.y + POSE_OFFSET,
z=start.position.z,
),
orientation=start.orientation,
)
arm.move_pose(target, avoid_obstacles=True)
# Follow a pose sequence in a square.
poses = (
Pose(
position=Point(
x=start.position.x + POSE_OFFSET,
y=start.position.y + POSE_OFFSET,
z=start.position.z + POSE_OFFSET,
),
orientation=start.orientation,
),
Pose(
position=Point(
x=start.position.x + POSE_OFFSET,
y=start.position.y,
z=start.position.z + POSE_OFFSET,
),
orientation=start.orientation,
),
Pose(
position=Point(
x=start.position.x + POSE_OFFSET,
y=start.position.y,
z=start.position.z,
),
orientation=start.orientation,
),
)
arm.move_pose_sequence(poses)
# Return to the starting pose.
arm.move_pose(start)
import { Point, Pose } from "olo/spatial";
import { connect } from "olo/web";
const POSE_OFFSET = 0.1;
const client = connect();
const robot = await client.robot();
const arm = robot.kinematics;
// Read the current end-effector pose.
const start = await arm.pose();
// Move along the x-axis without obstacle avoidance.
let target = new Pose(
new Point(start.position.x + POSE_OFFSET, start.position.y, start.position.z),
start.orientation,
);
await arm.movePose(target, { avoidObstacles: false });
// Move along the y-axis with obstacle avoidance.
target = new Pose(
new Point(
start.position.x + POSE_OFFSET,
start.position.y + POSE_OFFSET,
start.position.z,
),
start.orientation,
);
await arm.movePose(target, { avoidObstacles: true });
// Follow a pose sequence in a square.
const poses = [
new Pose(
new Point(
start.position.x + POSE_OFFSET,
start.position.y + POSE_OFFSET,
start.position.z + POSE_OFFSET,
),
start.orientation,
),
new Pose(
new Point(
start.position.x + POSE_OFFSET,
start.position.y,
start.position.z + POSE_OFFSET,
),
start.orientation,
),
new Pose(
new Point(
start.position.x + POSE_OFFSET,
start.position.y,
start.position.z,
),
start.orientation,
),
];
await arm.movePoseSequence(poses);
// Return to the starting pose.
await arm.movePose(start);