The Loco Positioning system (LPS) project is a set of hardware and software designed to implement a local positioning system (LPS). Current hardware comprises one LPS Node and one LPS Deck. Both are based on the Decawave DWM1000 chip.
The local positioning system is based on the DecaWave DWM1000 module. The system consists of a number of anchors that are continuously pinged from the Crazyflie 2.0 deck that's based on the same module. The anchors are placed around the room at known positions.
Currently the local positioning system base setup is to fly a Crazyflie 2.0 autonomously using two-way ranging with 4 to 6 anchors placed at known location.
This getting started documentation is intended to guide you from receiving your Loco Positioning Indoor Explorer Bundle to having an autonomous Crazyflie 2.0.
For the Loco Positioning System early access we are using ROS on Ubuntu 16.04. So for the rest of this getting started I will assume that you have:
It is possible to run Ubuntu 16.04 in a virtual machine but it is not tested.
Since The LPS is in early access, the software is being updated quite often so you should use the latest version of both the node (anchor) and the Crazyflie 2.0. See the flashing documentation for the node.
The Kalman filter used position Crazyflie in the LPS is not yet part of the default firmware so you need to compile the Crazyflie firmware with Kalman support activated. Clone or pull the latest version from Github and put the following lines in your tools/make/config.mk:
ESTIMATOR = kalman
Compile and flash the Crazyflie:
make clean make make cload
For “make cload” to work, you need to have the Crazyflie client cloned and installed in the same folder as the Crazyflie firmware.
The anchors are addressed from 1 to 6. You need to set your nodes in anchor mode with the correct address using the usb port. See the node product page for more information.
The LPS nodes can be configured in 3 different modes; tag, anchor or sniffer. By default they come pre-configured as anchors. The anchors are powered with 5V either through micro usb, power jack or screw terminal. A nice way to power the anchors is to use usb power pack like we do here:
Place the anchors at least 15 cm from the wall or ceiling, and preferably at least 2 meter apart. We use 3d printed anchor-stands that can be found here. It is good if the anchors are placed above and bellow the wanted flight altitude to maximize Z accuracy. Avoid placing all the anchor in the same plane.
Try to place the anchors around your working area. See Dilution Of Precision.
The position in X/Y/Z of the anchor UWB antenna needs to be measured. To do so chose an origin (in a square/rectangular room one of the corners is a good choice), choose your axis to be a right-handed coordinates. Finally you can measure the X/Y/Z position of the anchors in this coordinate system. Using a corner as origin means that you can use a laser-ranger against the walls to get a direct reading of the coordinates.
The ROS module for positioning with the LPS is available on Github: https://github.com/bitcraze/lps-ros. It is developed and tested on ROS Kinetic running on Ubuntu 16.04. As of now ROS is the only software environment in which the system has been tested.
To get started from a newly installed Ubuntu 16.04:
sudo apt-get install ros-kinetic-joy
The positions of the anchors has to be entered in a configuration file. Create a file at catkin_ws/src/lps-ros/data/anchor_pos.yaml and enter your anchor coordinates. An example is present in the data folder:
n_anchors: 6 anchor0_pos: [ 0, 0, 1.85] anchor1_pos: [ 0, 2, 1.85] anchor2_pos: [ 4, 2, 1.85] anchor3_pos: [ 4, 0, 1.85] anchor4_pos: [1.3, 1, 1.85] anchor5_pos: [2.6, 1, 1.85]
The positions are in meters, [x, y, z], from the origin.
Anchor0 in ROS will be the anchor with address 1. Anchor5 in ROS is then the anchor programmed with address 6. This is because the anchors are addressed from 1 while the ROS implementation starts at 0. The inconsistency will be fixed in the future by addressing anchors starting by 0.
When this file is configured, connect an XBox 360 (or compatible) gamepad, start the Crazyflie 2.0 and launch:
$ roslaunch bitcraze_lps_estimator dwm_loc_ekf_hover.launch uri:=radio://0/80/250K x:=3 y:=2.3 z:=1.0
Change the URI with your copter radio configuration. You will see the anchor position in RED so that you can verify there position make sense. The Crazyflie position will be shown in green, before flying you can verify that the position is roughly correct.
The X,Y,Z parameter will be the hovering point, make sure they make sense in your setup and it is better to place the Crazyflie just under this first setpoint to start with. The gamepad mapping is (this is for an X-Box gamepad):
|B||Emergency stop (this is the red button ;)|
|Left joystick||X/Y position|
|Right joystick||Altitude/Yaw setpoint|
Note that the YAW setpoint is not handled yet.
There is an ongoing effort to implement all the functionality that is needed to use the Loco Positioning system without ROS, only using the Crazyflie client and lib. The support is not complete yet but there are a few useful tools.
The Loco Positioning tab in the PC-client can be used to validate anchor positions and to verify that the estimated position is reasonable.
Currently the anchor positions must be compiled into the Crazyflie firmware to make this work.
Rebuild the firmware and flash to the Crazyflie.
There is a python example to show how to send set-points to the Crazyflie: https://github.com/bitcraze/crazyflie-lib-python/blob/master/examples/autonomousSequence.py. Note that this script is also setting the anchor position so you have to make sure they are accurate.
There has been some recent work on Flying Crazyflie using TDoA measurement. This is still very experimental and not tested a lot but is is already pushed in our github repos. To get your Crazyflie to fly with TDoA position estimation you need to:
The anchor placement is even more important with TDoA. The Crazyflie must fly within the 3D convex hull formed by the anchors. For that reason it is easier to use 8 anchors. With 6 anchors you can place them forming 2 aligned triangle (one on the floor, one one the ceiling). Also since the anchor time are synchronized together it is very important that the anchors have direct line of sight between them.
You can then fly with the same launchfile as before. You can also try the new “dwm_loc_ekf_swarm_hover.launch” which is already setup for 5 Crazyflies. Just edit the top of the file to set the address and channel of your Crazyflies.