Paparazzi UAS  v7.0_unstable
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 #include "generated/modules.h" // for RC channels definition
16 
17 #include "generated/airframe.h" // AC_ID is required
19 
20 #ifndef PX4_GIMBAL_PWM_CHAN
21 #define PX4_GIMBAL_PWM_CHAN 0
22 #endif
23 #ifndef PX4_GIMBAL_RC_CHAN
24 #define PX4_GIMBAL_RC_CHAN RADIO_AUX2
25 #endif
26 
27 #ifndef PX4_GIMBAL_PWM_MIN
28 #define PX4_GIMBAL_PWM_MIN 900
29 #endif
30 
31 #ifndef PX4_GIMBAL_PWM_MAX
32 #define PX4_GIMBAL_PWM_MAX 1500
33 #endif
34 
35 
37 #ifdef INTER_MCU_AP
39 #endif
40 }
41 
43  //reroute gimbal rc input from fbw to pwm output on ap
44 
46 
47  float range = PX4_GIMBAL_PWM_MAX - PX4_GIMBAL_PWM_MIN;
48  value = ((MAX_PPRZ-value) / (float)MAX_PPRZ) * range + PX4_GIMBAL_PWM_MIN;
49  if (value < 1) {value=1;} // 0 does not seem to work
50 
52 
53 #ifdef INTER_MCU_AP
54  AllActuatorsCommit();
55 #endif
56 
57 
58  }
59 
60 
61 
#define ActuatorPwmSet(_i, _v)
void actuators_init(void)
Definition: actuators.c:138
Hardware independent API for actuators (servos, motor controllers).
#define MAX_PPRZ
Definition: paparazzi.h:8
#define PX4_GIMBAL_PWM_MAX
Definition: px4_gimbal.c:32
#define PX4_GIMBAL_PWM_MIN
Definition: px4_gimbal.c:28
void px4_gimbal_init()
Definition: px4_gimbal.c:36
void px4_set_gimbal_angle_periodic()
Definition: px4_gimbal.c:42
#define PX4_GIMBAL_PWM_CHAN
Definition: px4_gimbal.c:21
#define PX4_GIMBAL_RC_CHAN
Definition: px4_gimbal.c:24
struct RadioControl radio_control
Definition: radio_control.c:33
Generic interface for radio control modules.
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:67
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83