so i am using gazebo and sitl for simulation of dronekit code.and i am using iris copter which comes in built in gazebo with ardupilot plugin so that i can control it using mavproxy and drone-kit . i have design my own drone in solid works , and convert the cad file into urdf file by providing necessary links and it’s type . now the issue is that how do i integrate the ardupilot plugin with my custom urdf file so that i can simulate my custom drone in gazebo using mavproxy ?
Hi @Dharmil_Patel, you will need to add the plugins used in the iris_with_standoffs
and iris_with_ardupilot
models to your model. You can either use <gazebo>
elements in URDF or convert your model to SDF first then edit (this may be easier to get running initially).
If your drone is a quadcopter then reviewing the iris model and mapping the controllers and lift-drag plugins to the joint names in your drone should be straight forward. If you have additional rotors you will need to add a control element for each one of those following the same pattern. The inertial elements, propeller areas and motor PIDs may all need to be modified depending on the dimensions of your drone.
Hello, i tried to do all of them and it flies not in balance. Do you know any solution
Hello @Olizm, we need more information to understand the issue. Is the problem running one of the example models with standard parameters, or a custom model?
I converted sdf file
model.txt (16.5 KB)
to this. And when I start simulation and after taking off, it gives a message like Gyros incostintent drone starts to fly not in balanced. After a few seconds it falls down.
@Olizm, the file attached is URDF not SDF. It appears to be from a package called package://caldron
. It will not work as a standalone model file in Gazebo using the ArduPilot plugin and appears to target Gazebo 11 which is not supported.
I’d recommend following the instructions to run the example models provided for the latest version of ArduPilot and Gazebo. Start with a working model, and adapt from there. Using SITL with Gazebo — Dev documentation
I converted it for rotating lidar continually and I wanted to use mapping. I couldn’t rotate it in sdf file so I created a ros package and executed it inside launch file.
I’m not sure I follow: to simulate a lidar in Gazebo the link containing the sensor element does not need to rotate - the gpu lidar sensor will output the laser scan topic required without having to replicate the mechanics of a device. It’s nice to have the spinning visual, but it’s not necessary if the main objective is to get a robot running nav2 or cartographer, and will result in a more complicated model.
Creating a ROS package to get an iris quadcopter with a lidar sensor is not needed either - adding a lidar sensor element to a link joined to the base link is all that is required. We also use SDF in the ROS 2 packages rather than URDF. The robot state publisher can process this via the sdformat_urdf
plugin. Again, that is a more complicated way to go about setting up the model - it is much easier to test initially by making a minimal modification to the iris model SDF and running that without ROS at all.
Consider integrating ROS once that is working. The ardupilot_gz
and ardupilot_ros
packages have fully working examples of an iris with a lidar sensor used with cartographer. Cartographer SLAM with ROS 2 in SITL — Dev documentation