Controlling Crazyflie with LPS

All discussions related to the Loco Positioning system
youngbin1130
Beginner
Posts: 25
Joined: Thu Dec 12, 2019 4:28 am

Re: Controlling Crazyflie with LPS

Post by youngbin1130 » Tue Apr 07, 2020 8:27 am

Ah, I see! I've taken a look at the State.Z log (which is under the LoPoTab2, I assume) and took a screenshot of it. I've attached the photo here. My LPS nodes are currently a little above the ground (around 20cm) if that means anything.

And yes, the government just announced a work from home for all except essential sectors so I have moved all my setup home a few days ago. Feel free to share about this!

Edit: I've tried the same code on my other 4 Crazyflies and they are giving me inconsistent results in terms of flying. 3 of those won't lift off the ground while 1 of it will just "run" towards the (+x,-y) direction. I'm really confused to as what's causing these problems.

Link to the two videos: https://youtu.be/0hiP7PEL0ec and https://youtu.be/5Wurz2ZazkI
Attachments
Kalman.state.PNG



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

Re: Controlling Crazyflie with LPS

Post by kimberly » Thu Apr 09, 2020 8:56 am

Thanks!

So currently the crazyflie thinks it is already 20 cms of the ground. Currently, the motion commander gives a default command to take off at 30 cm, which is only 10 cm higher. So what will happen, is that the crazyflie will only try to go up about 10 cms. Since the LPS system also have cm accuracy, this estimate can differ about 5-10 cm in the z direction. The other crazyflie probably already think that the have already reached 30 cm and therefore will not take the effort to take off. So there are two ways to fix this:
  • Give it an higher z setpoint, either with commander setpoint or with MotionCommander(scf, default_height=0.8) as mc: 0.8 is to replace the default of 0.3)
Let us know if this works

Great for letting us share it! Can you let us know from which lab/twitter you are, and if there are any hastags/names/ or links that you want us to use to give it more context?

youngbin1130
Beginner
Posts: 25
Joined: Thu Dec 12, 2019 4:28 am

Re: Controlling Crazyflie with LPS

Post by youngbin1130 » Tue Apr 21, 2020 5:23 am

Apologies in the delay in reply!

That seems to have fixed the problem with the motion controller. Thanks!

Apologies for asking an endless stream of questions but an additional question I would like to raise is whether I can make a trajectory of the Crazyflie using the motioncommander.py (or any velocity functions). From what I understand from the blog post from Bitcraze is that it uses X,Y,Z Yaw values for the 7th polynomial functions.

Regarding the Lab and working from home situation, I will drop you a message separately!

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

Re: Controlling Crazyflie with LPS

Post by kimberly » Tue Apr 21, 2020 7:45 am

Ah you mean this one: https://www.bitcraze.io/2019/08/creatin ... er-curves/

That is using the highlevel commander, so that you can copy the trajectory that is created by the bezier trajectory generator script in https://github.com/bitcraze/crazyflie-l ... h_level.py. That will upload the trajectory into the memory of the crazyflie and the highlevel commander will execute that once it is initialized.

Do make sure that the mellinger controller is not activated. Unfortunately that controller is only suitable for the lighthouse system and Mocap in terms of needed accuracy. Also double check that the trajectory created is small enough for your flight area (the 8 figure that is already in the script is about 1.5 by 2.5-3 meters).

youngbin1130
Beginner
Posts: 25
Joined: Thu Dec 12, 2019 4:28 am

Re: Controlling Crazyflie with LPS

Post by youngbin1130 » Wed Apr 22, 2020 3:18 pm

Thank you for your reply again!

I see! I don't think I have the space to test it out right now but I'll keep that in mind.

So, I guess my option is to either use the highlevel commander or continuously set the velocity (both linear and angular) in the script. I'll have to think about it a little more of how I'm going to execute this. For the motioncommander.py and for the trajectory, would it be possible to send a set of instruction in real time (ex. instructions from the simulation to real world)?

Regarding the lighthouse, how many lighthouses is recommended for a swarm system? I would assume it would vary with the area I'm trying to cover.

Apologies once again for asking too many questions! I'm really new to all this and every answer just leads to another set of questions. :o

kristoffer
Bitcraze
Posts: 256
Joined: Tue Jun 30, 2015 7:47 am

Re: Controlling Crazyflie with LPS

Post by kristoffer » Thu Apr 23, 2020 8:30 am

So, I guess my option is to either use the highlevel commander or continuously set the velocity (both linear and angular) in the script. I'll have to think about it a little more of how I'm going to execute this. For the motioncommander.py and for the trajectory, would it be possible to send a set of instruction in real time (ex. instructions from the simulation to real world)?
The key difference between the high level commander and the motion commander is pretty much what you are saying:
* with the high level commander the action is happening in the Crazyfle and the set point is continuously updated by a task in the platform
* with the motion commander the action is in the PC instead. There is a thread in motion_commander.py (https://github.com/bitcraze/crazyflie-l ... #L419-L484) that continuously sends set points to the Crazyflie.

If you don't want to use the motion commander, you can write a script that sends the set points directly instead. Just remember to keep sending them at least 4 times/s since there is a safety feature in the Crazyflie that will stop the motors otherwise.
Regarding the lighthouse, how many lighthouses is recommended for a swarm system? I would assume it would vary with the area I'm trying to cover.
It might be better to start a new thread when new questions pops up that are too far from the original topic ;-) but give a quick answer.
Lighthouse V1 is limited to 2 base stations. Lighthouse V2 is still very experimental and 2 base stations are supported, but it is technically possible to extend to more and we hope this will happen in the future. 2 Base stations cover around 4-5 meters in square.

Post Reply