Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • danc/MicroCART
  • snawerdt/MicroCART_17-18
  • bbartels/MicroCART_17-18
  • jonahu/MicroCART
4 results
Show changes
Showing
with 248 additions and 0 deletions
FlyPi/crazyflie-firmware-2021.06/docs/images/mac_serial.png

117 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/mac_serial_about.png

79.9 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/pid.png

16.2 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/rkf-eq1.png

19.7 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/rkf-eq2.png

25.1 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/rkf-eq3.png

11.6 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/sensor.png

14.7 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/sensors_to_motors.png

25.9 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/setpoint_structure.png

92.3 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/stm_openocd_debugger.png

182 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/stm_openocd_main.png

131 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/stm_openocd_startup.png

170 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/vscode_cortex_debug.webp

42 KiB

FlyPi/crazyflie-firmware-2021.06/docs/images/windows_serial.png

43.6 KiB

---
title: Home
page_id: home
---
This project contains the documentation of the source code for the firmware used in the Crazyflie range of platforms.
## The Crazyflie 2.X family
This firmware suports the Crazyflie 2.X range of platforms, currently including:
* The Crazyflie 2.0
* The Crazyflie 2.1
* The Crazyflie Bolt
* The Roadrunner
### Crazyflie 1.0
The Crazyflie 1.0 is no longer supported, the 2017.06 release was the last release with Crazyflie 1.0 support. If you want
to play with the Crazyflie 1.0 and modify the code, please clone this repo and
branch off from the 2017.06 tag.
---
title: App layer
page_id: app_layer
---
## Introduction
The app-layer is a set of functionality and APIs to allow user to add custom code to the Crazyflie.
This is still an experimental functionalities but the intention is to eventually provide documentation and APIs to easily extend the Crazyflie and implement autonomous capabilities.
## App entry-point
When compiling the Crazyflie with ```APP=1``` writen either in the Makefile or in ```tools/make/config.mk``` the firmware will call a function ```void appMain()``` from a task after the startup sequence has completed.
This function should not return.
If you want more control, you can define a function ```void appInit()```. ```appInit()``` will be called by the firmware during initialisation, no task will be created and so ```appMain()``` will not be automaticall called.
This function must return to allow the Crazyflie initialization sequence to continue.
The folowing Makefile variables can be used for configuration:
- **APP**: Set to '1' to enable the app entry-point
- **APP_STACKSIZE**: Set the task stack size in 32bit word (4 Bytes). The default is 300 (1.2KBytes)
- **APP_PRIORITY**: Set the task priority between 0 and 5. Default is 0 (same as IDLE).
## Internal log and param system
For the app-layer, it would be good to have access to log and/or parameter values and to set parameter values. This way, your app will be able to read out sensor data or to switch controller/estimator on air. To check out these functions, look at src/modules/interface/log.h or .../param.h for the internal access functions. There is also an example to be found in /examples/app_internal_param_log/.
## LED sequences
It is possible to run LED sequences from the app layer to control the four LEDs on the Crazyflie and provide runtime information to the user. See the src/hal/interface/ledseq.h file for more information.
## App channel: packet based communication between the Crazyflie and the Python lib
The Appchannel API allows to communicate using radio packets with an app.
The packets can contain anything of a size up to 31 bytes, the protocol is defined by the app.
For more information about the API see the header file src/modules/interface/app_channel.h.
An example of how to use the app channel is in examples/app_appchannel_test/
## Examples
In the [example folder](https://github.com/bitcraze/crazyflie-firmware/tree/master/examples) of the crazyflie-firmware repository, there are several examples showing how to use the app layer, including a simple hello world example.
---
title: Deck API
page_id: deck
---
The Deck API allows to easily communicates with decks installed on the
Crazyflie. The deck API is still in development, it will:
- Enumerates installed Deck and initialize drivers (*pretty much
done*)
- Provides easy to use arduino-like API to access (*started*)
- Optionally provides a task to run in (arduino-like setup and loop)
(*not started yet*)
If you want to get started you can follow the
[howto](/docs/development/howto.md) to get your code
running.
Deck drivers
------------
Decks are enumerated automatically using a One Wire (OW) memory soldered
on the deck PCB. The Deck driver API is using a declarative syntax to
register deck drivers and initialize them when the proper deck is
installed.
### Minimal driver
This is a minimal deck driver, myled.c:
``` {.c}
#include "deck.h"
void myledInit(DeckInfo *info)
{
pinMode(DECK_GPIO_IO1, OUTPUT); // Set my Led pin to output
digitalWrite(DECK_GPIO_IO1, HIGH); // Light it up
}
bool myledTest()
{
return true;
}
const DeckDriver myled_driver = {
.vid = 0,
.pid = 0,
.name = "meMyled",
.usedGpio = DECK_USING_IO_1,
.init = myledInit,
.test = myledTest,
};
DECK_DRIVER(myled_driver);
```
- At startup the decks are enumerated and if a deck has the name
\"meMyled\", it will be initialized.
- Init is called on all initialized driver and then test is called.
- The init and test functions are both optional (we have some board
with only init and event some with only test). If absent just remove
the *.init* or *.test* initialisation.
- In this mode no task are created so to run some code at regular
intervale the code needs to deal with freeRtos or with the other
parts of the Crazyflie code.
To compile the driver, place it in deck/drivers/src/ and add it to the
Makefile:
``` {.make}
PROJ_OBJ += myled.o
```
### Forcing initialization of a driver
The deck driver will be initialized only if a deck is connected with the
right OW memory content. During development it is possible to force the
initialisation of a deck by adding a define in
\`\`\`tools/make/config.mk\`\`\`:
``` {.make}
CFLAGS += -DDECK_FORCE=meMyled
```
### Driver declaration API
*DECK\_DRIVER(const struct DeckDriver)*
To register a deck driver the DECK\_DRIVER() macro should be called with
a deck structure as argument.
#### DeckDriver structure
``` {.c}
typedef struct deck_driver {
/* Identification of the deck (written in the board) */
uint8_t vid;
uint8_t pid;
char *name;
/* Periphreal and Gpio used _dirrectly_ by the driver */
uint32_t usedPeriph;
uint32_t usedGpio;
/* Init and test functions */
void (*init)(struct deckInfo_s *);
bool (*test)(void);
} DeckDriver;
```
---
title: Active marker deck
page_id: active-marker-deck
---
The Active Marker deck is mainly designed for [Qualisys mocap systems](https://www.qualisys.com/) and supports Qualisys Active markers, but it can also be used with other systems in a simplified mode. The deck has 4 arms with one IR LED on the tip of each arm and a light sensor in the center of the deck.
The deck is configured using the [parameter sub system](/docs/userguides/logparam.md), for details on which parameter to use, see below.
## Modes
The deck mode is set with the ```activeMarker.mode``` parameter.
| Mode | value | comment |
| --------- | ----------- | ---------------------------- |
| OFF | 0 | Always off |
| PWM | 1 | Always on, PWM modulated |
| MODULATED | 2 | Switching |
| QUALISYS | 3 (default) | Qualisys Active Marker mode |
### Off mode
All marker LEDs are turned off.
### PWM mode
The marker LEDs are turned on and PWM modulated. The brightness of each LED is controlled by the [marker parameters](#marker-parameters) below, in the range 0 - 255.
### Modulated mode
The LEDs are switched on and off at around 42 kHz (24 micro seconds cycle). The brightness of the LEDs during the "on" part of the cycle is controlled by the [marker parameters](#marker-parameters) below, in the range 0 - 255.
### Qualisys mode
In this mode the LEDs act as Active markers with IDs that are identified by the Qualisys system and used for better 6-dof identification and tracking. The IDs are controlled by the [marker parameters](#marker-parameters) below. The Qualisys systems and the deck currently supports IDs in the range [0 - 170]
## Marker parameters
Each marker is associated with a parameters that is used to set brightness or id.
| Marker position | parameter | default value | type |
| --------------- | ------------------------ | ------------- | ----------------- |
| Front | ```activeMarker.front``` | 1 | ```PARAM_UINT8``` |
| Right | ```activeMarker.right``` | 2 | ```PARAM_UINT8``` |
| Back | ```activeMarker.back``` | 3 | ```PARAM_UINT8``` |
| Left | ```activeMarker.left``` | 4 | ```PARAM_UINT8``` |
---
title: Buzzer Deck
page_id: buzzer-deck
---
## Changing the sounds
Changing the sounds requires modifications to the firmware. The code for the sounds is located in [sound_cf.c](https://github.com/bitcraze/crazyflie-firmware/blob/master/src/modules/src/sound_cf2.c).
A sequences is defined in the .notes member of the Melody struct. The notes are defined as tuples of a note (pitch) and duration. A sequence must be ended with the end marker.
The effects are defined in the effects array. Each entry takes a function to call and related parameters.
To add a new melody, use the melodyplayer function for the .call member and assign your Melody struct to the .melody member.
## Parameters
|Name|Type|Access|Value (default)|Description|
|---|----|---|---|---
|sound.effect|uint8_t|RW|0|Sound effect (0=Off, 1=Factory test, 2=USB connected, 3=USB disconnected, 4=Charging done, 5=Low battery, 6=Startup, 7=Calibrated, 8=Range slow, 9=Range fast, 10=Star Wars Imperial March, 11=Bypass (change sound with sound.freg), 12=Siren, 13=Tilt (tilt the Crazyflie to play the sound))|
|sound.freq|uint16_t|RW|4000| |
|sound.neffect|uint32_t|RO|13|Number of available sound effects|
|sound.ratio|uint8_t|RW|0| |