Paparazzi UAS  v5.15_devel-88-gb3ad7fe
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
rover_guidance.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
28 #ifndef ROVER_GUIDANCE_H
29 #define ROVER_GUIDANCE_H
30 
31 
33 #include "generated/airframe.h"
34 #include "std.h"
35 
39  struct FloatVect2 pos;
40  struct FloatVect2 speed;
41  float heading;
43 };
44 
45 // TODO write a generic PID somewhere else ?
47  float p;
48  float i;
49  float d;
50  float err;
51  float d_err;
52  float sum_err;
53 };
54 
56  float motor_speed;
57  float motor_turn;
58 };
59 
60 struct RoverGuidance {
65 };
66 
67 extern struct RoverGuidance rover_guidance;
68 
69 extern void rover_guidance_init(void);
70 extern void rover_guidance_periodic(void); // call state machine
71 extern void rover_guidance_run(float *heading_sp); // run control loop
72 extern void rover_guidance_enter(void);
73 
74 extern void rover_guidance_set_speed_igain(uint32_t igain);
75 extern void rover_guidance_set_turn_igain(uint32_t igain);
76 
77 #ifdef GUIDANCE_MODE_GUIDED
78 
80 extern void rover_guidance_guided_run(bool in_flight);
81 
87 extern bool rover_guidance_set_guided_pos(float x, float y);
88 
93 extern bool rover_guidance_set_guided_heading(float heading);
94 
100 extern bool rover_guidance_set_guided_body_vel(float vx, float vy);
101 
107 extern bool rover_guidance_set_guided_vel(float vx, float vy);
108 
113 extern bool rover_guidance_set_guided_heading_rate(float rate);
114 #endif
115 
116 //static inline void rover_guidance_SetMaxSpeed(float speed)
117 //{
118 // gh_set_max_speed(speed);
119 //}
120 //
121 //static inline void rover_guidance_SetOmega(float omega)
122 //{
123 // gh_set_omega(omega);
124 //}
125 //
126 //static inline void rover_guidance_SetZeta(float zeta)
127 //{
128 // gh_set_zeta(zeta);
129 //}
130 //
131 //static inline void rover_guidance_SetTau(float tau)
132 //{
133 // gh_set_tau(tau);
134 //}
135 
136 #endif /* ROVER_GUIDANCE_H */
void rover_guidance_periodic(void)
struct RoverGuidancePID speed_pid
motor speed controller
struct RoverGuidance rover_guidance
struct FloatVect2 speed
speed setpoint
void rover_guidance_set_turn_igain(uint32_t igain)
float heading
heading setpoint
struct RoverGuidancePID turn_pid
turn rate controller
void rover_guidance_run(float *heading_sp)
static float heading
Definition: ahrs_infrared.c:45
Paparazzi floating point algebra.
unsigned long uint32_t
Definition: types.h:18
uint8_t mask
bit 5: vx & vy, bit 6: vz, bit 7: vyaw
struct RoverGuidanceSetpoint sp
setpoints
unsigned char uint8_t
Definition: types.h:14
struct RoverGuidanceControl cmd
commands
void rover_guidance_set_speed_igain(uint32_t igain)
void rover_guidance_enter(void)
struct FloatVect2 pos
position setpoint in NED.
void rover_guidance_init(void)