{"id":13710641,"url":"https://github.com/clydemcqueen/flock2","last_synced_at":"2025-05-06T19:32:16.910Z","repository":{"id":46086052,"uuid":"152148884","full_name":"clydemcqueen/flock2","owner":"clydemcqueen","description":"ROS2 swarm controller for DJI Tello drones","archived":false,"fork":false,"pushed_at":"2021-11-15T15:47:46.000Z","size":236,"stargazers_count":67,"open_issues_count":4,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-13T21:44:31.574Z","etag":null,"topics":["drones","ros2","ryze","swarm","tello"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clydemcqueen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-08T21:27:21.000Z","updated_at":"2024-11-07T11:01:59.000Z","dependencies_parsed_at":"2022-09-03T20:10:48.002Z","dependency_job_id":null,"html_url":"https://github.com/clydemcqueen/flock2","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clydemcqueen%2Fflock2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clydemcqueen%2Fflock2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clydemcqueen%2Fflock2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clydemcqueen%2Fflock2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clydemcqueen","download_url":"https://codeload.github.com/clydemcqueen/flock2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252753646,"owners_count":21798988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drones","ros2","ryze","swarm","tello"],"created_at":"2024-08-02T23:00:59.227Z","updated_at":"2025-05-06T19:32:11.897Z","avatar_url":"https://github.com/clydemcqueen.png","language":"C++","funding_links":[],"categories":["Packages","SDK Wrappers"],"sub_categories":["Driver layer"],"readme":"# `flock2`\n\n`flock2` can fly a swarm of [DJI Tello](https://store.dji.com/product/tello) drones.\n`flock2` is built on top of [ROS2](https://index.ros.org/doc/ros2/),\n [fiducial_vlam](https://github.com/ptrmu/fiducial_vlam),\n and [tello_ros](https://github.com/clydemcqueen/tello_ros).\n\n## Installation\n\n### 1. Set up your Linux environment\n\nSet up a Ubuntu 20.04 box or VM.\n\n### 2. Set up your Python environment\n\nUse your favorite Python package manager to set up Python 3.6+ and the following packages:\n\n* numpy 1.15.2\n* transformations 2018.9.5\n\n### 3. Set up your ROS environment\n\n[Install ROS2 Foxy](https://docs.ros.org/en/foxy/index.html) with the `ros-foxy-desktop` option.\n\nIf you install binaries, be sure to also install the \n[development tools and ROS tools](https://docs.ros.org/en/foxy/Installation/Ubuntu-Development-Setup.html)\nfrom the source installation instructions.\n\nInstall these additional packages:\n~~~\nsudo apt install ros-foxy-cv-bridge ros-foxy-camera-calibration-parsers ros-foxy-gazebo-ros\n~~~\n\n### 4. Install dependencies\n\nDownload, compile and install the following packages:\n~~~\nmkdir -p ~/flock2_ws/src\ncd ~/flock2_ws/src\ngit clone https://github.com/clydemcqueen/flock2.git\ngit clone https://github.com/clydemcqueen/tello_ros.git\ngit clone https://github.com/ptrmu/fiducial_vlam.git\ngit clone https://github.com/ptrmu/ros2_shared.git\ncd ..\nsource /opt/ros/foxy/setup.bash\n# If you didn't install Gazebo, avoid building tello_gazebo:\ncolcon build --event-handlers console_direct+ --packages-skip tello_gazebo\n~~~\n\n## Running\n\n### Flying a single drone\n\n`launch_one.py` will allow you to fly a drone using a wired XBox One gamepad.\n\nTurn on the drone, connect to `TELLO-XXXXX` via wifi, and launch ROS2:\n~~~\ncd ~/flock2_ws\nsource install/setup.bash\nros2 launch flock2 launch_one.py\n~~~\n\nGamepad controls:\n* menu button to take off\n* view button to land\n* B to start mission\n* A to stop mission\n \n### Flying multiple drones\n\n`launch_two.py` provides an example for flying multiple drones.\n\nKey elements of multi-drone missions:\n\n* All drones must be networked together. One way to do this is to connect to each drone's wifi\nusing a Raspberry Pi 3 or similar device, and forward all UDP packets from the Pi to the host computer.\nSee [udp_forward](https://github.com/clydemcqueen/udp_forward) for an example using 2 Tello drones.\n* Global nodes such as `flock_base` should have exactly 1 instance running.\nPer-drone nodes such as `drone_base` should have 1 instance running per drone.\n* Each drone has it's own ROS topic namespace. The default namespace for 1 drone is `solo`.\n* Each drone must have it's own URDF file with the appropriate coordinate frames.\n* The joystick controls one drone at a time. Hit the right bumper to select a different drone.\n* All drones participate in the mission.\n\n## Design\n\n### Coordinate frames\n\n[ROS world coordinate frames](http://www.ros.org/reps/rep-0103.html) are ENU (East, North, Up).\n\nThere are 3 significant coordinate frames in `flock2`:\n* The world frame is `map`\n* Each drone has a base coordinate frame. The default for 1 drone is `base_link`\n* Each drone has a camera coordinate frame. The default for 1 drone is `camera_frame`\n\n### The arena\n\nAn arena is a right rectangular prism defined by 2 points: (x1=0, y1=0, z1=0) and (x2, y2, z2).\nz1 defines the ground, so z2 must be positive.\nThe ground must be flat.\nDrones will never fly outside of the arena.\n\nThere must be at least one 6x6 ArUco marker, with id 1, associated with the arena.\nMarker 1's pose is known in advance, the other ArUco marker poses are estimated during flight.\nThe drones will use ArUco marker poses to estimate their current pose.\n\n### The mission (under development)\n\nA mission is defined as autonomous flight by all drones.\nA mission is initiated when the user hits the _start mission_ button on the gamepad.\nA mission will end on it's own, or when the user hits the _stop mission_ button.\n\nAll drones must be able to localize on the ground to start a mission.\nIn practice this means that all drones must be able to see marker 1 while sitting on the ground,\nor at least one drone has to be flown around manually to build a good map before the mission starts.\n\nThe overall mission dataflow looks like this:\n\n1. `flock_base` publishes a message on the `/start_mission` topic\n2. `planner_node` generates an overall pattern of flight for all drones, and publishes a \nsequence waypoints for each drone on `/[prefix]/plan`\n3. `drone_base` subscribes to `~plan` and `~base_odom`, runs a PID controller,\nand sends commands to `tello_ros`\n\nIf odometry stops arriving `drone_base` will execute a series of recovery tasks, which might include landing.\n\nIf flight indicates that a drone has a low battery `drone_base` will land the drone.\n\n### Simulating 4 drones in Gazebo\n\n[Install Gazebo 9 and build tello_gazebo](https://github.com/clydemcqueen/tello_ros/tree/master/tello_gazebo),\nif you haven't already.\n\n~~~\ncd ~/flock2_ws\nsource install/setup.bash\nexport GAZEBO_MODEL_PATH=${PWD}/install/tello_gazebo/share/tello_gazebo/models\nsource /usr/share/gazebo/setup.sh\nros2 launch flock2 gazebo_launch.py\n~~~\n\nHit the \"B\" button on the XBox controller to start the mission.\nYou should see 4 drones take off, rotate through 4 positions, then land.\n\n### Node details\n\n#### flock_base\n\nOrchestrates the flight of one or more Tello drones.\n\n##### Subscribed topics\n\n* `~joy` [sensor_msgs/Joy](http://docs.ros.org/api/sensor_msgs/html/msg/Joy.html)\n\n##### Published topics\n\n* `/start_mission` [std_msgs/Empty](http://docs.ros.org/api/std_msgs/html/msg/Empty.html)\n* `/stop_mission` [std_msgs/Empty](http://docs.ros.org/api/std_msgs/html/msg/Empty.html)\n* `~[prefix]/joy` [sensor_msgs/Joy](http://docs.ros.org/api/sensor_msgs/html/msg/Joy.html)\n\n##### Parameters\n\n* `drones` is an array of strings, where each string is a topic prefix\n\n#### drone_base\n\nControls a single Tello drone. Akin to `move_base` in the ROS navigation stack.\n\n##### Subscribed topics\n\n* `/start_mission` [std_msgs/Empty](http://docs.ros.org/api/std_msgs/html/msg/Empty.html)\n* `/stop_mission` [std_msgs/Empty](http://docs.ros.org/api/std_msgs/html/msg/Empty.html)\n* `~joy` [sensor_msgs/Joy](http://docs.ros.org/api/sensor_msgs/html/msg/Joy.html)\n* `~tello_response` tello_msgs/TelloResponse\n* `~flight_data` tello_msgs/FlightData\n* `~base_odom` [nav_msgs/Odometry](http://docs.ros.org/api/nav_msgs/html/msg/Odometry.html)\n\n##### Published topics\n\n* `~cmd_vel` [geometry_msgs/Twist](http://docs.ros.org/api/geometry_msgs/html/msg/Twist.html)\n\n##### Published services\n\n* `~tello_command` tello_msgs/TelloCommand\n\n#### planner_node\n\nCompute and publish a set of waypoints for each drone in a flock.\n\n##### Subscribed topics\n\n* `/start_mission` [std_msgs/Empty](http://docs.ros.org/api/std_msgs/html/msg/Empty.html)\n* `/stop_mission` [std_msgs/Empty](http://docs.ros.org/api/std_msgs/html/msg/Empty.html)\n* `~[prefix]/base_odom` [nav_msgs/Odometry](http://docs.ros.org/api/nav_msgs/html/msg/Odometry.html)\n\n##### Published topics\n\n* `~[prefix]/plan` [nav_msgs/Path](http://docs.ros.org/api/nav_msgs/html/msg/Path.html)\n\n##### Parameters\n\n* `drones` is an array of strings, where the number of strings is the number of drones and each string is the topic prefix for a drone.\nFor example, `['d1', 'd2']` refers to 2 drones, and the flight data topic for the first drone is `/d1/flight_data`.\nThe default is `['solo']`.\n* `arena_x` defines the X extent of the arena, in meters. The default is 2.\n* `arena_y` defines the Y extent of the arena, in meters. The default is 2.\n* `arena_z` defines the Z extent of the arena, in meters. Must be greater than 1.5. The default is 2.\n\n## Versions and branches\n\n`flock2` was developed along with several other projects while ROS2 was rapidly changing.\nAll of the related projects adopted similar conventions around branch names:\n* the `master` branch works with the latest ROS2 release (Foxy as of this writing)\n* there may be branches for older ROS2 versions, such as `crystal`, `dashing` or `eloquent`\n\nThe following projects and branches were tested together:\n\n* ROS2 Foxy with fiducial_vlam:\n  * git clone https://github.com/ptrmu/ros2_shared.git\n  * git clone https://github.com/ptrmu/fiducial_vlam.git\n  * git clone https://github.com/clydemcqueen/tello_ros.git\n  * git clone https://github.com/clydemcqueen/flock2.git\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclydemcqueen%2Fflock2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclydemcqueen%2Fflock2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclydemcqueen%2Fflock2/lists"}