Page 1 of 2

Problems with HighLevelCommander

Posted: Tue May 11, 2021 2:58 pm
by dalisha18
Hello everyone,


I am trying to use the HighLevelCommander. However, Crazyflie crashes many times and does not fly properly at all. Sometimes it is also hard turn off the propellers of the Crazyflie, even I have stopped the script. The propellers only turn off after some minutes. So it is getting quite hard to control the Crazyflie.

This is my code.

Code: Select all



with SyncCrazyflie(URI, cf=Crazyflie(rw_cache='./cache')) as scf:
    
	cf = scf.cf
	activate_high_level_commander(cf)
	commander = cf.high_level_commander

	time.sleep(1)    
	commander.takeoff(0.5, 2.0) 
	time.sleep(2)
	commander.go_to(0.2,0.1,0.1,0, 4.0, relative=False)
	time.sleep(2)
	commander.land(0.0, 2.0)
	time.sleep(2)
	commander.stop()
	
I would appreciate your feedback.

Dalisha

Re: Problems with HighLevelCommander

Posted: Wed May 12, 2021 6:25 am
by jonasdn
Hi dalisha!

Some questions:
  • What does the function activate_high_level_commander(cf) do?
  • Am I correct in assuming that you want to go to the _absolute position_ of (0.2, 0.2, 0.1) ? And take 4s to go there?
  • What kind of positioning system are you using?
You could attempt to reset the kalman estimator before taking off to make sure you have a fresh start:

Code: Select all

def reset_estimator(cf):
    cf.param.set_value('kalman.resetEstimation', '1')
    time.sleep(0.1)
    cf.param.set_value('kalman.resetEstimation', '0')

Re: Problems with HighLevelCommander

Posted: Sat May 15, 2021 1:50 pm
by dalisha18
Hi jonas,

Thank you for your reply!

This is what the activate_high_level_commander(cf) is doing:

Code: Select all

def activate_high_level_commander(cf):
    cf.param.set_value('commander.enHighLevel', '1')

Yes, I want to go to the mentioned absolute position in 4 seconds.


I am using the normal Loco positioning system.


Regards,

Dalisha

Re: Problems with HighLevelCommander

Posted: Wed May 19, 2021 6:34 am
by kristoffer
Hi!

I'm not sure exactly what the problem is, but I might have some leads for you.

The first thing to check is that you have a stable position estimate, if the estimated position is bad the Crazyflie will not be able to fly. Use the python client and open the LPS tab to check the position, it should be fairly stable and usually moves around 10 cm. Also check that the position is OK when you move the Crazyflie around by hand.

The orientation of the Crazyflie is important before take off, make sure it is oriented like this https://www.bitcraze.io/documentation/t ... using-lps/

One problem that has been seen is that the estimated position in Z is off a bit which causes problems when the CF takes off/lands as it is aiming for the wrong height. Check what the estimated Z is when the CF is on the ground.
Sometimes it is also hard turn off the propellers of the Crazyflie, even I have stopped the script.
When you have enabled the high level commander, it will control the CF also if you terminate your script and this maybe what you see. You could write another script that turns off the high level commander or simply reboot the CF.

Re: Problems with HighLevelCommander

Posted: Wed Jun 30, 2021 4:45 pm
by DarkKnight
Hi, Dalisha,

when I try to use HighLevelCommander, I refer to your code. However, I faced the same issue as you mentioned here. have you find the reason for that?

Also,thank for the krisoffer's reply. I have done some tests by moving Crazyflie around by hand, under those situations, the position estimation and orientation estimation looks good(see attached picture). But once I let Crazyflie fly by using HighLevelCommander, It will fly around 1-2 seconds, and then it will crash. If you have already solved this issue, could you give some hints here?

Thanks in advance!

Re: Problems with HighLevelCommander

Posted: Thu Jul 01, 2021 11:53 am
by jonasdn
Hi!

Could you perhaps run the client and copy and paste what the console says on boot?

Jonas

Re: Problems with HighLevelCommander

Posted: Thu Jul 01, 2021 11:55 pm
by DarkKnight
Hi, jonasdn,

I have done some comparative experiments and I think I have found the reason. In my side, the external pose is from Optitrack, and when frequency of pose equals 100 hz(this is the frequency that I used before), then crazyflie will crash. But once I lower the frequency of pose to 30 HZ and 60 HZ, the Crazflie fly well. Any frequency of external pose which is equal or larger than 100HZ, then Crazyflie will crash. When you use Qualisys, have you meet the same issue? what frequency do you use when Crazyflie fly well?

Re: Problems with HighLevelCommander

Posted: Mon Jul 05, 2021 1:18 pm
by dalisha18
Hi DarkKnight,


that's really really great of you that you could find a possible solution of this problem!! I was sitting on this so long .


However, I will test it again with a lower frequency as you mentioned. And I will tell you my result.


Thank you so much for your time!


Regards,

Dalisha

Re: Problems with HighLevelCommander

Posted: Tue Jul 06, 2021 4:37 am
by jonasdn
Hi!

The Crazyflie can handle around 400 - 1000 packets per seconds, depending on surroundings and whether you are using a VM or not, and a packet has around 26 bytes as payload. Using this you can sort of calculate how much packets you can send to it, while simultaneous getting log data from it and so on.

Jonas

Re: Problems with HighLevelCommander

Posted: Fri Jul 09, 2021 2:27 pm
by DarkKnight
Hi, jonasdn,

thank you for your reply and this really helps a lot. One more question: what do you mean "depending on surrounding"? Does the surrounding electromagnetic environment also affect the number of bytes processed?