Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
UAVCan actuators using RAWCOMMAND message and ESC_STATUS telemetry. More...
#include "actuators_uavcan.h"
#include "modules/energy/electrical.h"
#include "math/pprz_random.h"
#include "modules/core/abi.h"
#include "modules/actuators/actuators.h"
#include "modules/datalink/telemetry.h"
Go to the source code of this file.
Data Structures | |
struct | actuators_uavcan_telem_t |
Functions | |
static struct actuators_uavcan_telem_t * | actuators_uavcan_next_telem (void) |
static void | actuators_uavcan_send_esc (struct transport_tx *trans, struct link_device *dev) |
static void | actuators_uavcan_esc_status_cb (struct uavcan_iface_t *iface, CanardRxTransfer *transfer) |
Whevener an ESC_STATUS message from the EQUIPMENT group is received. More... | |
static void | actuators_uavcan_actuator_status_cb (struct uavcan_iface_t *iface, CanardRxTransfer *transfer) |
Whevener an ACTUATOR_STATUS message from the EQUIPMENT group is received. More... | |
static void | actuators_uavcan_device_temperature_cb (struct uavcan_iface_t *iface, CanardRxTransfer *transfer) |
Whevener an DEVICE_TEMPERATURE message from the EQUIPMENT group is received. More... | |
void | actuators_uavcan_init (struct uavcan_iface_t *iface) |
Initialize an uavcan interface. More... | |
void | actuators_uavcan_commit (struct uavcan_iface_t *iface, int16_t *values, uint8_t nb) |
Commit actuator values to the uavcan interface (EQUIPMENT_ESC_RAWCOMMAND) More... | |
void | actuators_uavcan_cmd_commit (struct uavcan_iface_t *iface, int16_t *values, uint8_t nb) |
Commit actuator values to the uavcan interface (EQUIPMENT_ACTUATOR_ARRAYCOMMAND) More... | |
Variables | |
static bool | actuators_uavcan_initialized = false |
static uavcan_event | esc_status_ev |
static uavcan_event | actuator_status_ev |
static uavcan_event | device_temperature_ev |
static uint8_t | old_idx = 0 |
static uint8_t | esc_idx = 0 |
UAVCan actuators using RAWCOMMAND message and ESC_STATUS telemetry.
Definition in file actuators_uavcan.c.
struct actuators_uavcan_telem_t |
Definition at line 39 of file actuators_uavcan.c.
Data Fields | ||
---|---|---|
float | current | |
uint32_t | energy | |
uint8_t | node_id | |
float | position | |
int32_t | rpm | |
bool | set | |
float | temperature | |
float | temperature_dev | |
float | timestamp | |
float | voltage |
#define UAVCAN_ACTUATORS_USE_CURRENT TRUE |
Definition at line 35 of file actuators_uavcan.c.
#define UAVCAN_CMD_UNUSED (MIN_PPRZ-1) |
Definition at line 84 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_ID 1010 |
Definition at line 102 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_MAX_SIZE ((484 + 7)/8) |
Definition at line 104 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_SIGNATURE (0xD8A7486238EC3AF3ULL) |
Definition at line 103 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ACTUATOR_STATUS_ID 1011 |
Definition at line 97 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ACTUATOR_STATUS_MAX_SIZE ((64 + 7)/8) |
Definition at line 99 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ACTUATOR_STATUS_SIGNATURE (0x5E9BBA44FAF1EA04ULL) |
Definition at line 98 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_ID 1110 |
Definition at line 107 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_MAX_SIZE ((40 + 7)/8) |
Definition at line 109 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_SIGNATURE (0x70261C28A94144C6ULL) |
Definition at line 108 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_ID 1030 |
Definition at line 92 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_MAX_SIZE ((285 + 7)/8) |
Definition at line 94 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_SIGNATURE (0x217F5C87D7EC951DULL) |
Definition at line 93 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ESC_STATUS_ID 1034 |
Definition at line 87 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ESC_STATUS_MAX_SIZE ((110 + 7)/8) |
Definition at line 89 of file actuators_uavcan.c.
#define UAVCAN_EQUIPMENT_ESC_STATUS_SIGNATURE (0xA9AF28AEA2FBB254ULL) |
Definition at line 88 of file actuators_uavcan.c.
|
static |
Whevener an ACTUATOR_STATUS message from the EQUIPMENT group is received.
Definition at line 286 of file actuators_uavcan.c.
References ACT_FEEDBACK_UAVCAN_ID, actuators_uavcan1cmd_values, actuators_uavcan2cmd_values, act_feedback_t::idx, act_feedback_t::act_feedback_set_t::position, act_feedback_t::position, actuators_uavcan_telem_t::position, act_feedback_t::set, transfer(), and UAVCAN_CMD_UNUSED.
Referenced by actuators_uavcan_init().
void actuators_uavcan_cmd_commit | ( | struct uavcan_iface_t * | iface, |
int16_t * | values, | ||
uint8_t | nb | ||
) |
Commit actuator values to the uavcan interface (EQUIPMENT_ACTUATOR_ARRAYCOMMAND)
Definition at line 455 of file actuators_uavcan.c.
References MAX_PPRZ, MIN_PPRZ, offset, uavcan_broadcast(), UAVCAN_CMD_UNUSED, UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_ID, UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_MAX_SIZE, and UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_SIGNATURE.
void actuators_uavcan_commit | ( | struct uavcan_iface_t * | iface, |
int16_t * | values, | ||
uint8_t | nb | ||
) |
Commit actuator values to the uavcan interface (EQUIPMENT_ESC_RAWCOMMAND)
Definition at line 436 of file actuators_uavcan.c.
References offset, uavcan_broadcast(), UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_ID, UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_MAX_SIZE, and UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_SIGNATURE.
|
static |
Whevener an DEVICE_TEMPERATURE message from the EQUIPMENT group is received.
Definition at line 360 of file actuators_uavcan.c.
References actuators_uavcan_telem_t::set, actuators_uavcan_telem_t::temperature_dev, and transfer().
Referenced by actuators_uavcan_init().
|
static |
Whevener an ESC_STATUS message from the EQUIPMENT group is received.
Definition at line 185 of file actuators_uavcan.c.
References ACT_FEEDBACK_UAVCAN_ID, actuators_uavcan1cmd_values, actuators_uavcan2cmd_values, actuators_uavcan_telem_t::current, Electrical::current, electrical, actuators_uavcan_telem_t::energy, esc_idx, get_sys_time_float(), act_feedback_t::idx, actuators_uavcan_telem_t::node_id, act_feedback_t::act_feedback_set_t::rpm, act_feedback_t::rpm, actuators_uavcan_telem_t::rpm, rpm, act_feedback_t::set, actuators_uavcan_telem_t::set, actuators_uavcan_telem_t::temperature, actuators_uavcan_telem_t::timestamp, transfer(), UAVCAN_CMD_UNUSED, and actuators_uavcan_telem_t::voltage.
Referenced by actuators_uavcan_init().
void actuators_uavcan_init | ( | struct uavcan_iface_t * | iface | ) |
Initialize an uavcan interface.
Definition at line 396 of file actuators_uavcan.c.
References actuator_status_ev, actuators_uavcan1cmd_values, actuators_uavcan2cmd_values, actuators_uavcan_actuator_status_cb(), actuators_uavcan_device_temperature_cb(), actuators_uavcan_esc_status_cb(), actuators_uavcan_initialized, actuators_uavcan_send_esc(), DefaultPeriodic, device_temperature_ev, esc_status_ev, init_random(), register_periodic_telemetry(), uavcan_bind(), UAVCAN_CMD_UNUSED, UAVCAN_EQUIPMENT_ACTUATOR_STATUS_ID, UAVCAN_EQUIPMENT_ACTUATOR_STATUS_SIGNATURE, UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_ID, UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_SIGNATURE, UAVCAN_EQUIPMENT_ESC_STATUS_ID, and UAVCAN_EQUIPMENT_ESC_STATUS_SIGNATURE.
|
static |
Definition at line 122 of file actuators_uavcan.c.
References esc_idx, offset, old_idx, rand_uniform(), and actuators_uavcan_telem_t::set.
Referenced by actuators_uavcan_send_esc().
|
static |
Definition at line 161 of file actuators_uavcan.c.
References actuators_uavcan_next_telem(), actuators_uavcan_telem_t::current, dev, electrical, actuators_uavcan_telem_t::energy, actuators_uavcan_telem_t::node_id, old_idx, actuators_uavcan_telem_t::rpm, rpm, actuators_uavcan_telem_t::temperature, actuators_uavcan_telem_t::temperature_dev, actuators_uavcan_telem_t::voltage, and Electrical::vsupply.
Referenced by actuators_uavcan_init().
|
static |
Definition at line 114 of file actuators_uavcan.c.
Referenced by actuators_uavcan_init().
|
static |
Definition at line 112 of file actuators_uavcan.c.
Referenced by actuators_uavcan_init().
|
static |
Definition at line 115 of file actuators_uavcan.c.
Referenced by actuators_uavcan_init().
|
static |
Definition at line 121 of file actuators_uavcan.c.
Referenced by actuators_uavcan_esc_status_cb(), and actuators_uavcan_next_telem().
|
static |
Definition at line 113 of file actuators_uavcan.c.
Referenced by actuators_uavcan_init().
|
static |
Definition at line 120 of file actuators_uavcan.c.
Referenced by actuators_uavcan_next_telem(), and actuators_uavcan_send_esc().