Skip to content

Commit 975551a

Browse files
committed
Add Blender code to robot visualisation example
This may be more involved than necessary at this point in the Tutorial, but it should be there for completeness IMO.
1 parent ac04df9 commit 975551a

File tree

1 file changed

+61
-3
lines changed

1 file changed

+61
-3
lines changed

docs/tutorial/robots.rst

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,29 @@ Visualizing Robots
148148
Before jumping into how to build a robot model, let's first see how to visualize
149149
one. This can be done with Blender, Rhino or Grasshopper using one of COMPAS's
150150
artists. The basic procedure is the same in
151-
any of the CAD software (aside from the import statement), so for simplicity we
152-
will demonstrate the use of :class:`compas_rhino.artists.RobotModelArtist` in Rhino.
151+
any of the CAD software (aside from the import statement). Below you can find an example code for both Rhino and Blender.
152+
153+
154+
.. raw:: html
155+
156+
<div class="card">
157+
<div class="card-header">
158+
<ul class="nav nav-tabs card-header-tabs">
159+
<li class="nav-item">
160+
<a class="nav-link active" data-toggle="tab" href="#visualise_robot_rhino">Rhino</a>
161+
</li>
162+
<li class="nav-item">
163+
<a class="nav-link" data-toggle="tab" href="#visualise_robot_blender">Blender</a>
164+
</li>
165+
</ul>
166+
</div>
167+
<div class="card-body">
168+
<div class="tab-content">
169+
170+
.. raw:: html
171+
172+
<div class="tab-pane active" id="visualise_robot_rhino">
173+
153174
Be sure to first install COMPAS for Rhino. While the following code is incomplete,
154175
it can be used as a scaffolding for code to be run in a Python script editor within Rhino.
155176

@@ -167,8 +188,45 @@ it can be used as a scaffolding for code to be run in a Python script editor wit
167188
artist.clear_layer()
168189
artist.draw_visual()
169190
191+
.. raw:: html
192+
193+
</div>
194+
<div class="tab-pane" id="visualise_robot_blender">
195+
196+
.. code-block:: python
197+
198+
import compas
199+
from compas.robots import GithubPackageMeshLoader
200+
from compas.robots import RobotModel
201+
import compas_blender
202+
from compas_blender.artists import RobotModelArtist, BaseArtist
203+
204+
compas_blender.clear() # Delete all objects in the scene
205+
206+
compas.PRECISION = '12f'
207+
# Load the urdf-file from Github
208+
github = GithubPackageMeshLoader('ros-industrial/abb', 'abb_irb6600_support', 'kinetic-devel')
209+
model = RobotModel.from_urdf_file(github.load_urdf('irb6640.urdf'))
210+
model.load_geometry(github)
211+
212+
# Load the robot meshes into the blender scene
213+
artist = RobotModelArtist(model, collection='COMPAS FAB::Example')
214+
215+
Note that the blender ``RobotModelArtist`` is not as developed as the one for Rhino.
216+
217+
.. raw:: html
218+
219+
</div>
220+
221+
.. raw:: html
222+
223+
</div>
224+
</div>
225+
</div>
226+
227+
170228

171-
See below for a complete example.
229+
See below for a complete example in Rhino.
172230

173231

174232
Building robots models

0 commit comments

Comments
 (0)