Crazyflie 2.0 with GPS
-
- Member
- Posts: 75
- Joined: Mon Apr 06, 2015 6:47 pm
Crazyflie 2.0 with GPS
Hi,
I just connected a GPS receiver to my Crazyflie 2 and modified the STM32F405 crasyflie-firmware to decode a position-velocity-time message out of the receiver, pass this through the Crazyradio to the PC Client and observe it in the client log plotter tab. This is step one to see if it is working before fully integrating it onto an expansion board for the Crazyflie 2.
For the GPS I'm using a Ubloc Max M8C Pico Breakout mentioned earlier in this forum. It's advantages include:
* size and weight (1.5 g with passive chip antenna in place of larger size and heavier patch antenna)
* low power consumption (< 30 mA at 3.3V)
* rf front-end sensitivity (-167/-164 dBm)
* accurate positioning (dual frequency rf - gps & sbas)
* interface compatibility with the Crazyflie 2 (3.3V uart & i2c)
Some of the disadvantages are:
* no programmable flash
* no battery backup
* longer position fix (2d/3d/dgps) times
For my evaluation phase I'm using a bench power supply to power the GPS that is leisurely being placed on top of the Crazyflie 2. All my testing to-date has been indoors and fix times have taken as much as ~30 minutes. Outdoor performance is expected to be much much better (a few minutes) and I'm contemplating using a small but separate battery to power the GPS or use an external source to aid it until a solid fix is achieved. I've performed some qualitative testing of GPS performance while running the Crazyflie 2 motors, see a little tracking sensitivity degradation, but it appears that outdoor running with stronger satellite signals will be fine.
For the firmware part I started with the gps_ublox_dev branch source for the Crazyflie 1 (last authored on Mar 24 2014 ) and adapted it to the Crazyflie 2 (version 2014.12.0) source code. Many comments from the Bitcraze forum and Crazyflie (blog post) were extremely helpful in this regard. I stumbled in areas due to lack of knowledge and proficiencies, trying to remove stuff that isn't needed, getting into trouble, and backing off, but couldn't have succeeded without the prior fantastic work (marcus, arnaud, tobias, etc. thanks). My home brew firmware needs clean-up and detailed examination, but magically appears to be working well enough for my current purposes. The GPS receiver can be connected to either of the two external serial ports.
Next on my tentative agenda is:
* python binding of kde marble in pc client
* expansion board integration of max m8c receiver
* investigate using a power buck-boost converter circuit for vcc to receiver
* look into feasibility of adding position hold mode
I just connected a GPS receiver to my Crazyflie 2 and modified the STM32F405 crasyflie-firmware to decode a position-velocity-time message out of the receiver, pass this through the Crazyradio to the PC Client and observe it in the client log plotter tab. This is step one to see if it is working before fully integrating it onto an expansion board for the Crazyflie 2.
For the GPS I'm using a Ubloc Max M8C Pico Breakout mentioned earlier in this forum. It's advantages include:
* size and weight (1.5 g with passive chip antenna in place of larger size and heavier patch antenna)
* low power consumption (< 30 mA at 3.3V)
* rf front-end sensitivity (-167/-164 dBm)
* accurate positioning (dual frequency rf - gps & sbas)
* interface compatibility with the Crazyflie 2 (3.3V uart & i2c)
Some of the disadvantages are:
* no programmable flash
* no battery backup
* longer position fix (2d/3d/dgps) times
For my evaluation phase I'm using a bench power supply to power the GPS that is leisurely being placed on top of the Crazyflie 2. All my testing to-date has been indoors and fix times have taken as much as ~30 minutes. Outdoor performance is expected to be much much better (a few minutes) and I'm contemplating using a small but separate battery to power the GPS or use an external source to aid it until a solid fix is achieved. I've performed some qualitative testing of GPS performance while running the Crazyflie 2 motors, see a little tracking sensitivity degradation, but it appears that outdoor running with stronger satellite signals will be fine.
For the firmware part I started with the gps_ublox_dev branch source for the Crazyflie 1 (last authored on Mar 24 2014 ) and adapted it to the Crazyflie 2 (version 2014.12.0) source code. Many comments from the Bitcraze forum and Crazyflie (blog post) were extremely helpful in this regard. I stumbled in areas due to lack of knowledge and proficiencies, trying to remove stuff that isn't needed, getting into trouble, and backing off, but couldn't have succeeded without the prior fantastic work (marcus, arnaud, tobias, etc. thanks). My home brew firmware needs clean-up and detailed examination, but magically appears to be working well enough for my current purposes. The GPS receiver can be connected to either of the two external serial ports.
Next on my tentative agenda is:
* python binding of kde marble in pc client
* expansion board integration of max m8c receiver
* investigate using a power buck-boost converter circuit for vcc to receiver
* look into feasibility of adding position hold mode
Re: Crazyflie 2.0 with GPS
Hi!
Nice work, glad to read about your progress!
As for Marble we are planning on dropping the support and replacing it with a webview + Leaflet (or similar). Here's a quick example we put together. The main problem with Marble is the Python bindings, which are still not standard when building the binaries for release. The change will just effect what you do with the logged variables, so it should be a small change. Using the webview will require an internet connection, but this was already a requirement for the tiles in Marble.
Using log variables (so you can easily plot and integrate) for the data is great. But during debugging we felt we needed more functionality. Ublox has a great utility for seeing what's going on named u-center. This can be used for debugging if you connect a UART to the module (just an FTDI cable will do). But we missed this functionality when we started using the module with the Crazyflie. So we talked a bit about creating a new port where information about satellites and signals could be sent, since this is a bit complex for using with the logging framework. But we never got around to doing it. So if you run into problems, let us know and we can look at this port again.
Good luck and keep us updated on the progress
Nice work, glad to read about your progress!
As for Marble we are planning on dropping the support and replacing it with a webview + Leaflet (or similar). Here's a quick example we put together. The main problem with Marble is the Python bindings, which are still not standard when building the binaries for release. The change will just effect what you do with the logged variables, so it should be a small change. Using the webview will require an internet connection, but this was already a requirement for the tiles in Marble.
Using log variables (so you can easily plot and integrate) for the data is great. But during debugging we felt we needed more functionality. Ublox has a great utility for seeing what's going on named u-center. This can be used for debugging if you connect a UART to the module (just an FTDI cable will do). But we missed this functionality when we started using the module with the Crazyflie. So we talked a bit about creating a new port where information about satellites and signals could be sent, since this is a bit complex for using with the logging framework. But we never got around to doing it. So if you run into problems, let us know and we can look at this port again.
Good luck and keep us updated on the progress

