Structuring an Autonomous Drone Mission with PX4, QGroundControl, and ROS2 - Need Suggestions

Hello,

I am new to using px4 and QGroundControl and would appreciate suggestions on how to structure my autonomous drone mission project. The mission involves:

  1. Taking off the drone
  2. Flying to a user-specified waypoint using the QGC interface
  3. Activating a special mode (mode A) for the drone to search for an object using a camera, handled by a companion computer
  4. Moving into mode B to pick up the object, also handled by the companion computer with computer vision
  5. Flying to a second user-specified waypoint using QGC
  6. Activating mode C to release the object, again with the help of the companion computer and computer vision
  7. Returning the drone to its starting position and landing

Given the use of computer vision and following suggestions from the px4 page, I plan to use ROS2 to facilitate communication between the companion computer and the Pixhawk.

However, I’m unsure how to structure the code to synchronize the different modes of the mission and switch between QGC waypoints and companion computer instructions. I would appreciate any tips, suggestions, and relevant links on tackling this kind of project.

Thank you in advance for your help!