ArduPilot / ardupilot_gazebo

Plugins and models for vehicle simulation in Gazebo Sim with ArduPilot SITL controllers
GNU Lesser General Public License v3.0
81 stars 76 forks source link

Add camera zoom plugin #57

Closed srmainwaring closed 7 months ago

srmainwaring commented 1 year ago

Add a 3 axis gimbal and system plugin that attaches to a camera sensor and allows the camera to be zoomed.

Details

The plugin SDF has a single parameter setting the maximum zoom factor.

 <sensor name="camera" type="camera">
   ...
   <plugin filename="CameraZoomPlugin"
       name="CameraZoomPlugin">
     <max_zoom>15.0</max_zoom>
   </plugin>
</sensor>

Testing

https://github.com/ArduPilot/ardupilot_gazebo/assets/24916364/57dd7fb5-3db1-4ab1-b8ed-ea516f9caa96

The gimbal is position controlled and responds to roll, pitch and yaw commands.

gz topic -t "/gimbal/cmd_yaw" -m gz.msgs.Double -p "data: -1"

The camera zoom is similarly commanded.

gz topic -t "/model/gimbal/sensor/camera/zoom/cmd_zoom" -m gz.msgs.Double -p "data: 2"

Tasks

rmackay9 commented 1 year ago

It's really great to see this, thanks so much!

Ryanf55 commented 8 months ago

If you are still interested to get this merged, let me know! I think it's a great feature addition.

srmainwaring commented 8 months ago

If you are still interested to get this merged, let me know! I think it's a great feature addition.

Thanks @Ryanf55, let me re-test on Harmonic. IIRC there was an issue in Gazebo Garden that could cause crashes and I need to remind my self what it was and whether it has been fixed.

srmainwaring commented 7 months ago

If you are still interested to get this merged, let me know! I think it's a great feature addition.

Hi @Ryanf55 - tested on Harmonic and appears to now be working fine. I can not longer see a segmentation fault on exit, so I assume the issue (which was connected to the physics libraries unloading IIRC) has been resolved upstream.