-
- Member
- Posts: 75
- Joined: Mon Apr 06, 2015 6:47 pm
Re: Crazyflie 2.0 with GPS
Hi,
Thanks for the heads-up on replacing Marble. I'll definetly look into the webview approach.
In fact I used u-center and uart-usb bridge (FT232R) to begin testing the GPS before tackling the Crazyflie 2 firmware implementation. This was when I discovered the gps_ublox_dev branch source uart.c contained an error in the const char “raw_0_setserial” stream where it was missing the last part of the payload and the ending checksum. Sending the as-was to the receiver got ignored and was not turning off all of the NMEA output messages. Upon adding the missing characters, it did what was intended. The as-was “raw_1_enpvt” message worked and indeed turned on the binary Nav-Pvt output message.
Thanks for the heads-up on replacing Marble. I'll definetly look into the webview approach.
In fact I used u-center and uart-usb bridge (FT232R) to begin testing the GPS before tackling the Crazyflie 2 firmware implementation. This was when I discovered the gps_ublox_dev branch source uart.c contained an error in the const char “raw_0_setserial” stream where it was missing the last part of the payload and the ending checksum. Sending the as-was to the receiver got ignored and was not turning off all of the NMEA output messages. Upon adding the missing characters, it did what was intended. The as-was “raw_1_enpvt” message worked and indeed turned on the binary Nav-Pvt output message.
-
- Member
- Posts: 75
- Joined: Mon Apr 06, 2015 6:47 pm
Re: Crazyflie 2.0 with GPS
Hi,
One of my recent objectives has been to modify PC Client to enable the GPS tab and to view GPS log data and show Lat/Lon visulations on a map. I modified the GpsTab.py file located in Crazyflie-Client_Python-2014.12.3 first by removing the Marble mapping and then inserting the Simple OSM Map View modules (map.py, map.js, map.html) referenced in an earlier message in this post topic, i.e., “Here's a quick example”. The provided map making modules were added as a subclass to the main class in GpsTab.
I'm now seeing real-time log data in the GPS tab and the map is properly showing up there as well. My next task is to be able to visualize positions on this map. Here's where I could use some expert help in both the recommended approach to be taken and possibly the recommended changes to the quick example modules. For reference, my work-in-process is located at http://github.com/jackemoore/cfclient-january.git in the gpstab branch. The GpsTab.py file can be found in the expected tabs directory. Please don't hold it against me for my lack of understanding. I'm not a developer or a programmer proficient in the basics or the nuances of any of these programs, including Python and any of its dependencies. At the moment I'm using a PC installed with Python-Folium-Leaflet rather than using Android-Webview-Leaflet under Ubunta OS.
Further help in my objective and investigation(s) would be greatly appreciated.
One of my recent objectives has been to modify PC Client to enable the GPS tab and to view GPS log data and show Lat/Lon visulations on a map. I modified the GpsTab.py file located in Crazyflie-Client_Python-2014.12.3 first by removing the Marble mapping and then inserting the Simple OSM Map View modules (map.py, map.js, map.html) referenced in an earlier message in this post topic, i.e., “Here's a quick example”. The provided map making modules were added as a subclass to the main class in GpsTab.
I'm now seeing real-time log data in the GPS tab and the map is properly showing up there as well. My next task is to be able to visualize positions on this map. Here's where I could use some expert help in both the recommended approach to be taken and possibly the recommended changes to the quick example modules. For reference, my work-in-process is located at http://github.com/jackemoore/cfclient-january.git in the gpstab branch. The GpsTab.py file can be found in the expected tabs directory. Please don't hold it against me for my lack of understanding. I'm not a developer or a programmer proficient in the basics or the nuances of any of these programs, including Python and any of its dependencies. At the moment I'm using a PC installed with Python-Folium-Leaflet rather than using Android-Webview-Leaflet under Ubunta OS.
Further help in my objective and investigation(s) would be greatly appreciated.
Re: Crazyflie 2.0 with GPS
Last week I added Google maps to cfclient and had it updating the position of a 1.0. I also added a compass toolkit w/ calibration saving from someone else's project. I am new to the whole git environment and am going to start getting my branch together tonight. Let me know if it is of interest to anyone and I can rush it a lil.
But onto what I can't crack. I have the 1.0 running gps just fine obviously there is a branch for it. I have no clue how to port it to 2.0?? Is this something you completed? If so are you willing to share your secrets?

