How to control the gimbal with ros2 in gazebo

Hello everyone,

I’m working on a project with PX4, Gazebo Garden, and ROS 2 Humble. I want to use a camera mounted on a gimbal for this setup. I found a model in the PX4 Gazebo Models GitHub repository that seems to fit my requirements and managed to modify the PX4 repo to have it in my world, but I’m having trouble controlling the gimbal.

I’ve tried configuring MAVROS and also checked the Gazebo published topics, but so far, I haven’t had any success. What’s strange is that the model appears to have 3 subtopics for the gimbal joints, yet I can’t seem to access them or send any commands successfully.

Any guidance or advice would be greatly appreciated!

Additionally, is there a way to modify the camera to an RGBD type in this model?

Thanks in advance for your help!

To control a gimbal with ROS 2 in Gazebo:

Define the Gimbal in URDF: Include pan and tilt joints.
Install Gazebo-ROS Plugins: Install gazebo_ros_pkgs.
Set up ros2_control: Configure a controller to publish joint commands.
Write ROS 2 Node: Publish JointTrajectory to control gimbal movement.
Launch: Use a launch file to run Gazebo and your ROS 2 node.
That’s it! You can now control the gimbal in Gazebo using ROS 2.

1 Like

Hey thanks!
In the end I used the following solution: Is there any way to contorl the gimbal in x500_gimbal · Issue #55 · PX4/PX4-gazebo-models · GitHub

But thanks anyway!