Indoor autonomous flight with Arducopter, ROS and Aruco Boards Detection

Hi everyone!

I’m working on positioning of a drone indoor, for this, I followed the published description. Indoor autonomous flight with ArduCopter, ROS and Aruco Boards Detection — Dev documentation

However, during the test flight - which is a straight rise to 1 meter and then landing - the following strongly fluctuating behavior was experienced.

I’m using a raspberry pi 3 B+ with ubuntu 16.04 (from ubiquity) + MAVROS
I have a Pixhawk 4 controller with Arducopter 3.7.0-dev stack.
The camera is a raspicamera v2.
In rviz i can see the realtime position from the marker using mavros/vision/pose
But I realized that i don’t get any data from /mavros/local_position/pose.

The parameters what i use are the same as in the article:

AHRS_EKF_TYPE 2
BRD_RTC_TYPES 1
EKF2_ENABLE 1
EKF3_ENABLE 0
EK2_GPS_TYPE 3
EK2_POSNE_M_NSE 0.1
EK2_VELD_M_NSE 0.1
EK2_VELNE_M_NSE 0.1
EK2_EXTNAV_DELAY 80
GPS_TYPE 0
COMPASS_USE 0
COMPASS_USE2 0
COMPASS_USE3 0
SERIAL1_BAUD 921 (the serial port used to connect to Raspberry Pi)
SERIAL1_PROTOCOL 2
SYSID_MYGCS 1 (to accept control from mavros)
VISO_TYPE 0

Does anyone have any idea what can cause this problem?

Hello @ptroll, is it possible to have the logs of this flight ?

Hi @ptroll I would like to see the output of rostopic list after the launch of mavros.

Hi Anbello!

i attached the output of rostopic list after the launch of mavros apm.launch

rostopic list.txt (2.8 KB)

@ptroll sorry, I would like to see also the output in the terminal in which you launch mavros.

No problem, here you have it
mavros launch output.txt (12.6 KB)

I don’t see anything wrong …

at this time after launching mavros if you give the following command:
rosrun aruco_gridboard set_origin.py
you should see messages from /mavros/local_position/pose topic

if this doesn’t happen try to reboot the FC via GCS (I use mavproxy connected to gcs_url) and after seeing the messages (on GCS or term tab with mavros running):
[ERROR] [1455211795.669665982]: FCU: GPS Glitch
[ERROR] [1455211795.760278673]: FCU: GPS Glitch cleared
give the command:
rosrun aruco_gridboard set_origin.py
again

Dear Anbello,

I tried what you suggested, but I don’t receive any message from /mavros/local_position/pose topic. (Meanwhile /mavros/vision_pose/pose works fine)

After I launched the aruco_gridboard detection_rpicam.launch , mavros pm.launch , rosrun aruco_gridboard set_origin.py (just after GPS Glitch cleared)
I gave the command: rosrun aruco_gridboard mavros_control1.py
And then i saw the following graph in rqt_graph:

It seems the /mavros/local_position/pose topic doesn’t get any source from /mavros
I can’t find the reason for this.
Does anyone have any tips on where the error might be?
What should i modify to get messages from local_position topic? Maybe something in apm_config.yaml or apm_pluginlists.yaml?

The local position is internal to the EKF on ArduPilot, there is not external position estimator , so mavros is basically just used to transform ENU to NED references. You can still use the tools for mav control.

Just an idea, but if you are using the branch Copter-3.7.0-dev stack, maybe you should use a “released” branch like Copter-3.6.7. This one has the external navigation feature, and you are sure to not suffer from any bug appearing during development.
Also, it can happens that some topics (maybe /mavros/local_position/pose is part of it), need a frequency parameter to publish. Not sure, but I had a bug like this once. I use the service rosservice call /mavros/set_stream_rate 0 20(Hz) 1 for this.

Dear guys,
I am going to try this setup soon, Do it need px4flow so that the pixhawk can fly indoor ?

Dear Mark
In this system I don’t use optical flow, I use Aruco Board pose estimation to control the position of the Copter.
It is explained in the first post, there is a Raspberry Pi zero and Cam on board that send video stream to PC via WiFi, the PC do the pose estimation stuff and send control messages to the Copter.

