Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@4:53ac11e9e8b9, 2021-05-03 (annotated)
- Committer:
- xaficz
- Date:
- Mon May 03 15:22:53 2021 +0000
- Revision:
- 4:53ac11e9e8b9
- Parent:
- 3:0a718d139ed1
- Child:
- 5:25bd866ef068
VFH com Lidar
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| LuisRA | 0:2b691d200d6f | 1 | #include "mbed.h" |
| LuisRA | 0:2b691d200d6f | 2 | #include "BufferedSerial.h" |
| LuisRA | 0:2b691d200d6f | 3 | #include "rplidar.h" |
| fabiofaria | 1:dc87724abce8 | 4 | #include "Robot.h" |
| fabiofaria | 1:dc87724abce8 | 5 | #include "Communication.h" |
| xaficz | 4:53ac11e9e8b9 | 6 | #include <string.h> |
| xaficz | 4:53ac11e9e8b9 | 7 | #include <stdio.h> |
| xaficz | 4:53ac11e9e8b9 | 8 | #include <math.h> |
| LuisRA | 0:2b691d200d6f | 9 | |
| xaficz | 4:53ac11e9e8b9 | 10 | #define pi 3.14159265359 |
| fabiofaria | 1:dc87724abce8 | 11 | |
| xaficz | 4:53ac11e9e8b9 | 12 | // ****** Inicialização de Variáveis ****** // |
| LuisRA | 0:2b691d200d6f | 13 | |
| xaficz | 4:53ac11e9e8b9 | 14 | // Carateristicas da Plataforma |
| xaficz | 4:53ac11e9e8b9 | 15 | float r = 3.5; |
| xaficz | 4:53ac11e9e8b9 | 16 | float L = 15; |
| xaficz | 4:53ac11e9e8b9 | 17 | |
| xaficz | 4:53ac11e9e8b9 | 18 | // Velocidade Máxima das Rodas |
| xaficz | 4:53ac11e9e8b9 | 19 | float w_Max = 150; |
| xaficz | 4:53ac11e9e8b9 | 20 | |
| xaficz | 4:53ac11e9e8b9 | 21 | // Posição Inicial e Final |
| xaficz | 4:53ac11e9e8b9 | 22 | float x_Inicial = 15; |
| xaficz | 4:53ac11e9e8b9 | 23 | float y_Inicial = 15; |
| xaficz | 4:53ac11e9e8b9 | 24 | float phi_Inicial = 0; |
| xaficz | 4:53ac11e9e8b9 | 25 | float x_Final = 100; |
| xaficz | 4:53ac11e9e8b9 | 26 | float y_Final = 75; |
| xaficz | 4:53ac11e9e8b9 | 27 | |
| xaficz | 4:53ac11e9e8b9 | 28 | // Ganhos de Controlo |
| xaficz | 4:53ac11e9e8b9 | 29 | float kv = 9; |
| xaficz | 4:53ac11e9e8b9 | 30 | float ki = 0.15; |
| xaficz | 4:53ac11e9e8b9 | 31 | float ks = 18; |
| LuisRA | 0:2b691d200d6f | 32 | |
| xaficz | 4:53ac11e9e8b9 | 33 | // Alpha e Limiares |
| xaficz | 4:53ac11e9e8b9 | 34 | float Limiar_Histograma = 3; |
| xaficz | 4:53ac11e9e8b9 | 35 | float Limiar_Vale = 0.5; |
| xaficz | 4:53ac11e9e8b9 | 36 | |
| xaficz | 4:53ac11e9e8b9 | 37 | // Matrizes de Mapeamento |
| xaficz | 4:53ac11e9e8b9 | 38 | float Map[80][80]; |
| xaficz | 4:53ac11e9e8b9 | 39 | float Log_Map[80][80]; |
| xaficz | 4:53ac11e9e8b9 | 40 | |
| xaficz | 4:53ac11e9e8b9 | 41 | int main(){ |
| xaficz | 4:53ac11e9e8b9 | 42 | |
| xaficz | 4:53ac11e9e8b9 | 43 | //:::::::::::::::::Inicializaçao dos Mapas a zero:::::::::::: |
| xaficz | 4:53ac11e9e8b9 | 44 | |
| xaficz | 4:53ac11e9e8b9 | 45 | for(int i = 0; i < 80; i++){ |
| xaficz | 4:53ac11e9e8b9 | 46 | for(int j = 0; j < 80; j++){ |
| xaficz | 4:53ac11e9e8b9 | 47 | Map[i][j] = 0; |
| LuisRA | 0:2b691d200d6f | 48 | } |
| xaficz | 4:53ac11e9e8b9 | 49 | } |
| xaficz | 4:53ac11e9e8b9 | 50 | |
| xaficz | 4:53ac11e9e8b9 | 51 | for(int i = 0; i < 80; i++){ |
| xaficz | 4:53ac11e9e8b9 | 52 | for(int j = 0; j < 80; j++){ |
| xaficz | 4:53ac11e9e8b9 | 53 | Log_Map[i][j] = 0; |
| xaficz | 4:53ac11e9e8b9 | 54 | } |
| xaficz | 4:53ac11e9e8b9 | 55 | } |
| xaficz | 4:53ac11e9e8b9 | 56 | |
| xaficz | 4:53ac11e9e8b9 | 57 | |
| xaficz | 4:53ac11e9e8b9 | 58 | //:::::::::::::::::::::Função VFH::::::::::::::::::::.. |
| xaficz | 4:53ac11e9e8b9 | 59 | |
| xaficz | 4:53ac11e9e8b9 | 60 | VFH(x_Inicial, y_Inicial, phi_Inicial, x_Final, y_Final, Log_Map, Map, Limiar_Histograma, Limiar_Vale, kv, ki, ks, L, r, w_Max); |
| xaficz | 4:53ac11e9e8b9 | 61 | |
| fabiofaria | 1:dc87724abce8 | 62 | } |