1. Provided will be using a ZRanger module, is there a way to hardcode height hold mode in the crazyflie firmware so that whenever we power ON the crazyflie, it starts hovering automatically in height hold mode. If yes, can you please tell me the package where we can actually hard code this mode?

2. Where exactly in the crazyflie's firmware, the default height of height hold mode is stored?

Using Z-ranger the Crazyflie will drift away in X-Y so you have to be a bit careful with the fully autonomous functionalities.

To answer your questions without making too many assuption:
1. Yes it is possible. You need to call the commanderSetSetpoint function with the setpoint you want: https://github.com/bitcraze/crazyflie-f ... nder.h#L46. The priority parameter allows to set if the setpoint can be overwritten by setpoints received via the radio.

2. The default height when flying from the Crazyflie client is not defined in the firmware, it is set from within the client.

I am trying not to make too many assumption. For me to be more precise you need to tell a bit more what is your end goal. Do you want to completely disable the radio setpoint or do you just want to set the height and send only roll pitch by radio? Do you want to implement more complex autonomous behavior or just set the height?

My main goal is to set some default (example something like 1m well measurable by the ZRanger module) height of the quad and then just to send the ROLL, YAW and PITCH commands from the client (from android client specifically via BLE). Thus we want the quad to by default start hovering at some specific height, so the pilot do not need to bother about setting and holding the thrust all the time and so that he can just maneuver the quad with ROLL/YAW/PITCH commands.

1. Thus I also was curious to know about like how exactly to command the quad to start hovering at that set DEFAULT HEIGHT. From the function crtpCommanderRpytDecodeSetpoint(), it looks to me like we have to give some thrust value to set the default height. Is it true? and then set thrustLocked = true or something.

2. I see some if statements defined in the function crtpCommanderRpytDecodeSetpoint(), based on boolean values like the following:static bool thrustLocked = true;
static bool altHoldMode = false; (I believe this is the one for height hold that I might need to set)
static bool posHoldMode = false;
static bool posSetMode = false;
Can you tell me a little about these? like where exactly these things are set in the crazyflie firmware (I believe these come from the clients like when from the drop down menu you select the flight mode)? and do I need to bother setting these when hardcoding HEIGHT HOLD mode?

3. Can you also tell me a little about the three priority modes that we have declared - COMMANDER_PRIORITY_DISABLE, COMMANDER_PRIORITY_CRTP, and OMMANDER_PRIORITY_EXTRX?

4. In the function crtpCommanderRpytDecodeSetpoint() in crtp_commander_rpyt.c, can you tell me what exactly are these velocity modes defined in the enum mode_e i.e. being set to mode.z in the following code t line 159:

Thanks for describing your high-level goal, it makes it much easier for me to help you .

There is no such things as default height defined in the firmware. All setpoint are currently sent from the ground.

I will answer your question first and then propose a better way to go forward:

1. This variable implements a trust lock to avoid having the crazyflie jumping uppon connection if your gamepad is lock to max thrust (this can happen with PS3 gamepads before pressing the PS button ...).

2. These variables are used to pass X/Y/Z position setpoint in the roll/pitch/yaw commander packet. This was a hack and you should certainly not use that anymore (see bellow).

3. The priorities allows to have multiple setpoint source enabled but not affecting each other. The highest priority will set the setpoint, if no setpoint is sent for one second, a lower priority source can take over. This can be useful to implement an internal sequencer but keep a way to take over from the ground. Though this is a hard switch: there is no mixing between source, it is one or another.

4. This piece of code will set the Z controller in velocity mode, the Z velocity is "setpoint->velocity.z" in m/s. As said earlier, this is a hack to pass position or velocity data in a roll/pitch/yaw/thrust packet. This should be considered legacy code.

Now for the better way: there is now a 'generic' commander packet that is aimed at sending setpoints in there original unit without having to hack around with parameter and roll/pitch/yaw packets. It is implemented there: https://github.com/bitcraze/crazyflie-f ... _generic.c. You can try to find a packet that fits your needs or create a new one.

From your description, I think the packet you need is zDistance: https://github.com/bitcraze/crazyflie-f ... #L113-L144. It is used in the client for height-hold mode. It will allow you to send an absolute height (ie. 1 meter) and send the roll/pitch/yaw setpoints from the user.

How exactly should I proceed making these changes in the mobile platform? I was trying to make the drone 'hover' when controlling it through mobile app, and did not find a good way to do so; is there an existing code you know that could do so? If not, where should I start? I tried to look over the links given, but I did not quite understand what I had to do with those. I also visited several forums online but they are either specific to PC client or are written for very high-level programmers whose language I don't understand. It would be great if you could tell me in simpler terms what I should do, in some ways I can understand as a beginner.

To be specific, I was trying to use the z-sensor to keep the drone at a fixed height. I am not sure what changes to make in which files for the android client to successfully do so.

My main high level goal is very similar to that of abhishekkumar1902. Using the android client via BLE connection, we'd like to have a GUI toggle button on the android client that makes the Crazyflie hover at a set height with the help of the z-ranger.

I have been trying to modify the implementation of altitude hold for the android client from the pull request you linked to, but the GUI button that is appearing on the android client is unresponsive. I have tried modifying the pull request example with the zDistance packet, but the GUI hover button is still unresponsive. I think part of the problem is that I also want to circumvent the need/safety measure of the gamepad controller and crazy-radio dongle and only use BLE connection. If you could elaborate on how to modify the Atlhold pull request with the zDistance packet that would be great to help me move forward with my project! If you have any other suggestions or need more clarification please let me know and I'd be happy to elaborate!

Since these message, there is zranger support implemented in the client: https://github.com/bitcraze/crazyflie-a ... 529ea48bf9. It is only working using Crazyradio and a Gamepad but it is working (just tested it).You should be able to force it to work with BLE by altering the checks and it should work with BLE and gamepad. If it works the only things left will be to add GUI control for it.