Hardcoding Altitude Hold

Post Reply
Posts: 4
Joined: Sun Aug 20, 2017 7:16 pm

Hardcoding Altitude Hold

Post by novneeton »

Hi guys,

I bought a couple of crazyflies early this month & have been flying them for two weeks now. I did the pid tuning & they were relatively stable only with the barometer. But once the flow deck with the ranging sensor arrived it has been holding height pretty well.

My question is in the windows client on the assisted mode only three options are available:
1. Height Hold (which is what I am using)
2. Hover Mode (which is oscillating too much)
3. Position Hold (did not try)

Altitude Mode is always disabled.

As for my understanding height hold has a pre fed altitude (40cm), which it tries to maintain which is fine but I want to fly it through altitude hold which essentially will try to stabilize the copter at any height that I want (<2m, ranging sensor limit).

a) How can I set the altitude mode from within the code?
b) And how exactly does hover mode work?
Posts: 2353
Joined: Tue Feb 06, 2007 12:36 pm

Re: Hardcoding Altitude Hold

Post by arnaud »


We have added a couple of limitation because of the current state of the algorithms:
- Depending of the lightning condition, the VL53 ranging sensor measurement deteriorates very quickly above 1meter
- With the flow sensor, the kalman filter is used and the kalman filter does not use the barometer (yet). Ideally the pressure and range from the vl53 should be merged.

If you want to try altitude hold you can remove the "self._assist_mode_combo.model().item(0).setEnabled(False)" there: https://github.com/bitcraze/crazyflie-c ... ab.py#L628. This will re-enable altitude hold with the zRanger and Flow decks. Be careful with it when flying high though.

If you want to experiment with using the pressure sensor with the flow you can activate it there: https://github.com/bitcraze/crazyflie-f ... lman.c#L73. You will have to be a bit careful when testing, this can make the kalman filter a bit unstable.
Posts: 10
Joined: Fri Oct 25, 2013 5:26 am

Re: Hardcoding Altitude Hold

Post by shreks7 »


I bought a bunch of flow decks to test hover mode, however, the z-distance/height in the Hover mode is oscillating. Even if you give it a little more thrust, it oscillates. The distance is less than 1m.

How to fix this? Do we try to fuse the data from both the sensors? How can we verify if the z-sensor is a good condition or not?

PS - If you watch the official youtube video for Flow Deck, It doesn't oscillate even at higher than 1m.
Posts: 2073
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Hardcoding Altitude Hold

Post by tobias »

From our experience the z-distance with the z-ranger should be pretty stable, at least below 1m. I'm thinking maybe vibrations could cause an oscillating behavior as the accelerometer is also used. You could give our experimental propeller test FW a try.

If you would like to plot the z-ranger value you can do this in the plotting tab and creating a log block with its log parameter range.zrange.
Post Reply