Getting started with the Loco Positioning system

Update and configure the nodes

In order to illustrate how to set up a system we have documented a reference system and how we’ve set it up. The reference system is based on the Indoor explorer bundle which contains the following:

  • 6 x Loco positioning nodes
  • 1 x Loco positioning deck
  • 1 x Crazyflie 2.0 kit
  • 1 x Crazyradio PA
  • 1 x micro-USB cable

Update the Crazyflie to the latest loco positioning firmware

To be able to use the Loco positioning system you need to update the Crazyflie to the latest firmware. For more information on how to update the firmware, see the download latest firmware section in our Getting started with Crazyflie 2.0 tutorial.

You will also need the latest version of the Crazyflie client. For mounting the Loco positioning deck check out the Getting started with expansion decks tutorial.

Download the LPS configuration tool

Before setting up the system you need to update the firmware and set the addresses of the nodes from 0-5. To do this download and run the LPS configuration tool exe file.

Download the LPS node firmware

For updating the LPS node firmware go here and download the “lps-node-firmware.dfu” file.

Update the node

  • To update the node start by opening up the LPS configuration tool. Keep the DFU button on the node pressed while connecting to your computer via USB. This will start the node in DFU mode.
  • If you are using Windows, the node will not be recognized the first time. You need to follow the instruction to install its USB driver using Zadig. In DFU mode, the node will be displayed as “STM32 BOOTLOADER” in Zadig.
LPS configuration tool
  • Click browse and choose the LPS node firmware
LPS configuration tool
  • Now update the node.
LPS configuration tool
  • When the update is done press reset.
LPS configuration tool

Disconnect the node from the USB and repeat the same procedure for all the nodes before configuring them.

Configuring the node into anchors

Now it’s time to set the mode for the node turning them into anchors and setting the individual addresses for each anchor. To facilitate setting up the system in a room a tip is to mark each node with their individual anchor number for easier identification.

LPS configuration tool
  1. Start by setting the individual IDs, number them sequentially from 0-5.
  2. Choose “Anchor (TWR)”
  3. Click Apply

Place the anchors in the room

Anchor positions

To get a good position there are some rules of thumb for the placement of the six anchors.

  • The anchors should be evenly distributed around the flying volume and at least 2m apart.
  • The anchors should have line of site with the flying volume.
  • The anchor antenna should be placed 15cm from any wall, ceiling or metal object to avoid interfering reflections. In our reference set-up we accomplish this by using these 3D printed stands. In the repository click “Raw” and then choose “save as” and save the file as a stl file.

In our reference setup we have placed 3 anchors above and 3 anchors below the flight area, shaped in inverse triangles. This gives good accuracy in X, Y and Z.

reference system

Powering the anchors

The anchor can be powered in three different ways.

Powering the anchors
  • Micro USB. Good for fixed and portable setups were a external battery or power adapter is used.
  • Barrel jack. Good for fixed and portable setup were power adapter is used.
  • Skrew terminal. Good for fixed installation and for chaining. Cable size up to 0,5mm2.

They can be connected at the same time so the anchor can still be power from the skrew terminal when connecting the micro USB cable to do an update or when changing the configuration. All power options can handle 5-12V and the supply should be able to provide at least 150mA of current.

Configure and verify the system

Open the Crazyflie client

Now when everything is mounted and powered it is time to configure the system.

  • Place your Crazyflie 2.0 in the middle of the flying area.
  • Open the CF client and connect to the Crazyflie 2.0
open the crazyflie client

Click the LPS tab

  • Choose the LPS tab. It might have to be made visible from the menu View->Tabs->Loco Positioning Tab
click the lps tab

Check anchor status

  • Have a look in the Anchor ranging status box and check that there are six green boxes. If any of them are red it means that the Crazyflie 2.0 can not communicate with that anchor and thus not get any range. If any anchor is constantly red please check that anchors power and configuration.
check the anchor status

Enter anchor positions

  • Before you start entering any anchor positions make sure the boxes are green or red. If for some reason they stay white restart the cfclient.
  • Now it is time to enter the positions. The boxes will become red as soon as that position differs from the position saved in the anchor.
enter anchor positions

Write position to anchors

  • Now to save the new anchor position to the anchors press the “write to anchors” button.
  • Verify that the anchor position boxes changes from red to green. If no change has occurred within 5 seconds try it again.
write position to anchors

Verify anchors position

Verifying the anchor positions is good to rule out problems with the positioning later.

  • Switch mode to anchor identification
  • Move the Crazyflie close to one anchor
  • Verify that the correct anchor is highlighted.
  • Do this for all six anchors and correct any wrongly configured anchor address.
Verify anchors position

Verify estimated position

  • Switch back to position estimate mode
  • Move the CF around and verify that the movement in the graphs correspond to the physical movement.
Verify estimated position

Flying with the system

Restart the Crazyflie

  • Place the copter in the middle of your flying areas on a level surface facing the anchor systems positive x-axis.
  • Turn on or restart the Crazyflie 2.0.
Restart the Crazyflie

Connect to the Crazyflie 2.0

  • Connect to the Crazyflie 2.0
  • It might take a couple of seconds for the position estimate to stabilize. You can verify that it has stabilized by checking that the position in the LPS tab corresponds to the physical position.

Set assisted mode to Position hold

Position hold mode lets you control the Crazyflie in position mode instead of attitude mode. This means instead of controlling roll/pitch/yaw/thrust you will control x/y/yaw/height. Thus releasing the sticks will leave the Crazyflie in its current position.

  • Open the flight tab and select position hold mode from the assisted mode drop down list.

Flying with a gamepad

Before flying check that the gamepad reports Pitch [0.0] and Roll [0.0] when the sticks are centered in the Tartet values in the flight tab. If they are not zero the consequence will be that the Crazyflie slowly moves when the sticks are released which might not be the wanted behavior.

Crazyflie pitch roll

Here you can see that the Pitch and Roll is not [0.0] which might result in the Crazyflie drifting when the sticks are released.

  • Press and hold the assisted mode button to activate the selected assisted mode.
  • Press up to take off and go up. While testing keep close to the ground but higher then 20cm to avoid ground turbulence.
  • Now you can fly around using the x/y stick as shown in the image below. Pressing X+ will move the Crazyflie in the X+ axis of your system, and the same for the other axis.
  • If somethings goes out of control release the sticks and the assisted mode button to have the Crazyflie drop to the ground.
Flying with a gamepad
  • As a reference please have a look at this video showing the somewhat expected flying behavior.

Next step

Now when you got the basic functionality of the system up and running you might want to start flying preprogrammed flight paths. To do that start reading the more techy documentation on the Loco positioning wiki page.