A behaviour tree based flight control node referred to by the ROS2 navigation stack as a Waypoint Controller. The node uses a BehaviorTree.CPP library to specify the mission. Specify the drone mission in an XML file, and start the node.
The following behaviors have been implimented. Please note, thes behaviors all call services and actions from other nodes in this repo.
Listens to battery status messages published by the flight controller to obtain the current battery voltage. Compares the voltage to that specified in a node parameter and returns true if the battery has more charge than the specified threshold.
Calls the Takeoff action server published by the drone_node, resulting in the drone flying to a set altitude. Tested: Flight ready
Calls the Land action server published by the drone_node, resulting in the drone landing at the current coordinates. Tested: Flight ready
Calls the Land action server published by the lander_node, resulting in the drone landing on a set ArUco marker at the provided coordinates. Tested: No
Calls the navigation server navigate to pose message to fly the drone avoiding obstacles along the way. Tested: Flight Ready
Prints a given message to the terminal. Great for debugging. Tested: Flight ready
Reads the current system date and time and generates a file name for use by the camera. The file name will be in the format YYMMDD_HHMM.jpg Tested: Flight ready
Saves the current image published by the camera node to camera/image to a file. Improvement: Add a second input to specify the path where the file must be saved. Tested: Flight ready
Calls the simple service of the map server to load a map, replacing the current map im memory. Improvement: Add a second input to specify the path where the file must) be saved. Tested: No
Saves the current map generated by the map server to disk. Improvement: Add a second input to specify the path where the file must be saved. Tested: Simulator ready
Clone this repo into the src directory of your ROS2 workspace. See the ros2 tutorial on how to create a workspace.
git clone https://github.com/slaghuis/flight_control.git
Back in the root of your ROS workspace, build and install the package.
colcon build --packages-select flight_control
. install/setup.bash
ros2 launch flight_control flight.launch.py
This code has flown on a drone! The drone was controlled by a Pixhawk mini 4.0 controlled via a Raspberry Pi 4 4Gb companion computer via UART. This node instructed the navigation_lite stack, which in turn used the drone_mavsdk node to effect the movement.