-
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.
Preparing for PybulletPlanCartesianMotion
- Loading branch information
Showing
7 changed files
with
368 additions
and
223 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
docs/examples/05_backends_pybullet/files/04_plan_cartesian_motion.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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import compas_fab | ||
from compas_robots import Configuration | ||
from compas_fab.backends import PyBulletClient | ||
from compas_fab.backends import PyBulletPlanner | ||
from compas_fab.robots import RobotCell | ||
from compas_fab.robots import RobotCellState | ||
from compas_fab.robots import RobotLibrary | ||
|
||
|
||
# ############################################# | ||
# Headless (no-GUI) forwards kinematics example | ||
# ############################################# | ||
|
||
# 'direct' mode | ||
with PyBulletClient("direct") as client: | ||
# The robot in this example is loaded from a URDF file | ||
robot = RobotLibrary.ur5() | ||
planner = PyBulletPlanner(client) | ||
|
||
# This is a simple robot cell with only the robot | ||
robot_cell = RobotCell(robot) | ||
planner.set_robot_cell(robot_cell) | ||
|
||
# Create the starting configuration | ||
configuration = Configuration.from_revolute_values([-2.238, -1.153, -2.174, 0.185, 0.667, 0.0]) | ||
# The `RobotCellState.from_robot_configuration` method can be used when the robot is the only element in the cell | ||
robot_cell_state = RobotCellState.from_robot_configuration(robot, configuration) | ||
# In this demo, the default planning group is used for the forward kinematics | ||
frame_WCF = planner.forward_kinematics(robot_cell_state) | ||
|
||
# Set the start and goal frames | ||
start_frame = Frame([0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]) | ||
goal_frame = Frame([1.0, 1.0, 1.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]) | ||
|
||
# Create a planner | ||
planner = client.get_planner() | ||
|
||
# Plan a cartesian motion using the pybullet backend | ||
trajectory = planner.plan_cartesian_motion(robot, start_frame, goal_frame) | ||
|
||
# Execute the planned trajectory | ||
client.execute_trajectory(robot, trajectory) |
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
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
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
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.