Waypoint following using the Crazyflie 2.0

Discussions about autonomous flight in general, regardless of positioning method
kross787
Beginner
Posts: 9
Joined: Thu Jan 18, 2018 3:12 pm

Waypoint following using the Crazyflie 2.0

Post by kross787 » Thu Jan 18, 2018 3:28 pm

Hi All,

We got a crazyflie and LPS a few months ago and have been trying to get setup. Our main goal is, we would like to send it a waypoint (in LPS coordinates x, y, z) and would like the aircraft to get there.

We first tried the autonomous sequence python scrip available here -> https://github.com/bitcraze/crazyflie-l ... equence.py.

We found that if we simply turn the aircraft and LPS on and run the script it doesn't work. We need to:
1. go into the crazyflie python client
2. connect a controller and set "position hold"
3. fly the aircraft with the controller for an instant pressing the "assistance mode"
4. close that, and without rebooting the crazyflie run the autonomousSequence.py scrip.

If we don't do that and just run the script the aircraft goes outside of the area and crashes.

Then, we tried using the motion commander library, but as of now, there is no position feedback loop, so we can't use that.

I would like to know if anyone else is experiencing the same behavior on their setup. I've followed all the guides available on the website to setup the lps and the crazyflie, Im running the latest version of the code and the LPS is setup as TWR at the moment (in case that makes a difference).

Any help or comments would be welcomed!

Thanks



arnaud
Bitcraze
Posts: 2216
Joined: Tue Feb 06, 2007 12:36 pm

Re: Waypoint following using the Crazyflie 2.0

Post by arnaud » Fri Jan 19, 2018 9:48 am

What you need is to get the autonomous sequence script working, it will fulfill your purpose. So what we need to solve is why isn't it working.

The way it is supposed to work:
1 - You start your Crazyflie in the LPS system, facing X
2 - You launch the autonomous sequence script
3 - The script connects the Crazyflie, resets the kalman filter, and waits for the position to converge
4 - The script sends possition setpoints, the Crazyflie flies following the setpoints

If I understand you well, your problem is that at step 4 the Crazyflie just flies away instead of following the setpoints?

kross787
Beginner
Posts: 9
Joined: Thu Jan 18, 2018 3:12 pm

Re: Waypoint following using the Crazyflie 2.0

Post by kross787 » Fri Jan 19, 2018 3:57 pm

Hi Arnaud,

Thanks for replying. Yes, exactly. The script runs and sends the waypoints with no error. However, the aircraft just flies away. I have not change any of the default parameters in the code.

arnaud
Bitcraze
Posts: 2216
Joined: Tue Feb 06, 2007 12:36 pm

Re: Waypoint following using the Crazyflie 2.0

Post by arnaud » Mon Jan 22, 2018 12:15 pm

Do you start the Crazyfile withing the convex hull formed by the anchor and with the front facing X?

One thing you could try is to disable the kalman reset there: https://github.com/bitcraze/crazyflie-l ... ce.py#L149. This line will reset the estimator and waits for it to stabilize. It could be that the algorithm used has a bug. If you disable this line, make sure you start the Crazyflie in the convex hull, facing X, and wait a couple of second to let the EKF converge before launching the script.

kross787
Beginner
Posts: 9
Joined: Thu Jan 18, 2018 3:12 pm

Re: Waypoint following using the Crazyflie 2.0

Post by kross787 » Mon Jan 22, 2018 1:59 pm

Hi Arnaud,

Thanks for the support. We have now tried with and without the Kalman reset and in both situations it only works when the aircraft nose if pointing X as you suggest.

Could you please point me to the library function I can use to read attitude information from the aircraft (pitch roll yaw).

Thanks,

Khris

arnaud
Bitcraze
Posts: 2216
Joined: Tue Feb 06, 2007 12:36 pm

Re: Waypoint following using the Crazyflie 2.0

Post by arnaud » Mon Jan 22, 2018 2:09 pm

You can read the attitude using the log subsystem, you can find an example of how to use the log (basiclog.py) in the example folder of the lib.

Though, it will not help you in that case since the problem is that the Crazyflie does not have an accurate estimate of its global YAW unless you start the Crazyflie facing X (YAW = 0). This is dues to the fact that the LPS system is not able to measure the Crazyflie yaw, so a good yaw initial estimate is required. When flying, the Kalman filter is using the flight dynamic to estimate the yaw.

kross787
Beginner
Posts: 9
Joined: Thu Jan 18, 2018 3:12 pm

Re: Waypoint following using the Crazyflie 2.0

Post by kross787 » Mon Jan 22, 2018 3:12 pm

Thanks, that makes perfect sense now.

I will look for the examples, thanks!

kross787
Beginner
Posts: 9
Joined: Thu Jan 18, 2018 3:12 pm

Re: Waypoint following using the Crazyflie 2.0

Post by kross787 » Tue Jan 23, 2018 3:59 pm

Hi,

One more question, is there anyway of getting the updated position of the drone without the callback function? something like "get_Position" ?

thanks,

arnaud
Bitcraze
Posts: 2216
Joined: Tue Feb 06, 2007 12:36 pm

Re: Waypoint following using the Crazyflie 2.0

Post by arnaud » Wed Jan 24, 2018 8:08 am

No, there is no such things yet. The current API is pretty low level in the sense that it exposes what is happening at the protocol level: a packet is sent from the Crazyflie to the PC containing a log block, the API then calls a callback with this log block.

If you need such a function you can easily make it by storing the latest position from your callback in a variable and returning this variable with the get_position function.

kross787
Beginner
Posts: 9
Joined: Thu Jan 18, 2018 3:12 pm

Re: Waypoint following using the Crazyflie 2.0

Post by kross787 » Wed Jan 24, 2018 9:31 am

Thanks Arnaud,

We might spend some of time on this. In the mean time we wanted to share with you some progress. Very crude youtube video: https://www.youtube.com/watch?v=-o0YEk0 ... e=youtu.be

This is using the LPS with a crazyflie and a Oculus to control the position of the aircraft. On the background we have a simple position control loop being updated at around 50hz. The aircraft's position is being send via UDP to the computer running the VR environment and then the VR sends position requests to the computer running the crazyflie.

So far it only works when the aircraft starts by pointing +X.

Hope you enjoy it! Thanks for the support

Post Reply