Author: Arnaud

As noted in a previous post, Mike Hamer from ETH Zurich has been implementing an Extended Kalman Filter (EKF) for the Crazyflie. The beginning of this week I am visiting Michael at ETH and we have now pushed the EKF to the Crazyflie master branch!

Visiting ETH is really nice, and it is very impressive to see the Flying Machine Arena in real life. Though, owing to the Crazyflie’s size, we do not need such a big space and can work in a more regular-sized room.

The EKF has now been added to the master branch but is not enabled by default. It is currently intended to be used with the Loco positioning system (although it should be easy enough to integrate with onboard GPS, or potentially offboard motion capture measurements). While it does fly better than the currently used, offboard particle filter for autonomous flight, it requires some care to work properly. I am going to update the wiki description for the loco positioning to document how to get started with the EKF during the week. Our hope is that through community engagement and feedback, we can continue to improve and tune the filter, now that Mike has put the basic functionality in place.

The greatest enhancement is that the Crazyflie is now able to estimate its own position, without the help of an external computer. Coupled with the onboard controller, the Crazyflie can now fly fully autonomously. I have also pushed a new example in the Crazyflie python lib that shows how to send an X/Y/Z set-point to fly the Crazyflie, allowing it to fly through waypoints.

In the near future we (Bitcraze, and hopefully, the community!) need to work on a couple of more things to make it fly even better

  • Revamp of the controller: the current controller is a position controller, splitting it in two controllers, one for position and one for velocity, would allow for a more stable flight and to finally use TheSeanKelly new PID settings!
  • Implementing TDOA positioning on the LPS would allow more than one Crazyflie to fly at the same time
  • Implementing the new commander packet in the Crazyflie, python lib and ROS driver. This will allow us to stop hacking the current commander each time we need a new functionality (such as onboard position control) — and since I have push rights, only my hacks get pushed, which is unfair ;-).

Mike will describe the Kalman filter in greater details in a future post. In the mean time we will update on the progress in the Loco Positioning mailing list.

The loco positioning hardware is now manufactured and we are working hard on making it available. Loco positioning is still in early access, which means that we have tested the hardware but that the software still requires some love.

One of the big features still to implement is a position stabilization and position sensor fusion in the Crazyflie. This has been worked on from two fronts in the last weeks.

Community member jackemoore has been working hard on getting the Crazyflie 2.0 with a GPS deck working with position hold. He is getting close to having a GPS position hold working but has stumbled upon some system bugs that have to be solved first. You can follow, or even better help out, with the development on the forum post.

Mike Hamer, from ETH Zurich, has started to implement a Kalman filter, based on one of his publications, for the Crazyflie 2.0 firmware. This is still very much a work in progress but the initial results look promising. Mike has found and fixed a bunch of bugs on the way, which has greatly improved the firmware quality and stability. Since it is able to fuse the position estimate with the internal sensors, the Kalman filter will pair nicely with the GPS implementation from jackemoore to add a new layer of stability, as well as with the Loco positioning system. In addition, the Kalman filter is being written in such a way that it should be easy to incorporate additional sensors into the estimate. Keep your eyes open for a blog post in a couple of weeks with more detail on the Kalman filter’s inner workings, and hopefully a fully functional Kalman filter in the Crazyflie shortly thereafter :-).

We are excited to announce that we have just started the production of the first boards for the Loco Positioning system!
Since this is the first batch of a complex new product, we thought we should be there in person. This time, Tobias and Kristoffer went to visit Seeedstudio, our product manufacturer. It is always very nice to meet them in person and to visit the factory.
Also visiting the factory is always an opportunity to discover a new fashion style!

DSC_0525

The first boards to be produced are the Loco Nodes:

DSC_0529

After a minor problem: we specified the LEDs to be mounted reversed, quickly found and fixed for this first batch by the Seeedstudios engineers, the production of the nodes is looking good and the first 8 pieces are flawless!

DSC_0538

To go with the nodes, we need to have the Loco decks. Like for the other decks we have implemented the test rig based on a Crazyflie 2.0 programmed with special flags for the test. We found some issues with the rig software but it has been quickly sorted out. So the launch of the deck production, tomorrow Tuesday, should be without any hick-ups. This is what a deck test rig looks like (note the Crazyflie 2.0 being attached on the bottom):

