Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
rover_guidance_holonomic.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Fabien Bonneval <fabien.bonneval@gmail.com>
3  * Gautier Hattenberger <gautier.hattenberger@enac.fr>
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
29 #ifndef ROVER_GUIDANCE_HOLONOMIC_H
30 #define ROVER_GUIDANCE_HOLONOMIC_H
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 
55 
59  float motor_turn;
60 };
61 
67 };
68 
70 
71 extern void rover_holo_guidance_init(void);
72 extern void rover_holo_guidance_periodic(void); // call state machine
73 extern void rover_holo_guidance_run(float *heading_sp); // run control loop
74 extern void rover_holo_guidance_enter(void);
75 
76 // settings handler
77 extern void rover_guidance_holonomic_set_speed_igain(float igain);
78 extern void rover_guidance_holonomic_set_turn_igain(float igain);
79 
80 // helper macro to set AP throttle value
81 #define SetAPThrottleFromCommands(_cmd_x, _cmd_y) { \
82  autopilot.throttle = sqrtf(((_cmd_x * _cmd_x) + (_cmd_y * _cmd_y)) / 2.f); \
83  }
84 
85 #endif /* ROVER_GUIDANCE_HOLONOMIC_H */
struct RoverHoloGuidanceSetpoint sp
setpoints
float heading
heading setpoint
struct RoverHoloGuidancePID speed_pid
motor speed controller
void rover_guidance_holonomic_set_speed_igain(float igain)
void rover_guidance_holonomic_set_turn_igain(float igain)
struct RoverHoloGuidance rover_holo_guidance
uint8_t mask
bit 5: vx & vy, bit 6: vz, bit 7: vyaw
void rover_holo_guidance_enter(void)
Paparazzi floating point algebra.
void rover_holo_guidance_init(void)
unsigned char uint8_t
Definition: types.h:14
struct RoverHoloGuidancePID turn_pid
turn rate controller
void rover_holo_guidance_periodic(void)
struct RoverHoloGuidanceControl cmd
commands
struct FloatVect2 pos
position setpoint in NED.
struct FloatVect2 speed
speed setpoint
void rover_holo_guidance_run(float *heading_sp)