Skip to main content

(Ⅴ) Crazyflie and Ardupilot Heterogeneous Swarm Control

Ⅰ. Motion Capture Software VRPN Configuration

Taking motion capture software version XINGYING 4.2.0.5495 as an example, other versions are similar. Open the motion capture software and connect the cameras. Click View -> Data Broadcast in the menu bar. Under the VRPN stream in Data Broadcast, select meters from the unit dropdown, check Rigid Body for type, and enable VRPN.

图 1-打开数据广播视图

Figure 1 - Open Data Broadcast View

图 2-动捕中vrpn配置

Figure 2 - VRPN Configuration in Motion Capture

Click View -> Devices in the menu bar to open the device view. First click the stop playback button, and modify the motion capture frame rate to 30 in the Advanced box.

图 3-打开设备视图

Figure 3 - Open Device View

图 4-修改动捕帧率

Figure 4 - Modify Motion Capture Frame Rate

Ⅱ. FlightMaster Platform Configuration

Requires ROS version: galactic, Ubuntu version: 20.04. Crazyflie firmware version 2024.10 or above. If the version is too low, update it yourself (cfclient usage).

(Ⅰ) Install Dependencies

Open a terminal and use the following commands to install dependencies.

sudo apt install python3-pip python3-colcon-common-extensions
pip3 install rowan
sudo apt install libusb-1.0-0-dev

(Ⅱ) Compile Source Code

First extract the given Flightmaster2 compressed package, then place the extracted folder in the ubuntu home directory (~/). Use the following commands to install mavsdk and compile FlightMaster2 source code.

cd ~/FlightMaster2/
sudo dpkg -i ./prebuilt/mavsdk-20241118_2.12_amd64.deb
colcon build --symlink-install
echo "source ~/FlightMaster2/install/setup.bash" >> ~/.bashrc

(Ⅲ) Configure VRPN in FlightMaster2

In the motion_capture.yaml file in FlightMaster2 (path: ~/FlightMaster2/flightmaster/config), change type to vrpn, and modify hostname to the IP address on the same network segment as the host running FlightMaster2 and the motion capture software.

图 5-配置type和hostname

Figure 5 - Configure type and hostname

In the flightmasters.yaml file in FlightMaster2 (path: ~/FlightMaster2/flightmaster/config), set the enabled field of motion_capture of the robot_types to be used to false.

图 6-设置vrpn方式

Figure 6 - Set VRPN Method

(Ⅳ) FlightMaster2 Connection Configuration Description

In the flightmasters.yaml file in FlightMaster2 (path: ~/FlightMaster2/flightmaster/config), under the robots field, the crazyflie configuration is consistent with that in crazyswarm2. The difference between apm vehicle configuration and crazyflie lies in uri and type. The apm vehicle uses the mavlink protocol, and there are multiple ways to connect addresses (mavlink connection address format). This experiment uses the udp connection method. Select type r200.

图 7-crazyflie与apm配置说明

Figure 7 - Crazyflie and APM Configuration Description

Ⅲ. Basic Operation Flight Demonstration

(Ⅰ) Create Rigid Bodies

Place one crazyflie and one apm unmanned vehicle on the site with the nose facing the positive x-axis direction. Create rigid bodies cf and car respectively, with skeleton orientation toward the x-axis.

图 8-参考位置

Figure 8 - Reference Position

(Ⅱ) Enable Devices

Configure and enable one crazyflie and one apm unmanned vehicle in the flightmasters.yaml file.

图 9-启用集群设备

Figure 9 - Enable Swarm Devices

(Ⅲ) Modify Follow Script

Modify the names in the follow.py script (path: ~/FlightMaster2/flightmaster_examples/flightmaster_examples), and the startup should correspond.

图 10-修改脚本

Figure 10 - Modify Script

(Ⅳ) Launch Graphical Operation Interface

Open a terminal and use the following command to open the flightmaster2 graphical control interface.

cd ~/FlightMaster2/
python fmclient.py
图 11-flightmaster2图形化界面

Figure 11 - Flightmaster2 Graphical Interface

(Ⅴ) Start Service Node

Select RealMode on the graphical interface and check RViz, then click Start FlightSwarm. At this time, the flightmaster2 service node will run, and rviz will also start.

图 12-启动flightmaster2和rviz

Figure 12 - Start Flightmaster2 and rviz

(Ⅵ) Start Follow Script

Click the Run follow.py button on the right side of the graphical interface to start the follow script.

图 13-启动跟随脚本

Figure 13 - Start Follow Script

图 14-rviz显示

Figure 14 - rviz Display

图 15-crazyflie跟随apm小车

Figure 15 - Crazyflie Following APM Vehicle