Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
actuators.h
Go to the documentation of this file.
1/*
2 * (c) 2003-2005 Pascal Brisset, Antoine Drouin
3 * (c) 2012 Gautier Hattenberger
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
27#ifndef ACTUATORS_H
28#define ACTUATORS_H
29
30#include "paparazzi.h"
31#include "std.h"
32
33/*
34 * Defines SetActuatorsFromCommands() macro
35 * Defines ACTUATORS_NB to 0 if no servo
36 * Include servos drivers
37 */
38#include "generated/airframe.h"
39
40extern void actuators_init(void);
41extern void actuators_periodic(void);
42
43// Actuator feedback structure for ABI Message
47 bool rpm: 1;
48 bool position: 1;
49 bool force: 1;
50 bool speed: 1;
51 bool power: 1;
52 } set;
53
55 float position;
56 float force;
57 float speed;
59};
60
61// Actuator configuration
71
77typedef void (*act_set_t)(uint8_t driver_idx, int16_t driver_value);
78
79#if ACTUATORS_NB
80
81extern uint32_t actuators_delay_time;
82extern bool actuators_delay_done;
83
84// Actuator feedback structure for ABI Message
85struct actuator_t {
86 pprz_t pprz_val;
87 int16_t driver_val;
88 struct act_config_t config;
89 act_set_t set;
90};
91
94extern struct actuator_t actuators[ACTUATORS_NB];
95
100extern void actuator_set(uint8_t pprz_idx, pprz_t pprz_value);
101
106#define ActuatorSet(_n, _v) actuator_set(SERVO_ ## _n ## _IDX, _v)
107
110extern int16_t actuator_get(uint8_t pprz_idx);
111
114extern uint8_t actuator_get_idx(uint8_t driver_no, uint8_t servo_idx);
115
118extern int32_t actuator_get_min(uint8_t driver_no, uint8_t servo_idx);
119
122extern int32_t actuator_get_max(uint8_t driver_no, uint8_t servo_idx);
123
126extern int32_t actuator_get_neutral(uint8_t driver_no, uint8_t servo_idx);
127
130extern void actuator_set_min(uint8_t driver_no, uint8_t servo_idx, int32_t min);
131
134extern void actuator_set_max(uint8_t driver_no, uint8_t servo_idx, int32_t max);
135
138extern void actuator_set_neutral(uint8_t driver_no, uint8_t servo_idx, int32_t neutral);
139
140#endif /* ACTUATORS_NB */
141
142
143#endif /* ACTUATORS_H */
float travel_up
Precomputed travel up coef.
Definition actuators.h:68
void(* act_set_t)(uint8_t driver_idx, int16_t driver_value)
Actuator set callback.
Definition actuators.h:77
void actuators_periodic(void)
Definition actuators.c:322
int32_t rpm
RPM.
Definition actuators.h:54
bool position
Position is set.
Definition actuators.h:48
struct act_feedback_t::act_feedback_set_t set
Bitset registering what is set as feedback.
int32_t min
Driver min value (or motor stop position).
Definition actuators.h:65
uint8_t power_pct
Power rating in percent.
Definition actuators.h:58
int32_t neutral
Driver neutral value (or motor idle position).
Definition actuators.h:67
uint8_t idx
General index of the actuators (generated in airframe.h).
Definition actuators.h:45
float speed
In meter per second or radian per second.
Definition actuators.h:57
void actuators_init(void)
Definition actuators.c:321
float force
In Newton or Newton metre.
Definition actuators.h:56
int32_t max
Driver max value (or motor max position).
Definition actuators.h:66
uint8_t servo_idx
Driver servo index.
Definition actuators.h:64
float position
In radians.
Definition actuators.h:55
uint8_t driver_no
Driver number.
Definition actuators.h:63
bool power
Power rating is set.
Definition actuators.h:51
float travel_down
Precomputed travel down coef.
Definition actuators.h:69
int16_t pprz_t
Definition paparazzi.h:6
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.