DSC_0534
In other news we’re welcoming Aman in the Bitcraze team for the summer. Aman is flying straight from Kiruna at the very north of Sweden (before that from Germany and even before from his university in the US). He will be looking at improving control and stability of the Crazyflie. The fist step today was to learn how to fly it manually :-).

At Lund University PhD student Kenneth Bastone and professor Kalle Åström are currently using the Crazyflie and the Bitcraze ultra-wide band based Loco Positioning system as part of their research involving local positioning systems at Centre for Mathematical Sciences. We visited them a couple of week ago and though we would write a blog post to explains a bit how they use Crazyflie and the Loco positioning system.

lps-research-loco-positioning-kalle-åström

A local positioning system creates a number of interesting mathematical problems that PhD student Kenneth Bastone and professor Kalle Åström have decided to focus their current research on.

By experimenting with different technologies to create position estimations in 3D space they have come across a variety of different ways to explore indoor localization using a local positioning system. The origin of this work area was with optical tracking and localisation, it has since grown to include any technologies and configuration capable to be used for local positioning like radio and sound.

One focus area for instance is how to estimate transceiver node positions from measured transceiver distances, this is a key issue concerning for example radio antenna array calibration or mapping and positioning using ultra-wide band. Another problem is how to determine how many nodes the system needs to generate sufficient information and to understand how often the system needs to make estimations to work sufficiently well.

According to Kalle Åström solving this kind of problems regarding local positioning systems is one step closer to a whole new area of future applications. In particular it is a technology enabler that opens up the possibilities for new ways to study motion and/or behavior, for instance in healthcare or for analyzing performance in sports.

Recently Kalle and his team has had access to an Alpha Loco Positioning System, this has allowed them to apply their algorithm more specifically to ultra-wide-band based localisation. The algorithm is able to estimate the position of the anchors and of the Crazyflie from a set of distance measurements only. Using the local positioning system the Crazyflie can estimate its position by using the distances to the anchors and the position of the anchors in space. Here we have visualized the idea in 2D:

anchors1In this diagram the red point is the Crazyflie and the green and blue points are the anchors. We will look more at the anchor A3. If we see things the other way around, from the Crazyflie point of view, all we know about anchor A3 is how far away it is. So it could be anywhere on a circle:

anchors2

Now if we decide to go forward a little bit, the possible positions of A3 is reduced to 2 locations:

anchors3anchors4

As you can see in the figure, it is not enough to only go forward, we still have two intersection for the possible positions of A3. We need to make a turn:

anchors5

Now we have reduced the possible positions down to 1. We are not done yet because in reality the Crazyflie position is not known but by applying the same idea to anchor 1 and 2 the system is constrained so that the positions of all 3 anchors and of the Crazyflie can be found over time.

The algorithm is already working with the Crazyflie and the Loco Positioning system and allows the system to find the position of the anchors and the Crazyflie using a couple of seconds of data while the Crazyflie is moving around.

According to Kalle using the Crazyflie and the Loco Positioning system has proved to have some benefits. It is open-source which means that it can be modified easily to fit the research purpose. It is also safe and very practical to work with: a test system can easily and quickly be set-up as the Crazyflie does not require specific protection for people or equipment around it.

While it is a central part of a quadcopter the core of the Crazyflie 2.0 had not moved since we released it. We deemed it to be good enough, it was flying and going fast after all.

Recently TheSeanKelly from the community did not hear it that way and started investigating the flight performance starting by the attitude control PID. The results so far are impressive!

Sean tuned the rate loop a lot, this is the loop responsible to control the angular rate of the Crazyflie in roll and pitch. Doing that and the attitude loop could be tweaked which we did a bit, the one responsible to control the absolute orientation of the copter. And the results is that two major issues with the flight performance seems to be greatly improved:

  • The take-off behavior: Crazyflie is currently not taking-off straight by itself. With the new settings this is fixed and at any thrust Crazyflie just goes straight up.
  • Attitude control: We had a lot of overshot in the attitude control. Basically it means that if you go forward 10 degrees and request 0 degree (level) the Crazyflie will overshoot with a negative angle causing it to stop. With the new tighter control if you ask +10degrees pitch the crazyflie accelerates and if you ask 0 it just stop accelerating. It will then continue at nearly constant speed. This is the “correct” behavior. This also means that the Crazyflie now reacts much more precisely and quickly to joystick controls.