But onto what I can't crack. I have the 1.0 running gps just fine obviously there is a branch for it. I have no clue how to port it to 2.0?? Is this something you completed? If so are you willing to share your secrets?

-
- Member
- Posts: 75
- Joined: Mon Apr 06, 2015 6:47 pm
Re: Crazyflie 2.0 with GPS
Hi,
This week I've been working on windows pc client (crazyflie-clients-python-2014.12.3 for crazyflie 2.0) to add google mapping of gps (implemented using python-leaflet). Getting close to working and will be happy to share source code for this as well as stm32f4 firmware upgrade that interfaces to ublox max m8c pico breakout gps receiver. I'm also new to the git environment and need a few days to complete my work and push it to a branch on github.
I 'm very interested in seeing your google maps in client for 1.0. This appears to be a much better approach than what I've been doing.
This week I've been working on windows pc client (crazyflie-clients-python-2014.12.3 for crazyflie 2.0) to add google mapping of gps (implemented using python-leaflet). Getting close to working and will be happy to share source code for this as well as stm32f4 firmware upgrade that interfaces to ublox max m8c pico breakout gps receiver. I'm also new to the git environment and need a few days to complete my work and push it to a branch on github.
I 'm very interested in seeing your google maps in client for 1.0. This appears to be a much better approach than what I've been doing.
-
- Member
- Posts: 75
- Joined: Mon Apr 06, 2015 6:47 pm
Re: Crazyflie 2.0 with GPS
Hi
My feasibility version of Windows PC Client with GPS Tab, showing at 1Hz both log data and Crazyflie 2.0 map location, appears to be working.
The Crazyflie 2.0 firmware was modified to interface to a ublox receiver and pass its data through the Crazyradio. Instead of using Marble on the PC side, the approach started with “here's a quick example we put together” that was forwarded by marcus. This code was modified to pass position data (lat, lng pairs) from the gpstab python code to leaflet javascript which generates the map. Python handles collecting the receiver data (log data) while leaflet imports an openstreetmap and adds a geojson vector layer for the Craztflie marker(s). My feasibility version code can be found at https://github.com/jackemoore/cfclient-gps-2.git in the gpstab branch.
This initial version of PC Client with GPS for Crazyflie 2.0 can, of course, use embellishments, for example a google map instead of osm, adding, a better Crazyflie marker (forward facing true heading indicator), Crazyflie routing lines, a home position marker, loss of connection/no fix map indicator, and possibly waypoints. I'd also like to look closer at what's been done for the Crazyflie 1.0.
My feasibility version of Windows PC Client with GPS Tab, showing at 1Hz both log data and Crazyflie 2.0 map location, appears to be working.
The Crazyflie 2.0 firmware was modified to interface to a ublox receiver and pass its data through the Crazyradio. Instead of using Marble on the PC side, the approach started with “here's a quick example we put together” that was forwarded by marcus. This code was modified to pass position data (lat, lng pairs) from the gpstab python code to leaflet javascript which generates the map. Python handles collecting the receiver data (log data) while leaflet imports an openstreetmap and adds a geojson vector layer for the Craztflie marker(s). My feasibility version code can be found at https://github.com/jackemoore/cfclient-gps-2.git in the gpstab branch.
This initial version of PC Client with GPS for Crazyflie 2.0 can, of course, use embellishments, for example a google map instead of osm, adding, a better Crazyflie marker (forward facing true heading indicator), Crazyflie routing lines, a home position marker, loss of connection/no fix map indicator, and possibly waypoints. I'd also like to look closer at what's been done for the Crazyflie 1.0.
-
- Beginner
- Posts: 17
- Joined: Wed Feb 11, 2015 7:39 pm
Re: Crazyflie 2.0 with GPS
Hi Jackemoore,
Can you share some of your code used to setup the UART for the GPS and explain the process of appending said code to the CF2 firmware? I can't seem to get my CF to read NMEA strings from my gps.
Can you share some of your code used to setup the UART for the GPS and explain the process of appending said code to the CF2 firmware? I can't seem to get my CF to read NMEA strings from my gps.
-
- Member
- Posts: 75
- Joined: Mon Apr 06, 2015 6:47 pm
Re: Crazyflie 2.0 with GPS
Hi t_walker_21,
My firmware code started with the github repository gps_ublox_dev branch source code for the Crazyflie 1.0 (ataffanel authored on mar 24 2014). I understand this work initially used the standard text-based nmea output messages, but later chose the proprietary binary format, UBX for uBlox, no text parsing had to be done, making it a lot easier to implement. Two ubx messages are sent to the gps receiver, one to disable all NMEA output and the second to enable the NAV-PVT binary output. If your receiver does not support ubx messages, some additional changes will be required to parse the nav text data. I will soon make available my firmware modifications on github.
My firmware code started with the github repository gps_ublox_dev branch source code for the Crazyflie 1.0 (ataffanel authored on mar 24 2014). I understand this work initially used the standard text-based nmea output messages, but later chose the proprietary binary format, UBX for uBlox, no text parsing had to be done, making it a lot easier to implement. Two ubx messages are sent to the gps receiver, one to disable all NMEA output and the second to enable the NAV-PVT binary output. If your receiver does not support ubx messages, some additional changes will be required to parse the nav text data. I will soon make available my firmware modifications on github.
-
- Member
- Posts: 75
- Joined: Mon Apr 06, 2015 6:47 pm
Re: Crazyflie 2.0 with GPS
Hi
To go along with pc client for cf2 with gps, my configuration for xbox360 mode2 and gps log data can be found at https://github.com/jackemoore/cfclient-gps-2-conf.git in the xbox360 branch.
My feasibility version of craszflie2-stm-gps-ubx-firmware source code can be found at https://github.com/jackemoore/cf2-stm-gps.git in the gpsubx branch. A quick summary of my modifications is as follows:
1. baseline source code crazyflie 2.0 2014.12.0 (dec 15 2014)
2. added drivers/include/uart_extgps.h
3. added drivers/include/ubx.h
4. added drivers/src/uart_extgps.c
5. modified makefile to unclude uart_extgps.o
6. modified modules/src/system.c
7. modified drivers/src/nvic.c
8. ublox gps receiver (3.3V logic at 9600 baud)
9. gps connected to crazyflie 2.0 (left side external tx1, rx1, gnd)
10. pc crazyradio pa separated by some distance from the cf2 gps receiver
11. my feasibility version firmware is just that
12. I use eclipse either in VMware Player or Oracle VM VirtualBox to Make CLOAD and Flash using radio to download the firmware
13. I use my win32 pc client (with modified gpstab) and wireless xbox360 to control the cf2 with gps
14. pc requires internet connection to download map at load time, but I assume is not necessary after cfclient loading is completed
To go along with pc client for cf2 with gps, my configuration for xbox360 mode2 and gps log data can be found at https://github.com/jackemoore/cfclient-gps-2-conf.git in the xbox360 branch.
My feasibility version of craszflie2-stm-gps-ubx-firmware source code can be found at https://github.com/jackemoore/cf2-stm-gps.git in the gpsubx branch. A quick summary of my modifications is as follows:
1. baseline source code crazyflie 2.0 2014.12.0 (dec 15 2014)
2. added drivers/include/uart_extgps.h
3. added drivers/include/ubx.h
4. added drivers/src/uart_extgps.c
5. modified makefile to unclude uart_extgps.o
6. modified modules/src/system.c
7. modified drivers/src/nvic.c
8. ublox gps receiver (3.3V logic at 9600 baud)
9. gps connected to crazyflie 2.0 (left side external tx1, rx1, gnd)
10. pc crazyradio pa separated by some distance from the cf2 gps receiver
11. my feasibility version firmware is just that
12. I use eclipse either in VMware Player or Oracle VM VirtualBox to Make CLOAD and Flash using radio to download the firmware
13. I use my win32 pc client (with modified gpstab) and wireless xbox360 to control the cf2 with gps
14. pc requires internet connection to download map at load time, but I assume is not necessary after cfclient loading is completed