Good morning, everyone,
I am working on a project where I need to use Offboard mode. My setup consists of a Raspberry Pi 5 running Ubuntu 24.04.2, a Pixhawk 6X, and ROS2 as the communication protocol. I have connected the Raspberry Pi and the Pixhawk via Ethernet, and I have verified that they can successfully ping each other.
After confirming network connectivity, I start the agent on the Raspberry Pi with the following command:
MicroXRCEAgent udp4 -p 8888
Then, I use the PX4 example workspace and run:
ros2 run px4_ros_com offboard_control.py
This is a sample script to use Offboard mode. The initial command to switch to Offboard mode executes successfully, meaning the connection is not the issue. However, when I check QGroundControl, I see that the flight mode has indeed changed to Offboard, but arming is denied.
I have tried updating the firmware and recalibrating the sensors, but I still get the same error. The status summary does not indicate any issues.
If anyone can help, I would greatly appreciate it! Let me know if you need more documentation or details, I’d be happy to provide them.
Thanks in advance!
Hello, have you solved it? How do you solve it?
If you have some solutions please contact me ybhzuishuai@gmail.com , I would appreciate it for your help.
Hi BH_Y !
We have tried using MAVROS with ROS2, and it allows us to do more things, such as viewing many more parameters and the status of the drone, changing the flight mode, and even arming it remotely using manual mode if we have the controller on. However, we have not been able to arm it from offboard mode and launch a program. We also realized that one of the reasons we couldn’t arm the drone in offboard mode was that it required the drone’s position at all times. We do not use GPS because we are indoors, so we had to send the position of the drone captured by the mocaps. We did this by remapping the topic from our mocaps, where we have the drone’s position, to the topic that MAVROS provides for the vision_pose. Then, when we echo the remapped topic, we get the position from the mocaps, but from QGroundControl, it still shows a different position.
Here are the steps to follow to have the same as us. They are put in order:
With this you launch mavros:
ros2 launch mavros apm.launch fcu_url:=udp://:14550@
By doing this you will be able to have the mocaps data. The IP has to be of the computer where you have launched the mocaps program (like Motive in our case):
ros2 launch vrpn_mocap client.launch.yaml server:=192.168.105.104 port:=3883
By doing this you will be able to remap the topics:
ros2 run topic_tools relay /vrpn_mocap/Drone/pose /mavros/vision_pose/pose
By doing this you will see the status of the drone at all times:
ros2 topic echo /mavros/state
With this you can change the flight mode (in this case it is changed to manual):
ros2 service call /mavros/set_mode mavros_msgs/srv/SetMode "{custom_mode: MANUAL}"
This way you can arm the drone from the raspberry:
ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"
If anyone has the same problem, has any solution or question please post it in the forum so that everyone can have access.
Thanks in advance!
Here is an answer I have been given in another category. I hope this answer will help you a lot. If you have any questions, do not hesitate to share it in the forum. Thanks for your time .
Also worth checking the “arming check report” by clicking the flight status (top left) button on QGC as shown in Fly View Toolbar | QGC Guide (master)
The report tells you exactly what is blocking arming.