We have tried to make a short video to show the new performance. Though the attitude control is really hard to show. We installed a test pilot on our Crazyflie that shows how much the new parameters helps in overall stability (I have tried to steer with old parameters as hard as I was steering with the new one). We also show more stability in pretty windy condition.

These new parameter have been pushed protected by an experimental flag. After more testing the official firmware will have much better flight performance out of the box :-).

Like we announced last week we will be releasing the Loco Positioning system in a couple of weeks. Last week, we added product pages for the Loco Positioning boards on our website. We have also made a new short video explaining a bit on how it works with a demo:

Early access means that we have tested the hardware and are pretty confident it performs well. Though the software is still in a beta stage and requires some more love and will be evolving a lot over time. Right now we made sure that the ranging is working and we have some software, based on ROS, to fly the Crazyflie autonomously. We will make sure to document carefully the steps so that you can get started with the system quickly. We see two big functionalities that will be worked-on first: making the system able to control much more Crazyflies at once (right now the software is designed to handle only one Crazyflie), and moving positioning and controller into the Crazyflie which has the potential to enhance the flight performance a lot. More on that later.

If you want to receive information as the system evolves, sign up to our mailing list (we have added everyone that mailed us last week ;-). If you want to talk to us directly do not hesitate to comment or send us a mail at locopositioning@bitcraze.io.

As early as when the first Crazyflie prototype did it’s first flight back in 2009, we where dreaming about a local positioning system that would allow our future micro quadcopter to fly autonomously indoor. This dream is now becoming a reality with the development of the Ultra Wide Band radio that we have been using the last months to develop our own local positioning system for the Crazyflie 2.0. We are now reaching a very important milestone: the first early access production batch has been ordered!

We sat down to find a name for the system and since ‘Crazy’ is kind of a theme for our products here at Bitcraze we settled for “Loco Positioning”. So the two products we are about to launch are the Loco Positioning Node and the Loco Positioning Deck.

If you want to receive information as the system evolves, sign up to our mailing list. If you want to talk to us directly do not hesitate to comment or send us a mail at locopositioning@bitcraze.io.

The positioning system is based on the Decawave DW1000 Ultra Wide Band radio chip. These radios work by transmitting very short pulses instead of full sinus waves the way a standard radio would, and the advantage for positioning is that it is possible to measure the time at which these short pulses are received very precisely. By using clever algorithms it is possible to measure the time it took for the radio signal to “fly” from one radio to another and from that we can calculate the distance between the radios.

A basic system is composed from a number of Anchors (Loco Positioning Nodes) at fixed positions and a Tag on the Crazyflie 2.0 (the Loco Positioning Deck). The system continuously measures the distances from the Tag to the Anchors and calculates the position of the Tag from that information. The concept is similar to GPS where the Anchors represent the satellites and the Tag the GPS-receiver. 4 Anchors is the theoretical minimum required to calculate a 3D position, but 6 has turned out to be more realistic number.

We have designed the Loco Positioning Nodes as standalone boards containing a micro controller and the DWM1000 UWB radio module. The nodes are intended to act as Anchors: they are setup at fix positions in the room and will serve as references for the system.

locopos_node

The Loco Positioning Deck, also based on theDWM1000 module, acts as a Tag and plugs into the Crazyflie 2.0 expansion port. It allows the Crazyflie 2.0 to calculate its absolute position in space and this is all we need to start flying it autonomously in the room. In this case the Crazyflie 2.0 acts as a Tag, but since we are always striving for flexibility, the nodes can also act as Tags for example for other robotic application.

logopos_deck

We consider the first batch to be an early access release. This means that the hardware is finished and tested but the software is still very much work in progress. Currently the Crazyflie ranges with the Anchors, while a PC running ROS interprets the ranges and calculates the estimated position. More in depth information will come if future blog-posts and e-mails on the list. For a video and some more information see our previous post “Update on Local Positioning System“.

