Skip to content

A C++, software development project using swarm algorithms on 20 or more drones simultaneously to form various geometric shapes.

License

Notifications You must be signed in to change notification settings

roboticistjoseph/Kamikaze-Robots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development of Swarm Robots Formation for ACME Robotics

A C++ Module for new robotics-based product of ACME Robotics using high-quality engineering practices for development of Multi-robots/ swarm actions using swarm algorithms with 20 or more robots simultaneously to arrange themselves in various geometric formations.

Build codecov License


Authors

Table of Contents

  1. Introduction
  2. Deliverables
  3. Proposal Documentation
  4. Development Process
  5. UML Diagrams
  6. Dependencies and Tools
  7. Run the Software
  8. Code Coverage
  9. Unit Testing
  10. Code Analysis

Introduction

Our team will be using ‘Kamikaze Robots' as the project code name to help protect Acme’s secret product plans. The name means ‘Divine Wind’ in Japanese and is inspired from the ‘Kamikaze swarm operation’ by company ‘STM’.

In this proposal, our team has focused on implementing one of the trending applications of swarm drones, which is to form different geometric shapes using a swarm of 20 or more drones.

In order to achieve this, state-of-art path-planning swarm algorithms will be deployed. The performance validation of this project will be done using the Gazebo simulation depicting a real-time demo of the application. Acme can then utilize this package in its 5-year robotics-based product roadmap.

Deliverables

  1. Proposal Documentation
  2. UML Diagrams
  3. Project Package with demonstrated OOPs concepts
  4. CI (Code Integration) using GitHub
  5. Code Coverage using Coveralls
  6. Unit Tests using Google Test Framework
  7. Developer Level Documentation
  8. Static code analysis with cppcheck
  9. Google C++ Style guide with cpplint validation

Project proposal

  • The project proposal document can be found here.

  • The quadchart can be found here.

Project Output

  • Final Presentation resource: link
  • Box Bot Box Bot
  • Demonstration Sample Demo

System Design

Development methodology

  • Agile software development model will be used for the development process where tasks will be tracked using a backlog table.
  • The software is designed in a Test-Driven Development fashion and implemented using Pair programming technique.
  • The tasks will be outlined for every sprint and after each sprint, the roles of the pair-programming group will be interchanged.

Development process

  • Using the Software Engineering Practices, all design and development work was followed Agile Iterative Process (AIP) where product backlog, iteration backlog, and work log were maintained usign appropriate measure. The Sheet can be accessed here
  • Each sprint's notes and reviews have been documented here

System architecture

  • The class diagram can be found here.

  • The flow of our system is as follows:

Activity Diagram.

Dependencies

Name Version License
Ubuntu 20.04(LTS) FSF Licenses
ROS 2 Humble Hawksbill Apache License 2.0
C++ 14 Creative Commons Attribution-ShareAlike 3.0 Unported License
Cmake 3.16.3 BSD 3-clause License

Tools used

Usage/Type Tool name License
IDE Visual Studio Code MIT License
CI pipeline Github CI Creative Commons Attribution 4.0
Code coverage Coveralls Coveralls, LLC
Running tests Gtests BSD 3-Clause "New" or "Revised" License

How to build and run Demo

Source

# overlay
source /opt/ros/foxy/setup.bash

Clone

git clone https://github.com/roboticistjoseph/Kamikaze-Robots.git

Build files

# fresh build of packages
cd Kamikaze-Robots/
colcon build --packages-select box_bot_description
colcon build --packages-select box_bot_gazebo
colcon build --packages-select kamikaze

Removing previous builds (Optional)

If build fails, re-run the above build commands after following the one's below.

cd ~/Kamikaze-Robots/
# remove any existing build files
rm -rf build/box_bot_description
rm -rf build/box_bot_gazebo
rm -rf build/kamikaze

Run the Simulation

Run the below commands in two different terminals

# underlay
source install/local_setup.bash

