forked from compas-teaching/COMPAS-II-FS2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path311_plan_motion_ros.py
27 lines (18 loc) · 991 Bytes
/
311_plan_motion_ros.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import math
from compas_fab.backends import RosClient
from helpers import show_trajectory
from compas.geometry import Frame
with RosClient("localhost") as client:
robot = client.load_robot()
group = robot.main_group_name
frame = Frame((0.4, 0.3, 0.05), (-1, 0, 0), (0, 1, 0))
tolerance_position = 0.001
tolerance_axes = [math.radians(1)] * 3
start_configuration = robot.zero_configuration()
start_configuration.joint_values = (-0.106, 5.351, 2.231, -2.869, 4.712, 1.465)
# create goal constraints from frame
goal_constraints = robot.constraints_from_frame(frame, tolerance_position, tolerance_axes, group)
trajectory = robot.plan_motion(goal_constraints, start_configuration, group, options=dict(planner_id="RRT"))
print("Computed kinematic path with %d configurations." % len(trajectory.points))
print("Executing this path at full speed would take approx. %.3f seconds." % trajectory.time_from_start)
show_trajectory(trajectory)