File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040 # =========
4141
4242 # Kinematic tools can be moved with it's Configuration
43- # The gripper tool's open gripper state is at [0.025, 0.025]
44- robot_cell_state .tool_states [gripper .name ].configuration .joint_values = [0.025 , 0.025 ]
43+ # It can be convenient to predefine the open and closed states of a gripper
44+ opened_gripper_configuration = gripper .zero_configuration ()
45+ opened_gripper_configuration .joint_values = [0.025 , 0.025 ]
46+ closed_gripper_configuration = gripper .zero_configuration ()
47+ closed_gripper_configuration .joint_values = [0.0 , 0.0 ]
48+
49+ robot_cell_state .tool_states [gripper .name ].configuration = opened_gripper_configuration
4550
4651 # Calling `set_robot_cell_state` updates the robot cell in the planner
4752 result = planner .set_robot_cell_state (robot_cell_state )
Original file line number Diff line number Diff line change @@ -45,3 +45,18 @@ It's is defined relative to the TBCF and its transformation is defined in
4545The TCF is one of the three target reference that can be used as to create
4646:class: `compas_fab.robots.Target ` for inverse kinematics calculation and motion planning.
4747
48+ .. _tool_state :
49+
50+ Tool State
51+ ======================
52+
53+ The :class: `compas_fab.robots.ToolState ` class is used to represent the state of a
54+ tool, which includes the tool's configuration and its attachment relationship with the
55+ robot. The tool's configuration is intended to be changed easily by the user, for visualization
56+ and during planning of robot motions. For example, a gripper can be attached to the robot
57+ by setting the :attr: `ToolState.attached_to_group ` and the :attr: `ToolState.attachment_frame `
58+ attributes. A detached tool is considered to be stationary in the world coordinate frame (WCF)
59+ and its location is defined by the :attr: `ToolState.frame ` attribute.
60+
61+ For planning and collision detection purposes, the :attr: `ToolState.touch_links ` attribute
62+ is used to define the robot links that are allowed to collide with the tool.
Original file line number Diff line number Diff line change 22
33*******************************************************************************
44Kinematic Tool Model
5- *******************************************************************************
5+ *******************************************************************************
6+
7+ Kinematic tools are defined similar to defining a RobotsModel, with a set of
8+ :class: `compas_robots.Link ` and :class: `compas_robots.Joint ` objects. The Joints
9+ allow the tool to move and change shape, similar to how a robotic arm
10+ articulates.
11+
12+ The shape (configuration) of the tool is represented using a
13+ :class: `compas_robots.Configuration `, and is defined by setting
14+ :attr: `ToolState.configuration<compas_fab.robots.ToolState> `.
15+ It can be convenient for the user to define some known tool states, such as
16+ the open and closed states of a gripper, or the extended and retracted states of a
17+ pneumatic cylinder. These states can be defined in the user's code and can
18+ be used to set the tool's configuration in the :class: `ToolState ` object.
19+
20+ The following ROS example show how to set the configuration of a kinematic tool,
21+ the code for other backends are similar.
22+
23+ .. literalinclude :: ../../backends/ros/files/02_set_robot_cell_state_with_kinematic_tools.py
24+ :language: python
25+
You can’t perform that action at this time.
0 commit comments