Skip to content

Commit aa510f5

Browse files
authored
Merge pull request #368 from compas-dev/update-docs
Small updates to collision objects in ROS
2 parents f546e3b + 4dd2e89 commit aa510f5

14 files changed

+4459
-54
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Unreleased
1414

1515
* Added support for attached and non-attached collision mesh visualization to the ``Robot Visualize`` GH component.
1616
* Added a prefix to all GH components.
17+
* Added ``append`` to the operations of the ``Collision Mesh`` GH component.
1718

1819
**Changed**
1920

docs/examples/03_backends_ros/05_collision_objects.rst

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,28 @@ Planning scene and collision objects
55
.. note::
66

77
The following examples use the `ROS <https://www.ros.org/>`_ backend
8-
and the MoveIt! planner for UR5 robots. Before running them, please
8+
and the MoveIt! planner for UR5e robots. Before running them, please
99
make sure you have the :ref:`ROS backend <ros_backend>` correctly
10-
configured and the :ref:`UR5 Demo <ros_bundles_list>` started.
10+
configured and the :ref:`UR5e Demo <ros_bundles_list>` started.
11+
12+
There are two types of collision meshes:
13+
1. Non-attached collision meshes
14+
2. Attached collision meshes
1115

1216
To plan motion paths that avoid collisions with other objects than the robot
1317
itself, the backend's planning scene has to be updated.
1418

15-
This is the representation of the planning scene in RViz with the UR5.
19+
After the planner starts, the scene will only contain the robot:
1620

17-
.. figure:: files/05_collision_objects_attached_without.jpg
21+
.. figure:: files/05_collision_objects_attached_empty.jpg
1822
:figclass: figure
1923
:class: figure-img img-fluid
2024

21-
.. note::
22-
23-
If using Docker to run ROS, you can open
24-
`RViz on your browser <http://localhost:8080/vnc.html?resize=scale&autoconnect=true>`_.
25+
1. Non-attached Collision meshes
26+
================================
2527

26-
Collision meshes
27-
================
28+
Add/remove a single mesh
29+
------------------------
2830

2931
The following script adds and then removes a floor to the planning scene.
3032

@@ -37,6 +39,9 @@ The backend's updated planning scene while executing the above script.
3739
:figclass: figure
3840
:class: figure-img img-fluid
3941

42+
Add/remove several meshes
43+
-------------------------
44+
4045
The following script adds several boxes (bricks) to the planning scene. Here,
4146
we use ``append`` instead of ``add`` to have multiple collision objects
4247
clustered under the same identifier. Like that, we don't need to keep track of
@@ -45,26 +50,51 @@ all identifiers when we later remove them.
4550
.. literalinclude :: files/05_append_collision_meshes.py
4651
:language: python
4752
48-
The backend's updated planning scene while executing the above script. Note the
49-
red robot link indicating the collision.
53+
The backend's updated planning scene while executing the above script.
5054

5155
.. figure:: files/05_collision_objects_append.jpg
5256
:figclass: figure
5357
:class: figure-img img-fluid
5458

5559

5660

57-
Attach tool to a robot's end-effector
58-
=====================================
61+
2. Attached collision meshes
62+
============================
5963

60-
The following script defines a tool, described by a collision mesh and a frame, and
61-
attaches and removes it to the robot's end-effector.
64+
Attach end-effector
65+
-------------------
6266

63-
.. literalinclude :: files/05_attach_mesh_to_ee.py
67+
The following script defines a tool -also called end effector- which is described by a collision mesh and a frame, and
68+
attaches it to the robot.
69+
70+
.. literalinclude :: files/05_attach_ee.py
6471
:language: python
6572
66-
The backend's updated planning scene while executing the above script.
73+
In this case, we are not adding it to the planning scene explicitely, only attaching it to the robot instance itself.
6774

6875
.. figure:: files/05_collision_objects_attached.jpg
6976
:figclass: figure
7077
:class: figure-img img-fluid
78+
79+
80+
Grasshopper example
81+
===================
82+
83+
The following Grasshopper document showcases all the options described above:
84+
85+
.. figure:: files/05_grasshopper_collision_objects.jpg
86+
:figclass: figure
87+
:class: figure-img img-fluid
88+
89+
.. raw:: html
90+
91+
<div class="card bg-light">
92+
<div class="card-body">
93+
<div class="card-title">Download</div>
94+
95+
* :download:`Robot playground (Grasshopper) (.GHX) <files/05_grasshopper_collision_objects.ghx>`
96+
97+
.. raw:: html
98+
99+
</div>
100+
</div>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import time
2+
3+
from compas.datastructures import Mesh
4+
from compas.geometry import Frame
5+
6+
import compas_fab
7+
from compas_fab.backends import RosClient
8+
from compas_fab.robots import Tool
9+
10+
with RosClient() as client:
11+
robot = client.load_robot()
12+
assert robot.name == 'ur5_robot'
13+
14+
# create collision object
15+
mesh = Mesh.from_stl(compas_fab.get('planning_scene/cone.stl'))
16+
t1cf = Frame([0.14, 0, 0], [0, 0, 1], [0, 1, 0])
17+
tool = Tool(mesh, t1cf, name='tip')
18+
robot.attach_tool(tool)

docs/examples/03_backends_ros/files/05_attach_mesh_to_ee.py

Lines changed: 0 additions & 33 deletions
This file was deleted.
0 Bytes
Loading
0 Bytes
Loading
0 Bytes
Loading
41.9 KB
Loading
Binary file not shown.

0 commit comments

Comments
 (0)