-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip - planner.ik with target and start_state
- Loading branch information
Showing
20 changed files
with
768 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 10 additions & 2 deletions
12
docs/examples/03_backends_ros/files/03_inverse_kinematics.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
from compas.geometry import Frame | ||
from compas_fab.backends import RosClient | ||
from compas_fab.backends import MoveItPlanner | ||
|
||
from compas_fab.robots import FrameTarget | ||
from compas_fab.robots import RobotCellState | ||
|
||
with RosClient() as client: | ||
robot = client.load_robot() | ||
assert robot.name == 'ur5_robot' | ||
assert robot.name == "ur5_robot" | ||
planner = MoveItPlanner(client) | ||
|
||
frame_WCF = Frame([0.3, 0.1, 0.5], [1, 0, 0], [0, 1, 0]) | ||
target = FrameTarget(frame_WCF) | ||
|
||
start_configuration = robot.zero_configuration() | ||
start_state = RobotCellState.from_robot_configuration(robot, start_configuration) | ||
|
||
configuration = robot.inverse_kinematics(frame_WCF, start_configuration) | ||
configuration = planner.inverse_kinematics(target, start_state) | ||
|
||
print("Found configuration", configuration) |
15 changes: 13 additions & 2 deletions
15
docs/examples/03_backends_ros/files/03_iter_inverse_kinematics.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
from compas.geometry import Frame | ||
from compas_fab.backends import RosClient | ||
from compas_fab.backends import MoveItPlanner | ||
|
||
from compas_fab.robots import FrameTarget | ||
from compas_fab.robots import RobotCellState | ||
|
||
with RosClient() as client: | ||
robot = client.load_robot() | ||
assert robot.name == 'ur5_robot' | ||
assert robot.name == "ur5_robot" | ||
planner = MoveItPlanner(client) | ||
|
||
frame_WCF = Frame([0.3, 0.1, 0.5], [1, 0, 0], [0, 1, 0]) | ||
target = FrameTarget(frame_WCF) | ||
|
||
start_configuration = robot.zero_configuration() | ||
start_state = RobotCellState.from_robot_configuration(robot, start_configuration) | ||
|
||
for config in robot.iter_inverse_kinematics(frame_WCF, start_configuration, options=dict(max_results=10)): | ||
result_count = 0 | ||
for config in planner.iter_inverse_kinematics(target, start_state, options=dict(max_results=10)): | ||
print("Found configuration", config) | ||
result_count += 1 | ||
print("Found %d configurations" % result_count) |
12 changes: 10 additions & 2 deletions
12
docs/examples/05_backends_pybullet/files/02_inverse_kinematics.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
import compas_fab | ||
from compas.geometry import Frame | ||
from compas_fab.backends import PyBulletClient | ||
from compas_fab.backends import PyBulletPlanner | ||
|
||
from compas_fab.robots import FrameTarget | ||
from compas_fab.robots import RobotCellState | ||
|
||
with PyBulletClient() as client: | ||
urdf_filename = compas_fab.get('robot_library/ur5_robot/urdf/robot_description.urdf') | ||
urdf_filename = compas_fab.get("robot_library/ur5_robot/urdf/robot_description.urdf") | ||
robot = client.load_robot(urdf_filename) | ||
planner = PyBulletPlanner(client) | ||
|
||
frame_WCF = Frame([0.3, 0.1, 0.5], [1, 0, 0], [0, 1, 0]) | ||
target = FrameTarget(frame_WCF) | ||
|
||
start_configuration = robot.zero_configuration() | ||
start_state = RobotCellState.from_robot_configuration(robot, start_configuration) | ||
|
||
configuration = robot.inverse_kinematics(frame_WCF, start_configuration) | ||
configuration = planner.inverse_kinematics(target, start_state) | ||
|
||
print("Found configuration", configuration) |
19 changes: 15 additions & 4 deletions
19
docs/examples/05_backends_pybullet/files/02_iter_inverse_kinematics.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import compas_fab | ||
from compas.geometry import Frame | ||
from compas_fab.backends import PyBulletClient | ||
from compas_fab.backends import PyBulletPlanner | ||
|
||
with PyBulletClient(connection_type='direct') as client: | ||
urdf_filename = compas_fab.get('robot_library/ur5_robot/urdf/robot_description.urdf') | ||
from compas_fab.robots import FrameTarget | ||
from compas_fab.robots import RobotCellState | ||
|
||
with PyBulletClient(connection_type="direct") as client: | ||
urdf_filename = compas_fab.get("robot_library/ur5_robot/urdf/robot_description.urdf") | ||
robot = client.load_robot(urdf_filename) | ||
planner = PyBulletPlanner(client) | ||
|
||
frame_WCF = Frame([0.3, 0.1, 0.5], [1, 0, 0], [0, 1, 0]) | ||
target = FrameTarget(frame_WCF) | ||
|
||
start_configuration = robot.zero_configuration() | ||
start_state = RobotCellState.from_robot_configuration(robot, start_configuration) | ||
|
||
options = dict(max_results=20, high_accuracy_threshold=1e-6, high_accuracy_max_iter=20) | ||
for config in robot.iter_inverse_kinematics(frame_WCF, start_configuration, options=options): | ||
options = dict(max_results=20, high_accuracy_threshold=1e-4, high_accuracy_max_iter=20) | ||
result_count = 0 | ||
for config in planner.iter_inverse_kinematics(target, start_state, options=options): | ||
print("Found configuration", config) | ||
result_count += 1 | ||
print("Found %d configurations" % result_count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.