Paparazzi UAS  v5.18.0_stable
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 */
rover_guidance_holonomic_set_turn_igain
void rover_guidance_holonomic_set_turn_igain(float igain)
Definition: rover_guidance_holonomic.c:147
rover_holo_guidance_periodic
void rover_holo_guidance_periodic(void)
Definition: rover_guidance_holonomic.c:68
rover_holo_guidance_run
void rover_holo_guidance_run(float *heading_sp)
Definition: rover_guidance_holonomic.c:84
rover_holo_guidance_enter
void rover_holo_guidance_enter(void)
Definition: rover_guidance_holonomic.c:131
RoverHoloGuidanceSetpoint::mask
uint8_t mask
bit 5: vx & vy, bit 6: vz, bit 7: vyaw
Definition: rover_guidance_holonomic.h:42
RoverHoloGuidancePID::d
float d
Definition: rover_guidance_holonomic.h:49
pprz_algebra_float.h
Paparazzi floating point algebra.
RoverHoloGuidanceSetpoint::heading
float heading
heading setpoint
Definition: rover_guidance_holonomic.h:41
FloatVect2
Definition: pprz_algebra_float.h:49
std.h
RoverHoloGuidanceSetpoint
Definition: rover_guidance_holonomic.h:36
RoverHoloGuidanceSetpoint::speed
struct FloatVect2 speed
speed setpoint
Definition: rover_guidance_holonomic.h:40
RoverHoloGuidanceControl
Definition: rover_guidance_holonomic.h:56
RoverHoloGuidancePID::err
float err
Definition: rover_guidance_holonomic.h:50
uint8_t
unsigned char uint8_t
Definition: types.h:14
RoverHoloGuidancePID::i
float i
Definition: rover_guidance_holonomic.h:48
RoverHoloGuidancePID::sum_err
float sum_err
Definition: rover_guidance_holonomic.h:52
RoverHoloGuidanceControl::motor_speed_y
float motor_speed_y
Definition: rover_guidance_holonomic.h:58
rover_holo_guidance
struct RoverHoloGuidance rover_holo_guidance
Definition: rover_guidance_holonomic.c:36
RoverHoloGuidance::turn_pid
struct RoverHoloGuidancePID turn_pid
turn rate controller
Definition: rover_guidance_holonomic.h:66
RoverHoloGuidanceSetpoint::pos
struct FloatVect2 pos
position setpoint in NED.
Definition: rover_guidance_holonomic.h:39
rover_holo_guidance_init
void rover_holo_guidance_init(void)
Definition: rover_guidance_holonomic.c:43
RoverHoloGuidancePID::d_err
float d_err
Definition: rover_guidance_holonomic.h:51
RoverHoloGuidancePID::p
float p
Definition: rover_guidance_holonomic.h:47
RoverHoloGuidanceControl::motor_speed_x
float motor_speed_x
Definition: rover_guidance_holonomic.h:57
RoverHoloGuidance::sp
struct RoverHoloGuidanceSetpoint sp
setpoints
Definition: rover_guidance_holonomic.h:64
RoverHoloGuidance::cmd
struct RoverHoloGuidanceControl cmd
commands
Definition: rover_guidance_holonomic.h:63
RoverHoloGuidanceControl::motor_turn
float motor_turn
Definition: rover_guidance_holonomic.h:59
RoverHoloGuidancePID
Definition: rover_guidance_holonomic.h:46
RoverHoloGuidance
Definition: rover_guidance_holonomic.h:62
rover_guidance_holonomic_set_speed_igain
void rover_guidance_holonomic_set_speed_igain(float igain)
Definition: rover_guidance_holonomic.c:141
RoverHoloGuidance::speed_pid
struct RoverHoloGuidancePID speed_pid
motor speed controller
Definition: rover_guidance_holonomic.h:65