patrykcieslak / stonefish

Stonefish - an advanced C++ simulation library designed for (but not limited to) marine robotics.
https://stonefish.readthedocs.io/
GNU General Public License v3.0
126 stars 32 forks source link

Stonefish ROS2: sensor fps is not the one requested #57

Open JulietteDrupt opened 1 week ago

JulietteDrupt commented 1 week ago

Good afternoon,

Thank you for this powerful tool. I just noticed an issue when trying to parameterize camera fps when using ROS2.

Single camera The sensor definition in the launchfile is as follows, with only one camera:

<sensor name="camera" rate="20.0" type="camera">
    <specs resolution_x="1200" resolution_y="800" horizontal_fov="90.0"/>
    <origin xyz="0.16 0.0 0.25" rpy="1.5707963267948966 0.0 1.5707963267948966"/>
    <link name="base_link"/>
    <ros_publisher topic="/bluerov/camera"/>
</sensor>

...but the command

 ros2 topic hz /bluerov/camera/image_color 

returns an average rate around 8 fps image

So I tried to play with the frame rate parameter in the launch file. With rate="40.0", I get approx. 20 fps: image

Stereo camera The 2 cameras are defined as follows in the launchfile:

<sensor name="camera1" rate="20.0" type="camera">
   <specs resolution_x="1200" resolution_y="800" horizontal_fov="90.0"/>
   <origin xyz="0.16 -0.10 0.25" rpy="1.6 0.0 1.6"/>
   <link name="base_link"/>
   <ros_publisher topic="/bluerov/camera/left"/>
</sensor>
<sensor name="camera2" rate="20.0" type="camera">
   <specs resolution_x="1200" resolution_y="800" horizontal_fov="90.0" baseline="0.2"/>
   <origin xyz="0.16 0.10 0.25" rpy="1.6 0.0 1.6"/>
   <link name="base_link"/>
   <ros_publisher topic="/bluerov/camera/right"/>
</sensor>

Again, the published fps is not very consistent, and different for the 2 cameras: approx 15 fps for the left camera image and varying between between 9 and 14 fps for the right one image

Thank you in advance for your help, Best regards