ROS2 Drone Movement Problems


I’ve been trying to make a drone move using a custom URDF file. I currently am able to generate the drone within a gazebo environment and Rviz2, but have not been able to move it. This is done in ROS2 Foxy so I’m using geometry_msgs and the cmd_vel topic to try and move the drone instead of the construct’s course packages. When I run the system and check the topics, it looks like velocity messages are being published, but no movement is happening.


Above is the drone in Gazebo.

This is the drone in Rviz2. All components seem to be fine.


This is the list of topics shown during package execution.


This is the message being published to the cmd_vel topic. It does show that there are zero subscribers to cmd_vel, but I don’t understand how I can get the drone to properly subscribe to it. I also tried referencing the notes from the ROS2 in 5 days course and the ROS drone programming course, but neither of which were able to work for me. Any help would be greatly appreciated! Thank you!

I don’t have any resources in mind right now, but since you are creating this drone from scratch, you need to take care of:

  • How the drone would take off and land.
  • How the drone would move forward and backward as well as turn.

Since nothings is happening in Gazebo, it appears that’s where the problem is because it doesn’t know how to “move” the drone. Missing plugins?

PS: the programming drones course is about programming an existing drone, not creating one from scratch.

Understood. Yes, I did see that the course didn’t have one on creating it. Ideally, I would have used the pre-installed quadrotor model that came with Gazebo, but it constantly throws a “file not found” error when trying to load the .dae mesh file. So I resorted to building my own without any dependencies.

I did try to use a ground based model to see what would happen with my movement packages. That throws a “Nonetype is not callable” error at the below lines.


That part doesn’t fully make sense to me since the ground based model does have controls that show up in the Gazebo simulation, which is shown below:

Unlike the drone model, I am able to apply force on the base_link within Gazebo to move the car. ROS2 doesn’t seem to work with it though so this leads me to believe it’s either something else or a compounded issue.

For reference, here’s a picture of the error I’m getting with the move_demo program. The specific lines are underlined.

I understand your challenges.

What I see is that there is currently a dearth of resources for working with drones in ROS2. Therefore, we have starting a series on that. It’s still in the early stages - perhaps you can build on it.

Here’s the first video:

Much appreciated! Also I believe there’s another reason why the drone doesn’t work properly. Looking at the Gazebo documentation and Cessna demo provided, it seems that the model has to use the Lift/Drag plugin for it to generate the appropriate forces for flight, rather than differential drive. These plugins are not included in the default drone model files.

This is the plugin I’m referring to: Gazebo : Tutorial : Aerodynamics

I’d assume the controls would be relatively similar to the topics used in the Drone programming course, using cmd_vel and the other drone topics. The issue I see at the moment is understanding the physical properties of flight that the plugin uses and building the model from that. It’s either that or importing the hector quadrotor drone into ROS 2.

This could also be another interesting course for Construct if you all are interested: Creating Flight Based URDF Models.

1 Like