Skip to content

Quick Start Guide

Joseph Sullivan edited this page Aug 14, 2018 · 1 revision

Introduction

Here you will learn how to connect to a crazyflie using the client-server API, and run a basic altitude hold script. It is highly recommended that you use a Flow deck or Z-Ranger deck. Without one of these, the crazyflie will be unable to hold its altitude, and will likely crash!

Connecting to a Crazyflie

Each crazyflie interface is identified by a unique resource identifier (URI). The server node connects to a crazyflie using it's URI. Hence, to connect to a crazyflie, you have to tell the server what it's URI is. Here is an example URI:

//radio/0/80/2M/E7E7E7E7E7

The Crazyflie URI can be modified using the official Crazyflie Client GUI.

Parts of a URI

The parts of the URI are //<interface>/0/<channel>/<baudrate>/<address>.

The valid baudrates are

  • 250K
  • 1M
  • 2M

The address is a 5-byte long number in hexidecimal. By default, crazyflies ship with the address E7E7E7E7E7

Finding the Crazyflie URI

You can use scripts/scan.py to list all crazyflie URIs "seen" by the radio at a specified address. For example run these lines in a terminal:

roscd rospy_crazyflie
python scripts/scan.py E7E7E7E7E7

The script will print every URI with the address E7E7E7E7E7. Use this tool to find a crazyflie's URI so that you can tell the server to connect to it. The Crazyflie URI can be modified using the Crazyflie Client GUI. It is necessary to give Crazyflies a different URI when multiple are flying simultaneously.

Provide the URI to the server

The server will automatically connect to URIs listed in the file config/config.yaml. In this file is a list of key-value pairs, associating a name with each URI.

For example,

uris:
  crazyflie1: //radio/0/80/2M/E7E7E7E7E7
  crazyflie2: //radio/0/81/2M/E7E7E7E7E7

Start the Server

Before you can run a client program, you first need to start the server. You can launch the server like so

roslaunch rospy_crazyflie default.launch

The default launch file starts a server node with the name crazyflie_server. Refer to this server name in your client program.

Run an example

Now that the server is running, you can try executing the takeoff and landing example script in a new terminal. Remember to make sure that devel/setup.bash has been sourced.

roscd rospy_crazyflie/examples

python takeoff_landing.py

This example will tell the crazyflie to takeoff to a height of .5 meters, and will hover until the user hits enter in the console. Please note that without a FlowDeck the crazyflie will drift over time, or without a Z-ranger deck the crazyflie will not be able to hold altitude.

Clone this wiki locally