Crazyflie 2.0 already has two mobile clients, one for Android maintained by Fred and the iPhone client. Now we officially have a new one on development: the Windows client.

IMG_20160425_202412

Theseankelly, from the community, has started a Windows client for Crazyflie 2.0. It connects Crazyflie using bluetooth low energy and works both on phone and on PC running windows. Last week, he transferred the source code repos in the Bitcraze github so that it can have more visibility. We plan to eventually released it in the Windows store, but first it needs to have a little bit more features :-). To this end we have created a milestone on GitHub and have filled a couple of tasks. The plan is to get to a minimum set of functionalities. That for, we will focus on phone support first but if you are interested in PC support do not hesitate to say so and push tickets for it (gamepad support and configuration is the first thing I can think about for desktop support).

Last week Fred released a new version of the Android client. The outstanding new feature is a support of the LED and Buzzer decks when using Crazyradio! It means that you can now change the light effects and play sounds on the Crazyflie from the phone. This is even better because it means that the Android client code is now able to access the param subsystem and soon the log subsystem: this will allow for much more interactions in the future (like access to advanced Crazyflie settings and supporting more decks). The support of decks using BLE and more are on going so stay tuned and if you have any functionality request please head to the GitHub ticket tracker.

aclient-deck

We have just released a new version 2016.04.1 of the Crazyflie client.

client_2016.4.1

The biggest change is actually not so visible but very important: we have now separated the GUI client from the Crazyflie lib. The great advantage is that the lib became a small project and could be pushed to pypi. This means that if you want to control Crazyflie from your own Python program all you have to do is to “pip install cflib” and you are ready to “import cflib” in your program to control the Crazyflie.

For the new release of the client we also pushed the client in pypi as well. This will be mainly useful in Linux and Mac where you are now able to install the client with “pip3 install cfclient”. One little drawback however: since the GUI lib we are using, pyqt, is not in pypi it has to be installed on the side. This can be done in Ubuntu with something like “sudo apt-get python3-pyqt4 install python3-pyqtgraph” or on Mac with homebrew or MacPorts.

Last but not least we have enabled Windows continuous integration with appveyor and fixed the Windows build. This means that a Windows build and installer are going to be generated for every commit in the Crazyflie client repos. Maintaining the Windows client has always been a challenge to us since we are mainly Linux users, so the this will help a lot to keep good Windows support. We still consider this Windows build to be somewhat experimental so please test it and report any bug you are hitting.

The last system to support for executable distribution is Mac. We did put some time trying to generate a mac app out of the client without any success. If anyone wants to give it a try or have some tips please head to the ticket on github.

Historically the main way to control a Crazyflie has been by using a computer running a Crazyflie client and communicating with a Crazyradio (PA). However since very early we have made an Android client that also communicated using the Crazyradio. This was at the very beginning of USB On-The-Go for Android and it allowed to fly without a PC. When we released Crazyflie 2.0 with Bluetooth LE support we made an iPhone client as well as adding bluetooth to the Android client.

The Android App is the oldest and thanks to the community the most fully featured. It has a community maintainer, Fred, that is doing a great job a keeping the app stable and adding features.

android_client

With the Android app you can fly with both touchscreen control and game-pad control. It works with Bluetooth and Crazyradio. It can update Crazyflie 1.0 and Crazyflie 2.0 firmware using Crazyradio and soon Bluetooth for Crazyflie 2.0. Soon the possibility to use deck functionality like LED ring and Buzzer will be added.

The iPhone app is, for the moment, a bit more simple:

ios_main

 

It allows to fly and update Crazyflie 2.0 using Bluetooth low energy. There has already been a couple of contribution to keep the app up to date with Apple dev tools and more featured are currently being pushed.

Finally there is a new one coming soon. A windows 10 app prototype has been done by theseankelly and is just waiting to be enhanced. The exciting parts is that it works on Windows phone but it is also the first Bluetooth GUI client for Crazyflie 2.0 on desktop platform (there is nodejs libs that supports BLE on computer but no GUI that I know off, if I am wrong please comment!).

windows_client

A great thanks to all the contributors, the mobile clients for Crazyflie would not be that far without you! If you are interested in mobile development you are welcome to contribute, these clients started as a “just to fly” remote control but they could do so much more.