Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 */
Paparazzi floating point algebra.
void rover_holo_guidance_init(void)
struct RoverHoloGuidance rover_holo_guidance
uint8_t mask
bit 5: vx & vy, bit 6: vz, bit 7: vyaw
void rover_holo_guidance_periodic(void)
struct RoverHoloGuidancePID speed_pid
motor speed controller
void rover_holo_guidance_run(float *heading_sp)
struct FloatVect2 speed
speed setpoint
struct RoverHoloGuidanceSetpoint sp
setpoints
struct RoverHoloGuidancePID turn_pid
turn rate controller
void rover_holo_guidance_enter(void)
void rover_guidance_holonomic_set_turn_igain(float igain)
void rover_guidance_holonomic_set_speed_igain(float igain)
struct RoverHoloGuidanceControl cmd
commands
struct FloatVect2 pos
position setpoint in NED.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98