How can I correct the LOCAL_POSITION_NED from an external vision system

I built an external position estimation vision based system for a drone that runs Ardupilot.

As far as I know, MAVLINK_MSG_ID_LOCAL_POSITION_NED returns the position of the drone. However, this position is depending on the internal position estimation systems (GPS, IMU, optical flow…).

How can I send to Ardupilot my results from the external position estimation I made to replace those values? or to fuse those values into the EKF that Ardupilot uses internally?


Take a look here: Injecting fake GPS into APM (from Motion Capture System)

Thank you very much. I have two concerns:

  1. Isn’t GPS a global position estimation while the vision system is just a local one? Wouldn’t this make some troubles?
  2. As far as I understood from the conversation, that it would involve some Ardupilot code changing. So in other words, there is no ready solution in Ardupilot for this?

thanks again!

Depends on the MOCAP system you use.
ArduPilot does not have a direct interface using MAVROS

There is an opened PR, but no real action:

1 Like

I managed to fly a drone (intel aero RTF) in an indoor environment by using Vive tracker as external GPS

  1. The position of the Vive tracker is sent to a ROS node that convert the position to HIL_GPS message
  2. The HIL_GPS message is sent using MAVROS
  3. I changed the code in the arducopter and overwrite the outputs from the EKF (3) with the fake_gps data

Now I can navigate with a precision less than 3 cm.

@ppoirier - would you like me to specify more how to do it and someone from the arducopter group will program it more professionally?

Yes , go on and ask Francisco @OXINARF for guidance

btw, have you seen the other thread here ?

Great to here this! It is very impressive. Do you plan to push even a draft of it temporarily ?

Hi everyone,
@JustFineD I am also working with an Intel Aero drone and have designed an external algorithm that provides drone’s position and orientation in the “room” coordinate system.
The final purpose of my project is to be able to inject this position to the drone and the send position (or if that’s not possible even attitude) targets to it.

Do you think you can help me, at least with a high level list of steps (actual implementation would be of great help) I should take in order to achieve this (which is basically what you have achieved so far)?

I have tried to use the VISION_POSITION_ESTIMATE message but the folks from the gitter channel of ArduPilot have told me that that is only possible in the latest 3.6 version of ArduCopter and for some reason when I flash that to my Aero it doesn’t work anymore. Maybe you have encountered this problem too and have a solution for this as well.

I am struggling with this for a few weeks now.

Any kind of help is highly appreciated.
Thank you very much.

I’m using VISION_POSITION_DELTA in my tiny local positioning system:

See for its implementation if you are interested in.
The recent ArduCopter can handle VICON_POSITION_ESTIMATE too, though there was a clock skew issue when my system used it instead of VISION_POSITION_DELTA.

Hi @NFSergiu,
Do you still need help?
I am using the HIL_GPS message and with arducopter 3.5.5
This works great (precision of ~7 cm)

Hi @JustFineD, I would be interested. I’m currently trying to use GPS_INPUT (AC 3.5.5) but it seems liek Arducopter does not accepts the altitude. How did you manage the injection of position data?

Hi @xfly,
I just answer someone else in the forum how to override EKF when I want to use only external position system for Indoor flight.
Please looks the following link: Position Hold with VISION_POSITION_ESTIMATE and ATT_POS_MOCAP for indoor localization

I am using VIVE HTC system that send HIL_GPS messages (in 90 hz) to Arducopter.

Thanks for the tip :slight_smile: