Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
actuators_faulhaber.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Freek van Tienen <freek.v.tienen@gmail.com>
3  *
4  * This file is part of paparazzi
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
27 #ifndef ACTUATORS_FAULHABER_H
28 #define ACTUATORS_FAULHABER_H
29 
30 #include "std.h"
31 
38 };
39 
40 struct faulhaber_t {
41  enum faulhaber_modes_t mode;
43 
44  float p_gain;
46 
50 
54 };
55 extern struct faulhaber_t faulhaber;
56 
57 extern void actuators_faulhaber_init(void);
58 extern void actuators_faulhaber_periodic(void);
59 extern void actuators_faulhaber_event(void);
61 
62 
63 #define ACTUATORS_FAULHABER_COMMAND_SCALE 1000.0f
64 
65 #if USE_NPS
66 #define ActuatorsFaulhaberInit() {}
67 #define ActuatorFaulhaberSet(_i, _v) {}
68 #define ActuatorsFaulhaberCommit() {}
69 #else
70 #define ActuatorsFaulhaberInit() actuators_faulhaber_init()
71 #define ActuatorFaulhaberSet(_i, _v) { faulhaber.setpoint_position = ((get_servo_max_FAULHABER(0)-_v) + get_servo_min_FAULHABER(0))*ACTUATORS_FAULHABER_COMMAND_SCALE; }
72 #define ActuatorsFaulhaberCommit() {}
73 #endif
74 
75 #endif /* ACTUATORS_FAULHABER_H */
float p_gain
The proportional gain of the velocity controller.
int32_t max_velocity
The maximum velocity of the controller.
int32_t real_position
The real position from the feedback of the controller.
void actuators_faulhaber_event(void)
bool target_reached
When the target position is reached.
struct faulhaber_t faulhaber
enum faulhaber_modes_t mode
Current mode of the controller.
bool homing_completed
Once the homing is completed.
int32_t setpoint_position
The setpoint position controlled from the actuator.
int32_t target_velocity
The target velocity send to the controller.
uint8_t state
The state of the mode.
bool position_ready
Ready for receiving (new) positions.
faulhaber_modes_t
@ FH_MODE_ERROR
@ FH_MODE_VELOCITY
@ FH_MODE_RESET_ERR
@ FH_MODE_REQ_ERR
@ FH_MODE_INIT
void actuators_faulhaber_periodic(void)
void actuators_faulhaber_init(void)
void actuators_faulhaber_SetMode(uint8_t mode)
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:69
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98