Hover using Python client

Firmware/software/electronics/mechanics
Post Reply
hariboddeeti
Beginner
Posts: 6
Joined: Thu Jan 11, 2018 8:06 pm

Hover using Python client

Post by hariboddeeti »

Hello Everyone,

I am having difficulty to hover using Python client, I am basically using

VX=0
VY=0
YawRate=0
zdesired=0.2
cf.commander.send_hover_setpoint(VX,Vy,YawRate,zdesired)

1) I could not able to hover for the desired amount of time. Although I am sending the commander instructions for every <=0.5s.
a) for suppose when I want my cf to hover for 10s, it is hovering only for 2s or 3s and slowly landing down.
b) when I am sending the commander instructions for every 10ms then it slowly going above my desired height say 0.2m
c) and do I need to set the cf.param.set_value('flightmode.althold','1') or not?

2)And I have mounted few extensions on cf which I think causing a huge drift, after going through few of the developers' discussions, I understood that it cannot be eliminated completely, However, it(drift) can be reduced by PID tuning, how to start the tuning is it a trial and error?

Regards,
Hari
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Hover using Python client

Post by arnaud »

The setpoint you are sending looks correct, it needs to be sent at least twice a seconds, if you send it at 10Hz you will be safe :).

Are you using a flow deck on your Crazyflie? If you are using the flow deck and if the lightning condition is good over a trackable surface, the Crazyflie should over just right.

The PID settings can be changed using parameters. The simplest would be to use the client in hover mode and change the parameters in the parameter tab. Though, the current setting should be good enough to hover on place so tunning the PID would not be the first thing I would look at.
hariboddeeti
Beginner
Posts: 6
Joined: Thu Jan 11, 2018 8:06 pm

Re: Hover using Python client

Post by hariboddeeti »

Thank you Arnaud for responding to my query, those suggestions are helpful.
hariboddeeti
Beginner
Posts: 6
Joined: Thu Jan 11, 2018 8:06 pm

Re: Hover using Python client

Post by hariboddeeti »

Hello Arnaud,

After trying your suggestion of sending the setpoint at 10Hz. I can still see the crazyflie not holding its altitude, it keep lifting higher than the desired Height. Also I am not using the flow deck. How much important is flow deck for hovering? I mean with out flow deck crazyflie cannot hover at the desired point?

Regards,
Hari
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Hover using Python client

Post by arnaud »

Without extra sensors the Crazyflie does not know how it is moving in the room so it is incapable of hovering at the same spot.

The flow deck provides absolute height and relative X/Y measurement that allows the Crazyflie to hover in place. Hovering is also possible with any positioning system (LPS, MOCAP, Webcam and some custom opencv code, ....).

The Crazyflie contains a pressure sensor that should give some Z control, though the data from this pressure sensor are very noisy and the Z control will be quite inacurate compared to using a flow deck or a z-ranger.
hariboddeeti
Beginner
Posts: 6
Joined: Thu Jan 11, 2018 8:06 pm

Re: Hover using Python client

Post by hariboddeeti »

Thank you so much arnaud, I started Using MOCAP, everything is good now.
jsalts
Beginner
Posts: 14
Joined: Tue Jan 16, 2018 12:34 pm

Re: Hover using Python client

Post by jsalts »

Hi, I’m currently doing a project similar to yours. The MoCap that I’m using is OptiTrack Motion Capture. Can you share your way on how I can send data from the MoCap to the crazyflie? Any input would be appreciated. Thank you very much!
Post Reply