Skip to content

The repository contain codes for calibrating camera, generating aruco marker and getting pose estimation from that using the calibrated camera. And then using that position estimation pluto drone position cotrol is implemented

Notifications You must be signed in to change notification settings

aman765m/Inter_IIT_23_task2_team27

Repository files navigation

Inter_IIT_23_task2_team27

The repository contain codes for calibrating camera, generating aruco marker and getting pose estimation from that using the calibrated camera. And then using that position estimation pluto drone position cotrol is implemented

Installation

The following libraries are required to be installed for the codes to work (make sure python version is 3.6 or higher):-

• Python library manager

  sudo apt-get update
  sudo apt-get -y install python3-pip

• opencv-contrib version 4.7

  pip install opencv-contrib-python==4.7.0.68

• numpy

  pip install numpy

Camera calibration

WhatsApp Image 2023-02-02 at 12 08 33

For getting the position estimation robustly using ArUco marker, it is necessary to have the intrinsic and extrinsic properties of camera. To do the calibration, a checker board pattern is needed. The size meintioned the code is 12X8 (counting the inner corners), where size of each square is 17.8mm.

To get the images for calibration run image_capture.py. A camera preview window will appear, where pressing 's' will capture the image and save them in 'calibration' folder.

Now to get the matrices, run mono_calibration.py. Matrices will be printed in the output, which needs to be update in pose_est.py at lines 45 and 49. Make sure to keep the correct checkerboard parametres on line 9 and 22.

Reference for camera calibration

https://github.com/niconielsen32/ComputerVision/blob/master/cameraCalibration.py

ArUco marker generation and pose estimation

Run aruco_creator.py to generate the ArUco tag. Make sure to keep the desired marker type in line 29 'aruco_type'

Now we are ready to get the position estimation from the ArUco marker. There is a pose_est.py for the same, update the camera matrices at lines 45 and 49 with the values got after calibration. The class camera_pose() is called by the drone controller class quadControl() to get the position update.

Reference for ArUco based pose estimation

https://github.com/niconielsen32/ComputerVision/tree/master/ArUco

Running codes for task 2

Run hover_task2.py to make the drone takeoff and hover for 10 seconds and then lands automatically.

Run hover_and_rect.py to make the drone follow a rectangular trajectory and land automatically.

Incase of emergency, pressing ctrl+C aborts the task and lands the drone safely

Both code uses quadCopter() class for running a closed loop control, where feedback comes from camera using camera_pose() class.

ezgif com-gif-maker (3)

Documentation

Proper documentation of all the classes and methods related to task 2 is provided below.

Task2 documentation

For the documentation of socket communication and MSP (Multiwii Serial Protocol), follow the link below.

Task1 documentation

Link for report Task 1 and 2 Report

About

The repository contain codes for calibrating camera, generating aruco marker and getting pose estimation from that using the calibrated camera. And then using that position estimation pluto drone position cotrol is implemented

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages