Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 {
61  struct RoverGuidanceSetpoint sp;
62  struct RoverGuidanceControl cmd;
64  struct RoverGuidancePID turn_pid;
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);
76 
77 #ifdef GUIDANCE_MODE_GUIDED
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 */
Paparazzi floating point algebra.
void rover_guidance_run(float *heading_sp)
void rover_guidance_set_speed_igain(uint32_t igain)
uint8_t mask
bit 5: vx & vy, bit 6: vz, bit 7: vyaw
void rover_guidance_set_turn_igain(uint32_t igain)
struct RoverGuidanceSetpoint sp
setpoints
void rover_guidance_enter(void)
struct RoverGuidancePID turn_pid
turn rate controller
float heading
heading setpoint
struct FloatVect2 speed
speed setpoint
void rover_guidance_periodic(void)
void rover_guidance_init(void)
struct RoverGuidance rover_guidance
struct RoverGuidancePID speed_pid
motor speed controller
struct FloatVect2 pos
position setpoint in NED.
struct RoverGuidanceControl cmd
commands
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
float heading
Definition: wedgebug.c:258