Skip to main content

Robofly setup for P1 projects

Preparation

  1. Download and install the Raspberry Pi Imager.
  2. Download the SD card image https://drive.google.com/file/d/1UCWfJRqWckL_UfICQ4vAHmAU54ZltRW-/view?usp=drive_link
  • The image does not need to be unzipped
  1. Clone the installation guide repository
  • git clone git@github.com:fly4future/robofly_installation_guide.git
  1. Clone the uav_custom_files
  • git clone git@github.com:fly4future/uav_custom_files.git

SD card for Raspberry Pi 5

  1. Use a 128 GB SD card
  2. Plug the SD card into your laptop
  3. Run the Raspberry Pi Imager with sudo: sudo rpi-imager
  4. Choose Device -> Raspberry Pi 5
  5. Choose OS -> Use custom -> select the downloaded SD card image
  6. Choose Storage -> select the SD card
  7. Next -> writing can easily take an hour
  8. Verify (progress bar turns green) -> can be skipped
  9. Put the SD card into the Raspberry

Camera focusing

  1. Connect power to the Raspberry (USB-C or battery/adapter to the drone)
  2. LED on the Raspberry should turn green. If the light is solid red, press the power button next to it
  3. The computer will connect to wifi f4f_robot with IP address 192.168.12.101
  4. On your laptop: ping 192.168.12.101 and wait until ping response
  5. On your laptop: open browser and enter 192.168.12.101:9443 into the address bar
  6. Username: admin, pass: admin
  7. Open the environment robofly and navigate to Stacks
  8. Open the sensor_diagnostics stack, click the green button Start this stack
  • If the button is not green, click Stop this stack and then wait for the green button to appear
  1. Navigate to robofly_installation_guiderobofly_installation_guide/testing_sessions/camera_focusing
  2. ./run.sh uav1 192.168.12.101
  3. Check that both cameras are publishing images (these may be blurry)
  4. Point each camera at an object ~2m away from you, and turn the camera lens until the image is in focus
  • The front camera lens is held by a counter-locking nut, loosen it before turning the lens
  1. Kindly ask the hardware guys to hot glue the lenses in place

Camera calibration

  1. Take the RoboFly to the big calibration pattern near the stairs
  2. Power on the drone (use a very long cable or a battery)
  3. On your laptop or phone, connect to f4f_robot wifi and open Portainer in your browser (192.168.12.101:9443)
  4. Environment robofly -> Stacks -> calibration_rosbag_down
  5. Start the stack
  6. Point the down-facing camera at the calibration pattern and slowly do the calibration dance
  7. Collect at least 2 minutes of data
  8. Stop the stack
  9. Repeat the same for the front camera (stack calibration_rosbag_front)
  10. In Portainer side panel select Volumes and click the browse button next to calibration_bag_files
  11. Download both calibration files (camera_down_TIMESTAMP.bag, camera_front_TIMESTAMP.bag)
  12. On your laptop: Move or symlink the .bag files to robofly_installation_guide/install_scripts/data_calibration
  13. Rename the files to camera_down.bag and camera_front.bag
  14. Navigate to robofly_installation_guide/install_scripts and run ./calibrate_cameras.sh
  15. Three calibration procedures will be executed. After each one, a GUI will open and the results can be reviewed. Closing the GUI will continue with the next procedure

Raspberry Pi setup

  1. From robofly_installation_guide/install_scripts copy the following files to the drone:
  • initial_config.sh
  • update_portainer_stacks.sh
  • clean_docker_volumes.sh
