git clone --recurse-subodules https://github.com/boomer319/verrueckter_schwarm.git
The crazyflies have a number on their belly. The number corresponds to the last digits in their radio address:
- radio:https://0/80/2M/0xE7E7E7E701 for cf01
- radio:https://1/100/2M/0xE7E7E7E702 for cf02
- radio:https://0/80/2M/0xE7E7E7E703 for cf03
- radio:https://1/100/2M/0xE7E7E7E704 for cf04
- radio:https://0/80/2M/0xE7E7E7E705 for cf05
- radio:https://1/100/2M/0xE7E7E7E706 for cf06
- radio:https://0/80/2M/0xE7E7E7E707 for cf07
- radio:https://1/100/2M/0xE7E7E7E708 for cf08
0 and 1 in ...//0/... are the ids of the radio that shall be used
80 and 100 are the channels
2M is radio bandwith
look at verrueckter_schwarm/ros2_ws/src/verrueckterschwarm2/crazyflie/config/crazyflies.yaml...this is the radio configuration found there
source /opt/ros/humble/setup.bash # can be added at the bottom of your .bashrc
source install/setup.bash # execute in your ros2_ws! can be added at the bottom of your .bashrc
ifconfig # find out the network adapter configuration of your device
ping IP-Address # test wether data transfer to specified IP works as quickly as intended
cfclient # open the crazyflie client
ros2 launch crazyflie launch.py backend:=cflib # starting crazyswarm2's crazyflie server with cflib backend
ros2 launch crazyflie launch.py # starting crazyswarm2's crazyflie server with cpp backend (this one is used in the course of this project)
export PYTHONPATH=~/verrueckter_schwarm/crazyflie-firmware/build:$PYTHONPATH # necessary for starting the crazyflie simulation
ros2 launch crazyflie launch.py backend:=sim # starting simulated server
ros2 run crazyflie_examples hello_world # in separate terminal
ros2 run crazyflie_waypoint_mission goTo # in separate terminal
The main waypoint mission script can be found in verrueckter_schwarm/ros2_ws/src/verrueckterschwarm2/crazyflie_waypoint_mission/crazyflie_waypoint_mission/goTo.py. It is intended to make the drones go to points in space while maintaining their respective positions in the swarm and always having the cameras face the direction of flight. This was done to give the crazyflies the ability to avoid obstacles in later parts of the project.
It is very practical to make a python environment for all your different use cases.
This will allow you to not disrupt any of your other sub-projects by messing up your python dependencies
A python environment was made for:
- working with the crazyflie in general (e.g. starting cfclient)
- following the ai deck classification example
- working with the GapSDK
source ~/environments/cf/bin/activate # enter python environment
deactivate # exit python env
You can add an alias in your .bashrc. This way you dont need to type the command every time. You just need to use cf in the command line and the corresponding command is executed:
alias cf='source ~/environments/cf/bin/activate'
# ROS
source /opt/ros/humble/setup.bash # source ros
alias cs2='cd ~/verrueckter_schwarm/ros2_ws && source install/local_setup.bash' # source ros workspace
alias chooser='ros2 run crazyflie chooser.py' # makes it easy to read the battery voltage, restart crazyflies, select and deselect them. the alternative to selecting them in chooser.py would be to manually go to crazyflies.yaml and type true and false for each crazyflie.
# MoCap
alias NatNet='~/verrueckter_schwarm/NatNetSDKCrossplatform/build/sampleClient' # launching the sampleClient to see whether your PC receives the MoCap data thats streamed by NatNet.
# Python
alias cf='source ~/environments/cf/bin/activate' # Environment for working with the crazyflie
alias cf_py2='source ~/environments/cf_py2/bin/activate' # Environment for working with the crazyflie but python2
alias cfai='source ~/environments/cfai/bin/activate' # Environment for following the classification example with the ai deck
alias gap='source ~/environments/gap/bin/activate' # Environment for working with the GAP8 chip
# GAP
alias GAP_SDK='gap && source ~/verrueckter_schwarm/gap_sdk/sourceme.sh' # sourcing the chip configuration for working with the GapSDK
alias JTAG='export GAPY_OPENOCD_CABLE=~/verrueckter_schwarm/gap_sdk/utils/gap8-openocd/tcl/interface/ftdi/olimex-arm-usb-tiny-h.cfg' # needed whenever you are working with the JTAG debugger
https://git-scm.com/download/linux
https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
https://www.bitcraze.io/documentation/tutorials/getting-started-with-crazyflie-2-x/#inst-comp
sudo apt install git python3-pip libxcb-xinerama0
pip3 install --upgrade pip
pip3 install cfclient
sudo groupadd plugdev
sudo usermod -a -G plugdev $USER
log out / in
cat <<EOF | sudo tee /etc/udev/rules.d/99-bitcraze.rules > /dev/null
# Crazyradio (normal operation)
SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="7777", MODE="0664", GROUP="plugdev"
# Bootloader
SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="0101", MODE="0664", GROUP="plugdev"
# Crazyflie (over USB)
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0664", GROUP="plugdev"
EOF
reloading udev-rules:
sudo udevadm control --reload-rules
sudo udevadm trigger
I already did this on the two radios used in this project. Shouldn't be necessary if you don't plan on using more radios.
cfclient
used for:
- changing the radio adresses on each drone in order to use a different amount of radios
- updating the software on each crazyflie idivdually
- connecting xbox or ps controller to your pc to control the drone (can be done through an android app too)
- monitoring the battery voltage
https://docs.ros.org/en/humble/Installation.html
https://imrclab.github.io/crazyswarm2/installation.html
important: step 3 in this case will be as follows (notice crazyswarm2 is missing, as my fork was already cloned recursively with this git):
mkdir -p ros2_ws/src
cd ros2_ws/src
git clone --branch ros2 --recursive https://github.com/IMRCLab/motion_capture_tracking.git
I configured the drones in crazyflies.yaml. Each drone was assigned a starting position, mocap marker configuration and radio address.
https://imrclab.github.io/crazyswarm2/usage.html
This can be used to test your scripts before running them with the drones in real life. Depending on the power you have available this might run slow.
In order for the motion capture streaming service "NatNet" to send data to the PC you are running the crazyswarm server from, you have to have them both in the same newtork or directly linked through an ethernet switch. A wifi router can be used as a switch too. Simply plug everything into the yellow ethernet ports. Find the IP corresponding to the network both your PC and the MoCap PC use. Choose that IP of the MoCap PC in Motive. Also put it in to verrueckter_schwarm/ros2_ws/src/verrueckterschwarm2/crazyflie/config/motion_capture.yaml
- enable
- local interface: use the IP address of the PC running Motive
- the third group of numbers of the IP has to be the same as for the receiving machine 192.168.XYZ.103 (this group should correspond for all devices on the given router)
- Multicast
- turn on only labeled and unlabeled marker streaming, turn off the streaming of other things, e.g. Rigid Bodies. Crazyswarm2 only needs the pointcloud of said markers.
- The rest can be left as seen on the screenshot NatNetSettings.png
Solve Python error: subprocess-exited-with-error | bobbyhadz
How to Add Python to PATH – Real Python
Git - Make local HEAD the new master - Stack Overflow
git - How to push changes to github without pull - Stack Overflow
Ubuntu (Debian packages) — ROS 2 Documentation: Humble documentation
Tutorials — ROS 2 Documentation: Humble documentation
Gazebo - Docs: Binary Ubuntu Install
Configuration — Crazyswarm 0.3 documentation
Tutorials — Crazyswarm 0.3 documentation
NatNet SDK - EXTERNAL OptiTrack Documentation
whoenig/NatNetSDKCrossplatform: Crossplatform version of the OptiTrack NatNet SDK
Crazyswarm2: A ROS 2 testbed for Aerial Robot Teams — Crazyswarm2 1.0a1 documentation
IMRCLab/crazyswarm2: A Large Quadcopter Swarm
Optitrack to Crazyflie Set up - Bitcraze Forums
libmotioncapture/examples/python.py at main · IMRCLab/libmotioncapture
Optitrack · IMRCLab/crazyswarm2 · Discussion #286
Settings: Streaming - EXTERNAL OptiTrack Documentation
Crazyswarm2 development | Bitcraze
Frequently Asked Questions — Crazyswarm2 1.0a1 documentation
Building and Flashing | Bitcraze
Collision avoidance by jpreiss · Pull Request #628 · bitcraze/crazyflie-firmware
whoenig/uav_trajectories: Helper scripts and programs for trajectories
crazyswarm/ros_ws/src/crazyswarm/scripts/backgroundComputation.py at master · USC-ACTLab/crazyswarm
Installation Instructions | Bitcraze
Step-by-Step: Connecting, logging and parameters | Bitcraze
Step-by-Step: Motion Commander | Bitcraze
bitcraze · Discussions · GitHub
Releases · bitcraze/aideck-gap8-examples
Getting started with the AI deck | Bitcraze
WiFi Video Streamer | Bitcraze
Classification Demo | Bitcraze
STM-GAP8 CPX communication Example | Bitcraze
Obstacle Avoidance AI-deck | Bitcraze
semantic segmentation CNN STDC-Seg
UAVid Semantic Segmentation Dataset
[1504.06852] FlowNet: Learning Optical Flow with Convolutional Networks
FlowNet: Learning Optical Flow with Convolutional Networks - YouTube
GreenWaves-Technologies/gap_sdk: SDK for Greenwaves Technologies' GAP8 IoT Application Processor
Machine Learning on GAP8 for tiny devices - YouTube
gap_sdk/tools/nntool/README.md at master · GreenWaves-Technologies/gap_sdk
gap_sdk/tools/nntool at master · GreenWaves-Technologies/gap_sdk
GreenWaves-Technologies/gap_sdk at release-v4.8.0
Build and flash radio | Bitcraze
USB and Radio protocol of the Crazyradio dongle | Bitcraze
CPX - Crazyflie Packet eXchange | Bitcraze
Bitcraze - Crazyflie 101 EPFL-LIS lecture - part 2 (2020) - YouTube
Guest Lecture at EPFL Aerial Robotics Course 2020 | Bitcraze
Helping drone swarms avoid obstacles without hitting each other - EPFL
Crazyflie Summer Project with ROS2 and Mapping | Bitcraze
Motion Capture positioning | Bitcraze
Customize firmware with kbuild | Bitcraze
Building and Flashing | Bitcraze