I have set-up Gazebo with SITL by following this link and I am using Dronekit-Python to perform missions in Gazebo.
The camera gimbal rotation commands through Dronekit or through MAVProxy terminal are reflected in the vehicle’s gimbal attribute (vehicle.gimbal) but the gimbal does not move in Gazebo and the camera view does not change. Gazebo throws no error (when run with the --verbose flag) so I am assuming that the gimbal_small_2d plugin is loading successfully. All the other functionalities are working i.e. the drone is flying in Gazebo as it should. But the gimbal is not moving at all.
I also reached this conclusion that no commands are being sent by SITL to gazebo gimbal plugin because the /gimbal_tilt_command topic was not being published. Just wanted to confirm so I posted this problem here.
Can you tell me what needs to be done to send the gimbal commands from SITL? Maybe I could make it work on my own. Or any other workaround I could use till this is implemented in SITL.
The original version for Gazebo9/11 is position controlled by publishing the desired position (angle) in radians to the Gazebo transport topic: ~/gimbal_tilt_cmd. The current position is then reported on ~/gimbal_tilt_status. It’s up to the user to decide how to go about forwarding commands to Gazebo’s messaging layer. AFAIK there is no mechanism built into SITL or the legacy plugin to do this.
The plan for Gazebo Garden is to update the model to work with the new render engine. The model is available here: Gimbal Small 2D and requires some minor tweaks to render correctly. It’s also straightforward to articulate the second degree of freedom in this model so that there are both tilt and roll joints. I’ll be adding that as an additional feature.
Gazebo Sim includes a system plugin for commanding joint positions - so the plan is to use this to control the gimbal. The command line syntax for setting joint positions then looks like:
Where the topic name may be configured in the joint position controller plugin.
We have added a new feature in the latest version of the ArduPilot plugin to forward servo commands onto named Gazebo topics. With this you should then be able to configure one or two SERVOX_FUNCTION outputs to control the tilt and roll of the gimbal and have SITL forward this into the model in Gazebo.
There are no immediate plans to add mavlink integration to the ArduPilot plugin. For that you would need to write a script to intercept mavlink messages and forward them to the gazebo joint topics as is the case for Gazebo9/11.
This PR Gimbal: enable gimbal in iris model #43 will enable a 2 DOF gimbal equipped with a regular camera to be used on the Iris. There are a couple of upstream patches needed before it can be merged. The PR includes some notes on how to configure it as a servo gimbal in SITL.
Support for a 2 DoF servo gimbal is now available in the main branch of ArduPilot/ardupilot_gazebo. The upstream dependencies are in release 6.3.0 of gz-physics6 and the nightly builds of gz-sim7 and will be included in the next full release.
For details of how to configure and use the gimbal see the PR #43 mentioned above.