You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_09_development/_develop_guide/_develop_guide/_create_gazebo_assets.rst
+62Lines changed: 62 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -422,6 +422,68 @@ If you want your new type of sensor to be mounted on a Gimbal, a ``model.sdf.jin
422
422
423
423
Just like any other model, the sensor models can be either added to the ``as2_gazebo_assets/models`` folder or to the ``models`` folder in your project.
424
424
425
+
If your new sensor needs a Jinja template to be loaded, you need to add it to the list of sensors with Jinja template of the drone model you are goint to use.
426
+
This list is on the ``drone-model.sdf.jinja``, and consists on a series of ``if-else`` that checks the name of the sensor in case it has a Jinja template to be loaded.
427
+
On the default ``quadrotor-base`` model, the list looks like this:
428
+
429
+
.. code-block:: sdf
430
+
431
+
{% for sensor in sensors -%}
432
+
<!-- Payload {{ sensor.model }} -->
433
+
{% if sensor.model == 'gimbal_position' -%}
434
+
435
+
{# Gimbal position - include or basic render #}
436
+
{% include 'models/gimbal/position_gimbal.sdf.jinja' with context %}
437
+
438
+
{% elif sensor.model == 'gimbal_speed' -%}
439
+
440
+
{# Gimbal speed - include or basic render #}
441
+
{% include 'models/gimbal/speed_gimbal.sdf.jinja' with context %}
442
+
443
+
{% elif sensor.model == 'hd_camera' and not sensor.gimbaled -%}
444
+
445
+
{% include 'models/hd_camera/hd_camera.sdf.jinja' with context %}
446
+
447
+
{% elif sensor.model == 'vga_camera' and not sensor.gimbaled -%}
448
+
449
+
{% include 'models/vga_camera/vga_camera.sdf.jinja' with context %}
450
+
451
+
{% elif sensor.model == 'semantic_camera' and not sensor.gimbaled -%}
452
+
453
+
{% include 'models/semantic_camera/semantic_camera.sdf.jinja' with context %}
454
+
455
+
{% elif sensor.model == 'rgbd_camera' and not sensor.gimbaled -%}
456
+
457
+
{% include 'models/rgbd_camera/rgbd_camera.sdf.jinja' with context %}
458
+
459
+
{% elif sensor.gimbaled -%}
460
+
461
+
{% else -%}
462
+
<include>
463
+
<name>{{ sensor.name }}</name>
464
+
<uri>model://{{ sensor.model }}</uri>
465
+
<pose
466
+
relative_to="base_link">
467
+
{{ sensor.pose }}
468
+
</pose>
469
+
</include>
470
+
<joint
471
+
name="{{ sensor.name }}_joint" type="fixed">
472
+
<parent>base_link</parent>
473
+
<child>{{ sensor.name }}</child>
474
+
</joint>
475
+
{% endif -%}
476
+
{% endfor -%}
477
+
478
+
so before the line ``{% elif sensor.gimbaled -%}``, add the following lines:
479
+
480
+
.. code-block:: sdf
481
+
482
+
{% elif sensor.model == 'your-sensor' and not sensor.gimbaled -%}
483
+
{% include 'models/your-sensor/your-sensor.sdf.jinja' with context %}
484
+
485
+
If this lines are not added, the default ``your-sensor.sdf`` model will be loaded.
Copy file name to clipboardExpand all lines: docs/_09_development/_tutorials/_tutorials/adding_gazebo_assets.rst
+60Lines changed: 60 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -417,6 +417,66 @@ Using this template, the name of the model for Gazebo as well as some other info
417
417
418
418
Just like any other model, the sensor models can be either added to the ``as2_gazebo_assets/models`` folder or to the ``models`` folder in your project. The ``model.sdf.jinja`` file replaces the usual ``model.sdf`` file, although both files can coexist.
419
419
420
+
To mount it on Gimbal, your new sensor needs a Jinja template to be loaded, you need to add it to the list of sensors with Jinja template of the drone model you are goint to use.
421
+
This list is on the ``drone-model.sdf.jinja`` file, and consists on a series of ``if-else`` that checks the name of the sensor in case it has a Jinja template to be loaded.
422
+
On the default ``quadrotor-base`` model, the list looks like this:
420
423
424
+
.. code-block:: sdf
425
+
426
+
{% for sensor in sensors -%}
427
+
<!-- Payload {{ sensor.model }} -->
428
+
{% if sensor.model == 'gimbal_position' -%}
429
+
430
+
{# Gimbal position - include or basic render #}
431
+
{% include 'models/gimbal/position_gimbal.sdf.jinja' with context %}
432
+
433
+
{% elif sensor.model == 'gimbal_speed' -%}
434
+
435
+
{# Gimbal speed - include or basic render #}
436
+
{% include 'models/gimbal/speed_gimbal.sdf.jinja' with context %}
437
+
438
+
{% elif sensor.model == 'hd_camera' and not sensor.gimbaled -%}
439
+
440
+
{% include 'models/hd_camera/hd_camera.sdf.jinja' with context %}
441
+
442
+
{% elif sensor.model == 'vga_camera' and not sensor.gimbaled -%}
443
+
444
+
{% include 'models/vga_camera/vga_camera.sdf.jinja' with context %}
445
+
446
+
{% elif sensor.model == 'semantic_camera' and not sensor.gimbaled -%}
447
+
448
+
{% include 'models/semantic_camera/semantic_camera.sdf.jinja' with context %}
449
+
450
+
{% elif sensor.model == 'rgbd_camera' and not sensor.gimbaled -%}
451
+
452
+
{% include 'models/rgbd_camera/rgbd_camera.sdf.jinja' with context %}
453
+
454
+
{% elif sensor.gimbaled -%}
455
+
456
+
{% else -%}
457
+
<include>
458
+
<name>{{ sensor.name }}</name>
459
+
<uri>model://{{ sensor.model }}</uri>
460
+
<pose
461
+
relative_to="base_link">
462
+
{{ sensor.pose }}
463
+
</pose>
464
+
</include>
465
+
<joint
466
+
name="{{ sensor.name }}_joint" type="fixed">
467
+
<parent>base_link</parent>
468
+
<child>{{ sensor.name }}</child>
469
+
</joint>
470
+
{% endif -%}
471
+
{% endfor -%}
472
+
473
+
so before the line ``{% elif sensor.gimbaled -%}``, add the following lines:
474
+
475
+
.. code-block:: sdf
476
+
477
+
{% elif sensor.model == 'your-sensor' and not sensor.gimbaled -%}
478
+
{% include 'models/your-sensor/your-sensor.sdf.jinja' with context %}
479
+
480
+
If this lines are not added, the default ``your-sensor.sdf`` model will be loaded.
0 commit comments