Crazyflie 2.0 position hold with OpenCV ArUco detector replication

Discussions related to positioning systems where the position is calculated outside the Crazyflie and sent to the device using radio, including MoCap systems
Post Reply
yukux
Beginner
Posts: 2
Joined: Mon Sep 11, 2017 6:59 pm

Crazyflie 2.0 position hold with OpenCV ArUco detector replication

Post by yukux »

Hello,

I've bought a crazyflie, and got a zmq and the aruco marker detection with the external position tab working on linux. But I'm wondering why position hold isn't working. I've been at this for about a day on just this problem now so any help would be appreciated. Here are the steps I'm following:

1. start crazyflie-ar-detector
2. start crazyflie client
3. connect to crazyflie
4. launch crazyflie with xbox controller
5. hit and hold assist button

After this point the motor cut out after a bit and the crazyflie just falls. Here are a couple of pictures of my setup.
http://imgur.com/a/iF8s4

what am I doing wrong here?
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Crazyflie 2.0 position hold with OpenCV ArUco detector replication

Post by arnaud »

Hi,

I moved the topic to the external positioning forum.

A couple of question to understand your setup
1. What version of the client and the Crazyflie are you using?
2. Are you compiling the Crazyflie firmware with Kalman filter enabled?

Your step looks correct if you select position hold in the client. The fact that the Crazyflie falls feels like you are using an old firmware (hence the above questions). You should run the latest firmware from git with Kalman filter forced ON.

One way to debug is to log first the extrernal position and then the Kalman filter estimation in order to find out if the position makes it to the Crazylfie. You can setup log blocks in the Crazyflie client and plot the positions values.

First you need to find out if the external position is making it to the Crazyflie by looking at ext_pos.[x y z], verify that the position makes sense, Z should be positive in the up direction.

If the external position is correct, you should check the output of the Kalman filter by looking at the log variables kalman.state[X Y Z]. Note that when the Crazyflie enters the camera sight there is a jump in position that can cause the Kalman filter to output NaN on all coordinate, you can reset the kalman filer using the parameter "kalman.resetEstimation", set it to 1 then 0 to reset the Kalman filter and then the position estimate should converge to the external position.
yukux
Beginner
Posts: 2
Joined: Mon Sep 11, 2017 6:59 pm

Re: Crazyflie 2.0 position hold with OpenCV ArUco detector replication

Post by yukux »

You are a wonderful person. I had to compile the firmware and load it with the kalman setting, pull the master client repo into the extpos repo I found specifically for this project, and then reset the filter parameter. I didn't even know how to log things and plot them before you mentioned it. Now the kalman filter is pretty much matching the external positioning.

This is shaping up to be a good day thanks to you.


Cheers.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Crazyflie 2.0 position hold with OpenCV ArUco detector replication

Post by arnaud »

Hi,
Glad that I could help. Please keep us updated of your progress :-).
Post Reply