# Spawn 20 Bots in gazebo
ros2 launch box_bot_gazebo multi_box_bot_launch.py
# underlay
source install/local_setup.bash

# Control the formation of spawned Bots
ros2 run kamikaze swarm_controller

How to run Unit Tests

  • In a new terminal, run the follwoing commands to Test the functionality of the cloned software.
cd ~/Kamikaze-Robots/
source install/setup.bash
colcon test --packages-select kamikaze
cat log/latest_test/kamikaze/stdout_stderr.log

Output should be:

1: [==========] Running 1 test from 1 test case.
1: [----------] Global test environment set-up.
1: [----------] 1 test from KamikazeTest
1: [ RUN      ] KamikazeTest.BasicTest
1: [WARN] [1671132175.805364740] [basic_test]: New test started.
1: First Test.
1: [       OK ] KamikazeTest.BasicTest (12 ms)
1: [----------] 1 test from KamikazeTest (12 ms total)
1: 
1: [----------] Global test environment tear-down
1: [==========] 1 test from 1 test case ran. (12 ms total)
1: [  PASSED  ] 1 test.
1: Testing Complete.
1: -- run_test.py: return code 0
1: -- run_test.py: inject classname prefix into gtest result file '/home/joseph/ros2_ws2/src/Kamikaze-Robots/build/kamikaze/test_results/kamikaze/kamikaze_test.gtest.xml'
1: -- run_test.py: verify result file '/home/joseph/ros2_ws2/src/Kamikaze-Robots/build/kamikaze/test_results/kamikaze/kamikaze_test.gtest.xml'
1/1 Test #1: kamikaze_test ....................   Passed    0.10 sec

100% tests passed, 0 tests failed out of 1

Label Time Summary:
gtest    =   0.10 sec*proc (1 test)

Total Test time (real) =   0.10 sec

How to build for Test Coverage

cd ~/Kamikaze-Robots/
# remove any existing build files
rm -rf build/kamikaze

# build with coverage
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage" --packages-select kamikaze

# to check log (example)
cat log/latest_build/kamikaze/stdout_stderr.log

Generate Coverage report

source install/setup.bash
ros2 run kamikaze generate_coverage_report.bash

Code Analysis

Running 'cpplint' and 'cppcheck' to check for coding style and detect bugs. (Navigate to root of this cloned repo each time.)

cpplint

Change to the root directory of the package, /Kamikaze-Robots, and run:

cd kamikaze/
cpplint --filter=-build/c++11,+build/c++17,-build/namespaces,-build/include_order ./src/*.cpp ./include/kamikaze/*.hpp > ../results/cpplint.txt

The results of running cpplint can be found in /results/cpplint.txt.

cppcheck

Change to the root directory of the package, /Kamikaze-Robots, and run:

cd kamikaze/
cppcheck --enable=all --std=c++17 ./src/*.cpp ./include/kamikaze/*.hpp --suppress=missingIncludeSystem --suppress=unmatchedSuppression --suppress=unusedFunction --suppress=missingInclude --suppress=useInitializationList > ../results/cppcheck.txt

The results of running cppcheck can be found in /results/cppcheck.txt.

Challenges

  • No existing ROS2 repositories were forund to use as a reference.
  • Compatibility issues were encountered with different ROS versions and packages.
  • As ROS2 Humble is still in development mode, our team ran into various issues when using it. Hence, we had to switch to it's predecessor ROS2 foxy.
  • Took time to understand developing a launch file to spawn multiple robots. Later, faced difficulties spawning 20 robots in a single gazebo environment.
  • Factoring in the complexity of model file to be spawned, which greatly affects the simulation time.
  • Coordinating each robot's location while planing each robot's goal.
  • As our team is new to using rostests, Github 'codecov', Github CI, time was taken to understand each step and implement them.
  • We ran into troubles maintaining 'version-control', hence we chose to keep the development branches to save progress after merging it to the master branch.

License

This project is licensed under the Apache 2.0 License and can be found in the LICENSE file.