Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
cam_gimbal.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2005 Pascal Brisset, Antoine Drouin
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, write to
19 * the Free Software Foundation, 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 *
22 */
28#ifndef CAM_GIMBAL_H
29#define CAM_GIMBAL_H
30
31#include "std.h"
34
35#define CAM_GIMBAL_MODE_OFF 0 // Do nothing
36#define CAM_GIMBAL_MODE_JOYSTICK 1 // Manual mode from ABI JOYSTICK message
37#define CAM_GIMBAL_MODE_ANGLES 2 // Input: servo angles
38#define CAM_GIMBAL_MODE_NADIR 3 // Input: look down
39#define CAM_GIMBAL_MODE_TARGET 4 // Input: target position
40#define CAM_GIMBAL_MODE_WAYPOINT 5 // Input: waypoint no
41#define CAM_GIMBAL_MODE_AC_TARGET 6 // Input: ac id
42#define CAM_GIMBAL_MODE_NB 7 // number of modes
43
53typedef void (*cam_angles_from_dir)(struct FloatVect3 dir, float *pan, float *tilt);
54
79
80extern struct CamGimbal cam_gimbal;
81
82extern void cam_gimbal_init(void);
83extern void cam_gimbal_periodic(void);
84
85// API for internal and external use
86extern void cam_gimbal_setup_angles(struct CamGimbal *cam,
87 float pan_max, float pan_min,
88 float tilt_max, float tilt_min);
89extern void cam_gimbal_setup_mounting(struct CamGimbal *cam,
91 struct FloatVect3 gimbal_pos);
93extern void cam_gimbal_run(struct CamGimbal *cam);
94extern void cam_gimbal_set_mode(struct CamGimbal *cam, uint8_t mode);
95extern void cam_gimbal_set_lock(struct CamGimbal *cam, bool lock);
98extern void cam_gimbal_set_angles_rad(struct CamGimbal *cam, float pan, float tilt);
99extern void cam_gimbal_set_angles_deg(struct CamGimbal *cam, float pan, float tilt);
100extern void cam_gimbal_set_target_pos(struct CamGimbal *cam, struct EnuCoor_f target);
101extern void cam_gimbal_set_wp_id(struct CamGimbal *cam, uint8_t wp_id);
102extern void cam_gimbal_set_ac_id(struct CamGimbal *cam, uint8_t ac_id);
103
104// settings handler
105#define cam_gimbal_SetMode(x) cam_gimbal_set_mode(&cam_gimbal,x)
106#define cam_gimbal_SetLock(x) cam_gimbal_set_lock(&cam_gimbal, x)
107#define cam_gimbal_SetPanCommand(x) cam_gimbal_set_pan_command(&cam_gimbal, x)
108#define cam_gimbal_SetTiltCommand(x) cam_gimbal_set_pan_command(&cam_gimbal, x)
109
110#endif // CAM_GIMBAL_H
111
void cam_gimbal_set_tilt_command(struct CamGimbal *cam, int16_t tilt)
Definition cam_gimbal.c:253
void cam_gimbal_set_angles_deg(struct CamGimbal *cam, float pan, float tilt)
Definition cam_gimbal.c:266
int16_t tilt_cmd
tilt command [pprz]
Definition cam_gimbal.h:60
struct FloatRMat gimbal_to_body
rotation matrix from gimbal to body frame
Definition cam_gimbal.h:67
void cam_gimbal_run(struct CamGimbal *cam)
Run camera control.
Definition cam_gimbal.c:294
void cam_gimbal_set_mode(struct CamGimbal *cam, uint8_t mode)
Definition cam_gimbal.c:234
float pan_min
pan angle at minimum command
Definition cam_gimbal.h:63
float pan_angle
pan angle [rad]
Definition cam_gimbal.h:71
void cam_gimbal_init(void)
Init module.
Definition cam_gimbal.c:326
void cam_gimbal_set_wp_id(struct CamGimbal *cam, uint8_t wp_id)
Definition cam_gimbal.c:279
void cam_gimbal_set_lock(struct CamGimbal *cam, bool lock)
Definition cam_gimbal.c:243
void cam_gimbal_set_target_pos(struct CamGimbal *cam, struct EnuCoor_f target)
Definition cam_gimbal.c:274
float pan_max
pan angle at maximum command
Definition cam_gimbal.h:62
void cam_gimbal_set_ac_id(struct CamGimbal *cam, uint8_t ac_id)
Definition cam_gimbal.c:286
int16_t pan_cmd
pan command [pprz]
Definition cam_gimbal.h:59
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
uint8_t target_wp_id
waypoint ID to track
Definition cam_gimbal.h:74
void cam_gimbal_setup_mounting(struct CamGimbal *cam, struct FloatEulers gimbal_to_body, struct FloatVect3 gimbal_pos)
Definition cam_gimbal.c:221
uint8_t mode
gimbal control mode
Definition cam_gimbal.h:56
void cam_gimbal_periodic(void)
Periodic call (run control)
Definition cam_gimbal.c:355
int16_t pan_joystick
pan command from joystick
Definition cam_gimbal.h:76
float tilt_min
tilt angle at minimum command
Definition cam_gimbal.h:65
bool lock
lock current command
Definition cam_gimbal.h:57
uint8_t target_ac_id
aircraft ID to track
Definition cam_gimbal.h:75
struct EnuCoor_f target_pos
target point in ENU world frame [m]
Definition cam_gimbal.h:73
void cam_gimbal_set_angles_callback(struct CamGimbal *cam, cam_angles_from_dir compute_angles)
Definition cam_gimbal.c:229
struct FloatVect3 gimbal_pos
position of the gimbal in body NED frame [m]
Definition cam_gimbal.h:68
float tilt_angle
tilt angle [rad]
Definition cam_gimbal.h:72
void(* cam_angles_from_dir)(struct FloatVect3 dir, float *pan, float *tilt)
Function pointer to return cam angle from a specified direction.
Definition cam_gimbal.h:53
int16_t tilt_joystick
tilt command from joystick
Definition cam_gimbal.h:77
void cam_gimbal_set_angles_rad(struct CamGimbal *cam, float pan, float tilt)
Definition cam_gimbal.c:258
float tilt_max
tilt angle at maximum command
Definition cam_gimbal.h:64
struct CamGimbal cam_gimbal
Definition cam_gimbal.c:86
cam_angles_from_dir compute_angles
cam angles from looking direction callback
Definition cam_gimbal.h:69
void cam_gimbal_set_pan_command(struct CamGimbal *cam, int16_t pan)
Definition cam_gimbal.c:248
euler angles
rotation matrix
uint16_t foo
Definition main_demo5.c:58
Paparazzi floating point algebra.
Paparazzi floating point math for geodetic calculations.
vector in East North Up coordinates Units: meters
static const float dir[]
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
Definition sonar_bebop.c:65
struct target_t target
Definition target_pos.c:65
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.