top of page
Buscar
  • Foto del escritorCarlos Caminero

Drone Cat Mouse

Actualizado: 29 ene 2021

In this project we will apply everything we have learned to carry out the Drone Cat Mouse project, where we will have to make use of finite state machines, PID controllers and image filter using OpenCV.


The Steps I have followed are:


1. Filtering the image with OpenCV.

This part is like Formula 1 exercise where we had to filter a red line. The color of mouse is red too. The steps to filter have been the following:

- Get the dimensions of the images.

- Get HSV image and mask of each camera

- Find Contours of the drone and draw them

- Show the two images filtered (frontal camera, ventral camera)

- (Centroid will be obtained in Follow State)


Example Ventral Camera

2. Creating a Finite State Machine.

This part is like Vacuum Cleaner exercises where the agent's perceptions and actions depended on the state in which he was.

The first state is Takeoff State. This state will be executed once. Then, in Search State (Looking For) the cat will move in circles until detect the mouse. When the mouse is detected, the next state will be Follow State, in which the cat follows the mouse.

If the cat has lost the mouse, the next state will come back to Search State. In this picture you can see the scheme of the State Machine.

3. Creating Searching State.

In this step, we develop the Searching State to define the behavior of the cat in case of it has lost the mouse. The cat describes circular movements and when the size of the list of contours is greater than 0, the cat will have seen the mouse and it will stop, changing the state to Follow State


4. Creating Follow State and adjusting PD and P Controllers.

In this step we develop similars Controllers to Formula 1 exercise with the objective of following the mouse.

I needed 6 controllers.

For frontal camera:

- Forward/Backward velocity -> PD Controller

- Angular velocity -> PD Controller

- Speed in Height -> P Controller

For ventral camera:

- Lateral velocity -> PD Controller

- Forward / Backward velocity -> PD Controller

- Speed in Height -> P Controller

Inertia: It is a relevant point to consider. Imagine that the cat detects the mouse on his right, but when it is about to perform the movement it loses the mouse due to the inclination. Without inertia, the cat would change to the state of Search State just when the mouse is not present in his perception, but with the inertia included, a certain margin of movement is allowed in case of losing it.

In PD Controllers, I have implemented vitaminized P controllers, whose equation would be de following:

PD = P + D = -Kp*sign(error)*error^(x) + D, where x is an exponent that we choose.

With this tipe of controllers, the applied force in the case that the mouse is on the edges of the camera will be much greater


TESTS

To test the robustness of the drone I have tried two tests to check the controllers.

TEST 1

To mainly test the ventral camera

TEST 2

To mainly test the frontal camera


LEVELS

To examine the drone we can use 3 levels. Next, I will show you the easiest level (level 0) and the most difficult level (level 3)

Level 0

In it, we can see the operation of the ventral camera

Level 3

This is the most difficult level. In it, we can see the operation of the frontal camera.


Conclusions

It has been a very complete exercise where you can put to the test many of the study topics of robotics, for instance, finite states machine, pid controllers, vision ... However, I have encountered certain problems when developing the PD controllers. It was very difficult to adjust the constants Kp and Kd, since according to the project programming. It was not possible to create separate graphical user interfaces (GUI) as I did with the Formula 1 exercise. It is possible to improve PD controllers in the future and find a faster and more stable behavior. Programming autonomous drones and robots has never been an easy task :)

72 visualizaciones0 comentarios

Entradas Recientes

Ver todo
bottom of page