reset filter

Firmware/software/electronics/mechanics
Post Reply
RyanMco
Expert
Posts: 158
Joined: Tue Apr 09, 2019 6:15 am

reset filter

Post by RyanMco » Sat Dec 21, 2019 9:45 am

Hi guys!
1) one question, when I use flowdeck then automaticallu kalman filter is chosen, but if I use external positioning system, then which filter is used? kalman? in my make file I didn't config any parameters, as I downloaded the firmware it's assigned on "any"

2) second question, How can I reset the kalman filter with the last state values as estimated by the flowdeck? I mean where should I go in my firmware in order to update and reset the kalman filter with specific values that I want(in my case with the last values as estimated by flowdeck) .. any help where in my firmware code to go in order to assign and reset kalman filter with the last state values that I decide them?! thanks alot.

3) third question, how can I empty the updated queue states values of flowdeck that's entered to the kalman filter? what should I write in my firmware? and where it's found?
I would like to empty the kalman's queue of flowdeck because I don't want to use that queue at all, I want to use another queue of external position, but in order to do that I want first to empty what's found in my flowdeck kalman's queue which in that queue it's getting states from flowdeck and entering them by this queue to the kalman filter ..



thanks



RyanMco
Expert
Posts: 158
Joined: Tue Apr 09, 2019 6:15 am

Re: reset filter

Post by RyanMco » Sat Dec 21, 2019 10:29 pm

Any help?

kimberly
Bitcraze
Posts: 459
Joined: Fri Jul 06, 2018 11:13 am

Re: reset filter

Post by kimberly » Mon Dec 23, 2019 10:29 am

1) This is automatically selected due to this line of code in src/deck/drivers/srce/flowdeck_v1v2.c :
static const DeckDriver flowdeck2_deck = {
.vid = 0xBC,
.pid = 0x0F,
.name = "bcFlow2",

.usedGpio = 0, // FIXME: set the used pins
.requiredEstimator = kalmanEstimator,

.init = flowdeck2Init,
.test = flowdeck2Test,
};

There is a good reason for this, since the complementary filter (the other filter) does not handle position and velocity measurements and therefore only in act if you want the fly the crazyflie without an positioning system or the flowdeck. So yes, also external positioning system use the kalmanfilter

2) Firstly, the function that resets the actual values is: void kalmanCoreInit() in kalmanCore.c, which is called by estimatorKalmanInit() in estimator_kalman.c. You would need to add the values of the last state estimate as a input to both those functions, so that kalmanCoreInit is able to put it as the initial values for the initialization of the kalmanfilter. Do this in small steps though, since it will be unsure how the kalman filter will react to it since you are making essential changes to it.

3) The queues are already being emptied when estimatorKalmanInit() (estimator_kalman.c) is called.

Post Reply