Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 
#define ActuatorPwmSet(_i, _v)
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:58
void px4_set_gimbal_angle_periodic()
Definition: px4_gimbal.c:41
#define PX4_GIMBAL_RC_CHAN
Definition: px4_gimbal.c:23
Hardware independent API for actuators (servos, motor controllers).
void px4_gimbal_init()
Definition: px4_gimbal.c:35
struct RadioControl radio_control
Definition: radio_control.c:30
signed long int32_t
Definition: types.h:19
#define PX4_GIMBAL_PWM_MAX
Definition: px4_gimbal.c:31
#define PX4_GIMBAL_PWM_MIN
Definition: px4_gimbal.c:27
#define MAX_PPRZ
Definition: paparazzi.h:8
#define PX4_GIMBAL_PWM_CHAN
Definition: px4_gimbal.c:20