Offboard Drone Control

In my project, I will be receiving input data via an onboard LiDAR. Using this information, the drone will need to navigate a maze and find the exit. My ultimate goal is to implement some SLAM algorithm, but I would like to start out simpler to get a better understanding of the off board system and what not.

The issue I am having is controlling the drone such as the forward speed and the yaw rate. What Mavros topic should I be subscribing to?

I have tried “mavros/setpoint_velocity/cmd_vel”, but the drone moves along the x-axis of the map, not the x-axis of the drone. For example, when I set a yaw_rate of one radian/sec and an x velocity of 1 m/s, I would expect the drone to fly in a circle. However, the drone simply spins along its z-axis while it flies in a straight line along the x-axis of the map.

I have turned to using “mavros/setpoint_raw/local” which gives me the commands I want, but I am not sure if this is the proper way to do it? I am slowly figure this stuff out and need some advice.

I am using ROS1-Noetic.


simply rotate the command to proper frame, I think your goal is achieved

Hello, I’m not sure if it is ROS2 specific but there is this difference in frame convention between ROS and PX4 that sometimes bother us developers. Please see : ROS 2 User Guide | PX4 User Guide (main).

If you are in the right convention, it is probably that the command you send is in the global frame whereas it should be in the body frame (the frame attached to the drone), or vice-versa. Everything is explained in the User guide.