Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
px4_gimbal.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) Kevin van Hecke
3  *
4  * This file is part of paparazzi
5  *
6  */
15 
16 #include "generated/airframe.h" // AC_ID is required
17 #include "subsystems/actuators.h"
18 
19 #ifndef PX4_GIMBAL_PWM_CHAN
20 #define PX4_GIMBAL_PWM_CHAN 0
21 #endif
22 #ifndef PX4_GIMBAL_RC_CHAN
23 #define PX4_GIMBAL_RC_CHAN RADIO_AUX2
24 #endif
25 
26 #ifndef PX4_GIMBAL_PWM_MIN
27 #define PX4_GIMBAL_PWM_MIN 900
28 #endif
29 
30 #ifndef PX4_GIMBAL_PWM_MAX
31 #define PX4_GIMBAL_PWM_MAX 1500
32 #endif
33 
34 
36 #ifdef INTER_MCU_AP
37  actuators_init();
38 #endif
39 }
40 
42  //reroute gimbal rc input from fbw to pwm output on ap
43 
45 
46  float range = PX4_GIMBAL_PWM_MAX - PX4_GIMBAL_PWM_MIN;
47  value = ((MAX_PPRZ-value) / (float)MAX_PPRZ) * range + PX4_GIMBAL_PWM_MIN;
48  if (value < 1) {value=1;} // 0 does not seem to work
49 
51 
52 #ifdef INTER_MCU_AP
53  AllActuatorsCommit();
54 #endif
55 
56 
57  }
58 
59 
60 
radio_control.h
MAX_PPRZ
#define MAX_PPRZ
Definition: paparazzi.h:8
PX4_GIMBAL_PWM_MIN
#define PX4_GIMBAL_PWM_MIN
Definition: px4_gimbal.c:27
px4_gimbal_init
void px4_gimbal_init()
Definition: px4_gimbal.c:35
PX4_GIMBAL_PWM_CHAN
#define PX4_GIMBAL_PWM_CHAN
Definition: px4_gimbal.c:20
px4_set_gimbal_angle_periodic
void px4_set_gimbal_angle_periodic()
Definition: px4_gimbal.c:41
px4_gimbal.h
ActuatorPwmSet
#define ActuatorPwmSet(_i, _v)
Definition: actuators_pwm_arch.h:85
PX4_GIMBAL_RC_CHAN
#define PX4_GIMBAL_RC_CHAN
Definition: px4_gimbal.c:23
PX4_GIMBAL_PWM_MAX
#define PX4_GIMBAL_PWM_MAX
Definition: px4_gimbal.c:31
int32_t
signed long int32_t
Definition: types.h:19
radio_control
struct RadioControl radio_control
Definition: radio_control.c:30
actuators.h
RadioControl::values
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:69