Page 2 of 2

Re: Controlling Crazyflie with LPS

Posted: Tue Apr 07, 2020 8:27 am
by youngbin1130
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

Re: Controlling Crazyflie with LPS

Posted: Thu Apr 09, 2020 8:56 am
by kimberly
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?

Re: Controlling Crazyflie with LPS

Posted: Tue Apr 21, 2020 5:23 am
by youngbin1130
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!

Re: Controlling Crazyflie with LPS

Posted: Tue Apr 21, 2020 7:45 am
by kimberly
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).

Re: Controlling Crazyflie with LPS

Posted: Wed Apr 22, 2020 3:18 pm
by youngbin1130
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

Re: Controlling Crazyflie with LPS

Posted: Thu Apr 23, 2020 8:30 am
by kristoffer
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.

Re: Controlling Crazyflie with LPS

Posted: Tue Jun 16, 2020 2:11 pm
by youngbin1130
Hi Kristoffer,

A little delayed on the reply but thanks for it.

Is there any example where I can take a look at how _SetPointThread is being used? I have been testing out the motion_commander.py for a while but it seems that combining a movement function (ex. mc.forward, mc.backward) and a rotation function (ex. mc.turn_right,mc.turn_left) can't be run at the same time. What I would want to achieve is sort of an arc movement with only using the velocity functions. Would this be possible?

Re: Controlling Crazyflie with LPS

Posted: Thu Jun 18, 2020 10:02 am
by kristoffer
The _setPointThread is just a part of the implementation of the MotionCommander and it should not be used directly. You can use it for inspiration though.
The only thing that is important is to continuously send setpoints to the Crazyflie, either in a thread or in a loop. You can also look at autonomousSequence.py that sends setpoints directly using the Commander class.

I you want to send velocity set points, you should use the send_velocity_world_setpoint() instead of send_position_setpoint()
You can find the Commander implementation in https://github.com/bitcraze/crazyflie-l ... mmander.py