|
**Download the firmware to the Crazyflie**
|
|
You can find the wiki files in the next folder:
|
|
|
|
|
|
The firmware is the actual code that runs on the Crazyflie 2.0 quadcopter. As the crazyflie is designed with research in mind, the developer, Bitcraze, provides an easy to use interface for flashing new code onto the crazyflie's microprocessor. Following steps describe downloading the firmware onto the crazyflie:
|
|
[wiki files](https://gitlab.ethz.ch/D-FaLL/PandS-System/D-FaLL-System/tree/master/pps_wiki) |
|
|
|
\ No newline at end of file |
|
Install the Bitcraze's virtual machine by following the steps from:
|
|
|
|
|
|
|
|
https://wiki.bitcraze.io/projects:virtualmachine:index
|
|
|
|
|
|
|
|
Download the folder crazyflie-firmware-src/src from the gitlab.
|
|
|
|
|
|
|
|
In the installed virtual machine navigate to the crazyflie firmware project files and replace the src folder with the downloaded src folder.
|
|
|
|
|
|
|
|
In order to download the firmware to the crazyflie, follow the instructions given in the appendix of the following thesis report: "Setup of a Distributed Autonomous Flying Test Bed using nano quadcopters" by Aleksandra Kim & Jeremias Seitz
|
|
|
|
|
|
|
|
**Add UDEV rules for Crazyradio and Crazyflie**
|
|
|
|
|
|
|
|
We have to add udev rule that starts up the client when the Crazyflie is inserted and kills it when it's removed. We should also have a rule that allows us to use the Crazyradio bootloader with out being root.
|
|
|
|
|
|
|
|
navigate to: etc/udev/rules.d
|
|
|
|
|
|
|
|
create a flie named 99-crazyflie.rules with the following content:
|
|
|
|
|
|
|
|
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0664", GROUP="plugdev"
|
|
|
|
|
|
|
|
create a file named 99-crazyradio.rules with the following content:
|
|
|
|
|
|
|
|
SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="7777", MODE="0664", GROUP="plugdev"
|
|
|
|
|
|
|
|
SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="0101", MODE="0664", GROUP="plugdev"
|
|
|
|
|
|
|
|
**Instal Python module USB**
|
|
|
|
|
|
|
|
`sudo apt-get update`
|
|
|
|
`sudo apt-get install python-pip #if you don't have pip installed already`
|
|
|
|
`sudo pip install pyusb`
|
|
|
|
|
|
|
|
**SETUP ROS**
|
|
|
|
|
|
|
|
Offboard controller, GUI, Vicon data acquisition, and sending data by the crazyradio are different tasks implemented offboard and connected using the robotic operating system (ROS). Before running the code, ROS has to be appropriately set up.
|
|
|
|
|
|
|
|
Install ROS by following the instructions from
|
|
|
|
|
|
|
|
http://wiki.ros.org/ROS/Installation
|
|
|
|
|
|
|
|
IMPORTANT: Everything written from here to the end has been automatized and written in a script that is in the repository (https://gitlab.ethz.ch/D-FaLL/D-FaLL-System/blob/roangel/setup_and_compilation.sh). You just have to run this script and everything should run out of the box. If not, follow step by step and find your error.
|
|
|
|
|
|
|
|
***Set up a new ROS workspace:***
|
|
|
|
|
|
|
|
Run the following commands, by changing <distro> with the name of the installed ROS distribution:
|
|
|
|
|
|
|
|
`source /opt/ros/<distro>/setup.bash`
|
|
|
|
|
|
|
|
`rosws init ~/crazyflie_ws /opt/ros/<distro>`
|
|
|
|
|
|
|
|
`sudo apt-get install python-rosinstall`
|
|
|
|
|
|
|
|
`mkdir ~/crazyflie_ws /sandbox`
|
|
|
|
|
|
|
|
`source ~/crazyflie_ws/setup.bash`
|
|
|
|
|
|
|
|
`rosws set ~/crazyflie_ws /sandbox`
|
|
|
|
|
|
|
|
|
|
|
|
For a detailed explanation of the meaning of each of the commands, see
|
|
|
|
|
|
|
|
http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment
|
|
|
|
|
|
|
|
|
|
|
|
***Create a new ROS package:***
|
|
|
|
|
|
|
|
`cd ~/crazyflie_ws/sandbox`
|
|
|
|
|
|
|
|
`roscreate-pkg crazypkg std_msgs rospy roscpp`
|
|
|
|
|
|
|
|
Download the crazyflie_ws folder from gitlab and copy the following content of the crazypkg folder (crazyflie_ws/sandbox/crazypkg/) into the crazypkg folder of the workspace created in the previous step (~/crazyflie_ws /sandbox/crazypkg):
|
|
|
|
|
|
|
|
gui
|
|
|
|
|
|
|
|
include
|
|
|
|
|
|
|
|
launch
|
|
|
|
|
|
|
|
lib
|
|
|
|
|
|
|
|
log
|
|
|
|
|
|
|
|
msg
|
|
|
|
|
|
|
|
nodes
|
|
|
|
|
|
|
|
scripts
|
|
|
|
|
|
|
|
src
|
|
|
|
|
|
|
|
CMakeLists.txt
|
|
|
|
|
|
|
|
|
|
|
|
Run the following commands from the crazypkg folder
|
|
|
|
|
|
|
|
`source ~/crazyflie_ws/setup.bash`
|
|
|
|
|
|
|
|
`rospack profile`
|
|
|
|
|
|
|
|
`rosmake crazypkg`
|
|
|
|
|
|
|
|
source:
|
|
|
|
|
|
|
|
http://wiki.ros.org/ROS/Tutorials/CreatingPackage
|
|
|
|
|
|
|
|
http://wiki.ros.org/ROS/Tutorials/BuildingPackages
|
|
|
|
|
|
|
|
**NOTE: tools needed to edit the GUI**
|
|
|
|
|
|
|
|
If you want to edit the graphical interface, created with Qt Creator, follow these steps:
|
|
|
|
1. Install Qt Creator 5 following the instructions from here:
|
|
|
|
http://wiki.qt.io/Install_Qt_5_on_Ubuntu
|
|
|
|
2. Run Qt Creator, go to Open Project, and select ~/crazyflie_ws/sandbox/crazypkg/gui/untitled/untitled.pro
|
|
|
|
3. Do all changes as you wish. Save the file.
|
|
|
|
4. Recompile all sources. Changes in GUI should now be applied in the running system.
|
|
|
|
|
|
|
|
**Run the system**
|
|
|
|
|
|
|
|
In the command window run:
|
|
|
|
|
|
|
|
`roscore`
|
|
|
|
|
|
|
|
open a new command window and run the following commands:
|
|
|
|
|
|
|
|
`source ~/crazyflie_ws/setup.bash`
|
|
|
|
|
|
|
|
`roslaunch crazypkg crazyLaunch.launch`
|
|
|
|
|
|
|
|
After running the previous command, GUI should be visible on the screen
|
|
|
|
|
|
|
|
![guiCFlabeled](/uploads/3278c1cdd3c1c8ed1cff6c9113c5cf74/guiCFlabeled.png)
|
|
|
|
|
|
|
|
Different features of the GUI are labeled in red and described in the following way:
|
|
|
|
|
|
|
|
1) Start/Stop button starts or stops the controllers. In the stop mode zero motor commands are sent to the crazyflie which stop the motors.
|
|
|
|
|
|
|
|
2) Reset the controllers to the initial conditions
|
|
|
|
|
|
|
|
3) Switch between different controller architectures and change the sampling rate.
|
|
|
|
|
|
|
|
PID Position - Nested rate and attitude controllers are implemented onboard. Position PID controller is implemented offboard.
|
|
|
|
|
|
|
|
PID Angle - Rate controller is implemented onboard. Nested position and attitude PID controllers are implmented offboard.
|
|
|
|
|
|
|
|
PID Full - Whole PID control algorithm is implemented offbard. Motor commands are sent to the crazyflie
|
|
|
|
|
|
|
|
LQR Full - Whole LQR control algorithm is implemented offboard. Currently this case is not completed and this controller structure should not be selected.
|
|
|
|
|
|
|
|
LQR Nested onboard - Rate controller is implemented onboard. LQR controller that outputs rate setpoints and thrust commands is implemented offboard.
|
|
|
|
|
|
|
|
LQR Nested offboard - Rate controller is implemented offboard as well as the LQR controller that outputs rate setpoints and thrust commands. Currently this case is not completed and this controller structure should not be selected.
|
|
|
|
|
|
|
|
The three test controllers are used to check if the hardware is connected properly as well as to check the communication with the crazyflie. Sliders are used to set the desired setpoint value.
|
|
|
|
|
|
|
|
4) In order to change the crazyflie's position setpoint, type the appropriate values in the boxes and press change button. Curr pos changes the setpoint to be at the current crazyflies position. Home button changes the setpoint to the hardcoded values. z=200 changes only the z position setpoint to 200mm, in order to land the crazyflie. All of this actions are considered if the custom radio button is selected. Circle and square radio buttons allow for automatic setpoint changes for following the predefined path.
|
|
|
|
|
|
|
|
5) Indicates if the rate controller is run onboard or offboard. Allows to change the sampling rate of the offboard controller. Onboard controller sample rate can not be changed.
|
|
|
|
|
|
|
|
6) Change the feedforward commands
|
|
|
|
|
|
|
|
7) Display the last package sent to the crazyflie over the crazyradio.
|
|
|
|
|
|
|
|
8) *Print controller info* - prints the information about the whole controller system in the command window. *Set default Ts* - sets all sample rates to default ones. *Set default ff cmd* - sets all feedforward commands to the default ones.
|
|
|
|
|
|
|
|
9) Displays the localization data obtained by the Vicon's motion capture system
|
|
|
|
|
|
|
|
10) Counts the number of missed measurements. If the crazyflie is operating in the area covered by Vicon cameras field of view, this should stay zero.
|
|
|
|
|
|
|
|
11) Starts and stops the pitch and roll offset calibration while hovering.
|
|
|
|
|
|
|
|
12) Allows to switch between control and parameter tabs. Control tab is depicted in the image above, while the parameters tab opens a table with controller parameters that can be changed in-flight. |
|
|
|
\ No newline at end of file |
|
|