scp initial_config.sh uav@192.168.12.101:~/.
scp update_portainer_stacks.sh uav@192.168.12.101:~/.
scp clean_docker_volumes.sh uav@192.168.12.101:~/.
  1. Navigate to the uav_custom_files and generate a new ID: ./generate_new_id.py
  2. Copy the generated UAV_ID
  3. Edit the uav_custom_files/uavs.txt and add a new line
  4. Write the name of the project, a new UAV_NAME (e.g. uav80) and the unique ID produced by the generator
  5. ssh to the drone ssh uav@192.168.12.101
  6. On the drone: run sudo ./initial_config.sh uav80 (or your desired UAV_NAME)
  7. On the drone: run ./update_portainer_stacks.sh uav80 1a2b3c (use your UAV_NAME and the unique UAV_ID)
  8. On the drone: sudo reboot
  9. The hostname will now be UAV_NAME, and the IP address will be 192.168.12.1XX (uav80 -> 192.168.12.180, uav2 -> 192.168.12.102...)
  10. Navigate to uav_custom_files/data/robofly
  11. Create a copy of an existing folder and use the unique UAV_ID as its name
  12. Inside this folder, replace camera_calibrations/camera_front.yaml with the calibration output robofly_installation_guide/install_scripts/calibration_output/camera_front.yaml
  13. Replace camera_calibrations/camera_down.yaml with the calibration output robofly_installation_guide/install_scripts/calibration_output/camera_down.yaml
  14. Edit open_vins/open_vins.yaml and replace the values for cam0_distortion_coeffs and cam0_intrinsics with the values from robofly_installation_guide/install_scripts/calibration_output/open_vins_params.yaml
  15. Create a folder ~/docker
  16. Navigate to uav_custom_files and run ./build_image.sh and then ./export_image.sh
  17. If all succeeds, git add, git commit and git push the new and updated files
  18. Open Portainer and access the drone using the new IP address (e.g. 192.168.12.180:9443)
  19. Environment robofly -> Images -> click the Import button
  20. Select file -> ~/docker/uav_custom_files.tar.gz -> click the Upload button
  21. Go back to the Images panel and Remove all images without a tag
  22. Go to Stacks -> camera_test_bottom -> start
  23. On your laptop: navigate to robofly_installation_guide/testing_sessions/test_camera_bottom
  24. Start rviz with ./run uav80 192.168.12.180
  25. Show this AprilTag to the camera, check if the apriltag detector is tracking it (an overlay coordinate system should be visible in rviz)
  26. Stop the stack on the drone, run ./stop.sh on the laptop
  27. Repeat for the front camera
  28. Check AI object detection by running stacks sensor_diagnostics and hailo_ai_yolo
  29. Use testing session robofly_installation_guide/testing_sessions/test_hailo and verify in RVIZ that the neural network is labeling objects shown to the camera
  30. Stop all stacks, stop all testing sessions

Preparing for test flights

  1. Use Portainer to start the mrs_uav_system_vio stack
  2. Navigate to robofly_installation_guide/testing_sessions/test_flight
  3. Run ./run uav80 192.168.12.180 and check the OpenVINS overlay for the camera
  4. Lift the drone into the air and check if the OpenVINS starts tracking features (red tracks should turn into green points)
  5. Verify in Portainer that no container besides ..._copy_shared_data, ..._copy_uav_custom_files has exited with an error
  6. ./stop.sh on the laptop and stop the stack on the drone
  7. Run the mrs_uav_system_gnss stack and check that no container besides ..._copy_shared_data, ..._copy_uav_custom_files has exited with an error
  8. Run the user_session stack while the gnss stack is still running
  9. Check that all containers in user session are running
  10. Stop all stacks

Kakute H7 v1.5 + PX4 v1.14.4

  1. Clone the repo with a custom firmware v1.14.4-robofly
  2. Go to the cloned directory and run make holybro_kakuteh7_default
  3. Use QGroundControl to update firmware
  4. Connect the flight controller to the laptop using USB-C
  5. Go to Vehicle Configuration -> Firmware
  6. Unplug the USB cable and plug it back in
  7. Select custom firmware -> px4_firmware_robofly/build/holybro_kakuteh7_default/holybro_kakuteh7_default.px4
  8. Remove the SD card from the flight controller, plug it into your laptop
  9. Make sure there is a file etc/extras.txt with this content
  10. Put the SD card back to the flight controller

Prepare for shipping

Do this after all test flights

  1. Remove the ./initial_config.sh and ./update_portainer_stacks.sh files
  2. Run ./clean_docker_volumes.sh
  3. Make sure all stacks are stopped in Portainer
  4. Connect to the flight controller using USB and run QGroundControl
  5. Go to Analyze Tools -> Log Download -> Refresh -> Erase All
  6. Vehicle configuration -> Parameters -> Tools -> Save to file...
  7. Upload the parameters to google drive