Skip to content

Commit

Permalink
Added some checks in the example file
Browse files Browse the repository at this point in the history
  • Loading branch information
yck011522 committed Nov 4, 2024
1 parent 9488711 commit 34074a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/examples/03_backends_ros/files/03_forward_kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

robot_cell_state = RobotCellState.from_robot_cell(robot_cell)
robot_cell_state.robot_configuration.joint_values = [-2.238, -1.153, -2.174, 0.185, 0.667, 0.0]

# When using the forward_kinematics() method with TargetMode.ROBOT, the last link of the robot's main group is used.
frame_WCF = planner.forward_kinematics(robot_cell_state, TargetMode.ROBOT)

print("Frame in the world coordinate system")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
from compas_fab.backends import MoveItPlanner

with RosClient() as client:
planner = MoveItPlanner(client)

# Loading the robot cell with tool and workpiece from the RobotCellLibrary
robot_cell, robot_cell_state = RobotCellLibrary.ur5_gripper_one_beam(client)

planner = MoveItPlanner(client)
# Check that the robot in the ROS MoveIt backend is the same as the one in the RobotCellLibrary
client.load_robot_cell(False)
assert client.robot_cell.root_name == robot_cell.root_name

# Set the tool and workpiece in the ROS MoveIt backend
planner.set_robot_cell(robot_cell)

# Modify the default robot_cell_state to change the robot's configuration and the attachment location of the beam
robot_cell_state.robot_configuration.joint_values = [-2.238, -1.153, -2.174, 0.185, 0.667, 0.0]
# Change the attachment location (grasp) of the beam
robot_cell_state.rigid_body_states["beam"].attachment_frame = Frame(
[0.0, 0.0, -0.1], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]
)
Expand Down

0 comments on commit 34074a1

Please sign in to comment.