Servers by jDrones

Position Hold with VISION_POSITION_ESTIMATE and ATT_POS_MOCAP for indoor localization


(Vince Kurtz) #6

@JustFineD - thanks for the information! I’d definitely prefer to fuse information from other sensors, but I’m glad to know that overriding the EKF position is a viable option if needed.

(Vince Kurtz) #7

For anyone interested in testing the external navigation messages in simulation, I set up a demonstration using SITL, Gazebo, and ROS here. The results match what I’ve observed in real life fairly well.

(rmackay9) #8


@chobitsfan found and fixed a small bug in our mocap consumption code. This is in master now so if you’re using the mission planner you can load the “latest” binary by opening the Initial Setup >> Install Firmware screen, press Ctrl-Q and then label should change to “ArduCopter V3.6-dev” and then click on the Copter icon and it should install as per usual. Alternatively you can download and install the firmware from the central server (use the -v3.px4 binary).

I’ve also created a binary which inclues chobitsfan’s change and also adds a VISION_LAG parameter which allows setting the lag in milliseconds. This value should never be set to a number > 2000 (i.e. 2seconds). Maybe you could try this and see if changing the lag affects performance? I.e. 200 for 0.2sec lag might be a reasonable number.

Just FYI, the changes I made to add this lag parameter are here.

(ppoirier) #9

@rmackay9 This PR adds the lag parameter, but I cannot see where it is processed as a delayed state within the EKF , Am I missing something here?

(rmackay9) #10

Hi Patrick,

It passes the lag into the EKF by adjusting the timestamp. so we subtract the lag from the timestamp and pass it in. This is the commit that adjust the timestamp.

(ppoirier) #11

@rmackay9 ok I see, other question , is Paul wip on EKF3 is complete or we still have to use EKF2?

(Chobitsfan) #12

Copter fly in circle mode using current master mentioned by @rmackay9 , parrot bebop using ardupilot, optitrack motion capture system. use ATT_POS_MOCAP to send external nav data to copter through wifi. COMPASS_USE=0, COMPASS_USE2=0, COMPASS_USE3, EK2_GPS_TYPE=3

(rmackay9) #13

This is fantastic! Can we blog this on It’d be best if it was you but I’ll do it if you’re too busy.

(rmackay9) #14

The EKF3 changes still need testing, peer review before going into master. I’m not sure of the timing but I think @priseborough has it in hand.

(Chobitsfan) #16

Can we blog this on It’d be best if it was you but I’ll do it if you’re too busy.

Hi @rmackay9 Thank you. It is done here. I am not a native speaker of English, so I am sorry if my article is difficult to understand.

(rmackay9) #17

Really great Chobitsfan, thanks!

(Gabe Simmons) #18

@vkurtz I’m interested in testing external nav messages in simulation. I cloned the ardupilot_gazebo package from your link into the src dir of an existing catkin workspace, ran catkin_make, but I am unable to do “roslaunch ardupilot_gazebo mavros_opitrack.launch”. It looks like ROS won’t recognize the package (won’t tab complete, etc.) Any ideas?

(Vince Kurtz) #19

Have you run the following?

source [catkin_ws]/devel/setup.bash
source /opt/ros/kinetic/setup.bash

I believe that’s necessary to properly initialize a new package

(Gabe Simmons) #20

@vkurtz Yes, ran those and still encountered the issue. However it’s resolved now, I ran rospack list and that seemed to get ros to update its package list. Thanks!

(Gabe Simmons) #21

Here is a video showing my results in Arducopter SITL, flying in guided mode using the VISION_LAG parameter binary. 250 ms seems to be the sweet spot for me. I am also noticing variance from the set position, mostly in the roll axis. I have followed @vkurtz’s parameter recommendations. Posting this in case anyone has additional recommendations to get the quad to track the external localization input more tightly.

(Vince Kurtz) #22

@gs1mm0ns I’ve had some luck improving the tracking performance in simulation by reducing the roll rate D gain: i.e. setting ATC_RAT_RLL_D = 0.0001

(Gabe Simmons) #23

@vkurtz Thank you, I’ll play with the roll rate D parameter and see if I can get improved behavior.

(Andrea Belloni) #24

@vkurtz I am looking at the code in your ardupilot_gazebo on github and I don’t understand if the values on this line for set_home_position are correct:

q should be in this form [w, x, y, z] and [1, 0, 0, 0] should be the null-rotation, why do you use [0, 0, 0, 1] instead?

(Vince Kurtz) #25

@anbello you are totally right about that, I was mixed up since ROS often uses [x, y, z, w]. It shouldn’t matter too much, since I believe the home position could be set with any valid orientation, but I’ve made the correction to the github repo. Thanks!

(Gabe Simmons) #26

@vkurtz this suggestion improved my performance in simulation immensely, thank you!