Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
gimbal_caddx_gm3.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 Julia Cabarbaye <julia.cabarbaye1@gmail.com>
3 * 2025 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
30#include "generated/airframe.h"
32#include "pprzlink/dl_protocol.h" // datalink messages
33
34// mechanical characteristics
35#define GIMBAL_CADDX_PAN_MAX RadOfDeg(160.f)
36#define GIMBAL_CADDX_TILT_MAX RadOfDeg(120.f)
37#define GIMBAL_CADDX_ROLL_MAX RadOfDeg(60.f)
38#define GIMBAL_CADDX_TILT_OFFSET RadOfDeg(15.f)
39
40
42
53static void gimbal_caddx_compute_angles(struct FloatVect3 dir, float *pan, float *tilt)
54{
55 float roll = gimbal_caddx_gm3_roll;
57 *tilt = asinf(- dir.z / cosf(roll));
58 *pan = atan2f(dir.y - sinf(roll)*tanf(*tilt)*dir.x, dir.x);
59}
60
62{
63 // Set the cam control with the specific parameter of CaddX GM3 gimble
68
69 // Set mode
70#ifdef SERVO_GIMBAL_CADDX_MODE_NEUTRAL
72#endif
73#ifdef SERVO_GIMBAL_CADDX_SENS_NEUTRAL
75#endif
76
78#ifdef SERVO_GIMBAL_CADDX_ROLL_NEUTRAL
79 // GM2 model can be used as a GM3 without roll
81#endif
82}
83
85{
86#ifdef SERVO_GIMBAL_CADDX_ROLL_NEUTRAL
89#endif
90}
91
void cam_gimbal_setup_angles(struct CamGimbal *cam, float pan_max, float pan_min, float tilt_max, float tilt_min)
Definition cam_gimbal.c:211
void cam_gimbal_set_angles_callback(struct CamGimbal *cam, cam_angles_from_dir compute_angles)
Definition cam_gimbal.c:229
struct CamGimbal cam_gimbal
Definition cam_gimbal.c:86
Pan/Tilt camera gimbal control.
#define GIMBAL_CADDX_TILT_MAX
void gimbal_caddx_gm3_periodic(void)
#define GIMBAL_CADDX_PAN_MAX
static void gimbal_caddx_compute_angles(struct FloatVect3 dir, float *pan, float *tilt)
Compute pan and tilt angle for the 3-axis gimbal CaddX GM3.
#define GIMBAL_CADDX_ROLL_MAX
void gimbal_caddx_gm3_init(void)
float gimbal_caddx_gm3_roll
uint16_t foo
Definition main_demo5.c:58
Hardware independent API for actuators (servos, motor controllers).
#define MAX_PPRZ
Definition paparazzi.h:8
#define MIN_PPRZ
Definition paparazzi.h:9
static const float dir[]