Commande en vitesse OK
This commit is contained in:
		
							parent
							
								
									9ffa087e2d
								
							
						
					
					
						commit
						ca8bce87f4
					
				
							
								
								
									
										4
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							| @ -1,6 +1,8 @@ | |||||||
| { | { | ||||||
|     "files.associations": { |     "files.associations": { | ||||||
|         "geometrie.h": "c", |         "geometrie.h": "c", | ||||||
|         "geometrie_robot.h": "c" |         "geometrie_robot.h": "c", | ||||||
|  |         "commande_vitesse.h": "c", | ||||||
|  |         "asser_moteurs.h": "c" | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -12,6 +12,7 @@ pico_sdk_init() | |||||||
| 
 | 
 | ||||||
| add_executable(Mon_Projet | add_executable(Mon_Projet | ||||||
|   Asser_Moteurs.c |   Asser_Moteurs.c | ||||||
|  |   Commande_vitesse.c | ||||||
|   Geometrie.c |   Geometrie.c | ||||||
|   Moteurs.c |   Moteurs.c | ||||||
|   Localisation.c |   Localisation.c | ||||||
|  | |||||||
							
								
								
									
										27
									
								
								Commande_vitesse.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								Commande_vitesse.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | |||||||
|  | #include "Asser_Moteurs.h" | ||||||
|  | #include "Geometrie_robot.h" | ||||||
|  | #include "Commande_vitesse.h" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /// @brief Commande de la vitesse dans le référentiel du robot
 | ||||||
|  | /// @param avance_mm_s : Vitesse d'avance
 | ||||||
|  | /// @param orientation_radian_s : Rotation en radian/s 
 | ||||||
|  | void commande_vitesse(float avance_mm_s, float orientation_radian_s){ | ||||||
|  |     float vitesse_roue_gauche, vitesse_roue_droite; | ||||||
|  | 
 | ||||||
|  |     vitesse_roue_gauche = avance_mm_s - (orientation_radian_s * DISTANCE_ROUES_CENTRE_MM); | ||||||
|  |     vitesse_roue_droite = avance_mm_s + (orientation_radian_s * DISTANCE_ROUES_CENTRE_MM); | ||||||
|  | 
 | ||||||
|  |     AsserMoteur_setConsigne_mm_s(MOTEUR_A, vitesse_roue_droite); | ||||||
|  |     AsserMoteur_setConsigne_mm_s(MOTEUR_B, vitesse_roue_gauche); | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /// @brief Arrête le robot.
 | ||||||
|  | void commande_vitesse_stop(){ | ||||||
|  |     AsserMoteur_setConsigne_mm_s(MOTEUR_A, 0); | ||||||
|  |     AsserMoteur_setConsigne_mm_s(MOTEUR_B, 0); | ||||||
|  | } | ||||||
							
								
								
									
										2
									
								
								Commande_vitesse.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Commande_vitesse.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | void commande_vitesse(float vitesse_avance_mm_s, float orientation_radian_s); | ||||||
|  | void commande_vitesse_stop(void); | ||||||
							
								
								
									
										3
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								main.c
									
									
									
									
									
								
							| @ -9,6 +9,7 @@ | |||||||
| #include "hardware/pwm.h" | #include "hardware/pwm.h" | ||||||
| #include "Asser_Moteurs.h" | #include "Asser_Moteurs.h" | ||||||
| #include "Localisation.h" | #include "Localisation.h" | ||||||
|  | #include "Commande_vitesse.h" | ||||||
| #include "Moteurs.h" | #include "Moteurs.h" | ||||||
| #include "Temps.h" | #include "Temps.h" | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| @ -47,6 +48,8 @@ void main(void) | |||||||
| 
 | 
 | ||||||
| 	 | 	 | ||||||
| 	multicore_launch_core1(affichage); | 	multicore_launch_core1(affichage); | ||||||
|  | 	 | ||||||
|  | 	commande_vitesse(100 , 1.); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	while(1){ | 	while(1){ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user