In another Copter I used a Raspberry Pi 3 so all the computing stuff is done on board, this is explained here:
https://ardupilot.org/dev/docs/ros-aruco-detection.html

1 Like

thanks for your previous reply. I try to setup the packages but i face this problem when building cv_bridge, any suggestions?

cv_bridge:cmake /home/greah/catkin_ws_apm/logs/cv_bridge/build.cmake.004.log
CMake Error at /usr/share/cmake-3.5/Modules/FindBoost.cmake:1677 (message):
Unable to find the requested Boost libraries.

Boost version: 1.58.0

Boost include path: /usr/include

Could not find the following Boost libraries:

      boost_python37

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.

Which OS and ROS version are you using?

In my system with Ubuntu 18.04 and ROS Melodic I don’t see that error.

Hi Anbello,
I would like to run aruco board detection on a companion computer so I followed your tutorial here: https://ardupilot.org/dev/docs/ros-aruco-detection.html
Thank you for spending time to write your development down. It was very useful for me. Unfortunately the demo python scripts are not working well for me. My drone (149mm) is not able to follow the setpoints correctly. I guess the problem can be the processing power of my RPI. Or the problem can be RPI camera V1.3 or inconsistent frame rates in MAVROS. At first I would like to check the first point. I use Raspberry Pi 3B and not 3B+. Could you please tell me in that tutorial what type of RPI did you use? Maybe the 3B+? I would like to know whether my HW is capable to make the calculation or not.
Thanks for your answer in advance.

Hi Broodie, sorry for late replay.

The Raspberry Pi 3B is OK for this application. One problem could be the camera, I used a RPi camera 2.0, with 1.3 I had some problems, especially because it was a non original one.

Anyway to try to help you let me know if you had some problems in some point of the tutorial.
After launching the ROS nodes in “Starting all ROS node” paragraph did you have some error?
Did you succeed to see the /mavros/vision_pose/pose and /mavros/local_position/pose messages?

Hi Anbello,

Thank you for your reply. It is glad to hear I don’t need to buy another RPi. :slight_smile:
Yes, I’ve got correctly the /mavros/vision_pose/pose and /mavros/local_position/pose messages. I checked them in RVIZ. The /mavros/vision_pose/pose is working smoothly without any lag but the /mavros/local_position/pose is not following the /mavros/vision_pose/pose correctly. There is some delay between the two messages that was not seen in your videos. Currently I’m trying to fine tuning the parameter EK2_EXTNAV_DELAY and set different mavros frame rates. I realized that EK2_EXTNAV_DELAY with value 35 is better for my drone than value 80. I’m going to do some test in the next days and let you know the result. But if I can not manage to do that smooth autonomous moves with my drone like in your videos then I will buy an original V2 camera.
Thank you for your help.

Hi Anbello,

So I’ve done some tests and it is turned out the best settings for me (Cloud-149 drone frame, 3" props, Omnibus F4 Nano V6.1, RPI 3B, Ubuntu20.04, ROS Noetic) is the following:

  • EK2_EXTNAV_DELAY 10
  • 640x480 60fps for V1.3 camera

So my drone can fly smoothly with autonomous control. I only have one problem with it and it is possible that this problem is not with ROS but with Ardupilot. During yaw change the /mavros/vision_pose/pose is working correctly (axes don’t change its position in RVIZ at all just heading is changing) because I set ‘camera_offset_y’ well but the /mavros/local_position/pose does not follow correctly the /mavros/vision_pose/pose topic. You can see there is a drifting on that axes. And this drifting is present during flight as well. The root cause of that is unknown for me at the moment. Do you have any idea maybe what can be the problem here?
Thank you for your answer in advance!
yaw_drifting

I had similar problems in two situations: wrong camera offset and / or wrong time offset (EK2_EXTNAV_DELAY).

You have drifting only on one axis, maybe you have to set also camera_offset_x (and z)? I seem to remember that x and y are swapped with respect to Arducopter frame.

2 Likes

Hı, I am trying to visiualize the mavros topics starting with /mavros/local… but even if I put the topic into rviz as pose with axes mode but I cannot see and also UI cannot rostopic echo ? How can I solve the problem do you have any idea?