Gazebo | Ignition | Community
Ask Your Question
0

How to trigger a stereo camera on Gazebo Ignition with ROS2 ?

asked 2022-08-16 04:56:23 -0500

Clement gravatar image

updated 2022-08-17 07:28:20 -0500

Hello,

I'd like to trigger a stereo acquisition from ROS Galactic with Gazebo Ignition (Fortress).
I don't find any documentation. Could someone provide me an example ?
I've found https://github.com/ros-simulation/gaz... but I'm not sure if those plugins are for ignition or gazebo classic...

Thanks in advance

Update

Ignition plugins are here: https://github.com/gazebosim/gz-sim/. Sensors have been fused into a single Sensor.cc. To create a stereo camera you need two <sensor> tags with type "camera" as described here: https://github.com/gazebosim/gz-sim/b...</sensor>

The Load() function parses the <camera> tag: https://github.com/gazebosim/sdformat...</camera>

To trigger cameras, you need to set the <triggered> tag to true and give a <trigger_topic>.
In the end, my urdf looks like this:

<sensor type="camera" name="right">
  <update_rate>10.0</update_rate>
  <always_on>true</always_on>
  <ignition_frame_id>camera_link_optical</ignition_frame_id>
  <pose>0 -0.12 0 0 0 0</pose>
  <topic>/model/mmx/stereo_camera/right/image_raw</topic>
  <camera name="right">
    <triggered>true</triggered>
    <trigger_topic>/trigger</trigger_topic>
    <horizontal_fov>1.3962634</horizontal_fov>
    <image>
        <width>600</width>
        <height>600</height>
        <format>R8G8B8</format>
    </image>
    <clip>
        <near>0.02</near>
        <far>300</far>
    </clip>
  </camera>
</sensor>

<sensor type="camera" name="left">
  <topic>/model/mmx/stereo_camera/left/image_raw</topic>
  <update_rate>10.0</update_rate>
  <always_on>true</always_on>
  <ignition_frame_id>mmx/camera_link_optical</ignition_frame_id>
  <pose>0 0 0 0 0 0</pose>
  <camera name="left">
    <triggered>true</triggered>
    <trigger_topic>/trigger</trigger_topic>
    <horizontal_fov>1.3962634</horizontal_fov>
    <image>
        <width>600</width>
        <height>600</height>
        <format>R8G8B8</format>
    </image>
    <clip>
        <near>0.02</near>
        <far>300</far>
    </clip>
  </camera>
</sensor>

There is no message on the topic ign topic -t /model/mmx/stereo_camera/left/image_raw -e which means the camera is in triger mode (not constantly streaming messages on the topic).

But the trigger_topic doesn't appear when I list topics with ign topic -l
And if I pusblish a message on the trigger_topic with ign topic -t "/trigger" -m ignition.msgs.Empty -p " ", cameras are not triggered (still no image message).

edit retag flag offensive close merge delete

Comments

The link you provided is ROS1.

Would this link big helpful for you? https://github.com/gazebosim/ros_gz/t...

Instead of Foxy, use Galactic

kakcalu13 gravatar imagekakcalu13 ( 2022-08-16 09:28:38 -0500 )edit

Indeed it was the old gazebo plugins. The new ones are https://github.com/gazebosim/gz-sim. It seems that all the sensors have been fused into a single sensor: https://github.com/gazebosim/gz-sim/t.... But I can't make it work.

Clement gravatar imageClement ( 2022-08-16 10:41:00 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-17 07:59:42 -0500

Clement gravatar image

OK it works... I found this page https://community.gazebosim.org/t/new... on which there is a screenshot of a trigger command:

image description

So the issue was that I wasn't sending a Boolean message.
The command should have been: ign topic -t "/trigger" -m Boolean -p "data: true" -n 1

edit flag offensive delete link more

Comments

I have another question, is gazebo ignition being abandoned?
There is no documentation at all.
It tooks me almost two days to figure how how to create a stereo bench and trigger a pair of images and it's only by chance.
Are people all moving to Webots ?

Clement gravatar imageClement ( 2022-08-17 08:50:20 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2022-08-16 04:56:23 -0500

Seen: 42 times

Last updated: Aug 17