Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
actuators_uavcan.c File Reference

UAVCan actuators using RAWCOMMAND message and ESC_STATUS telemetry. More...

+ Include dependency graph for actuators_uavcan.c:

Go to the source code of this file.

Data Structures

struct  actuators_uavcan_telem_t
 

Macros

#define UAVCAN_ACTUATORS_USE_CURRENT   TRUE
 
#define UAVCAN_CMD_UNUSED   (MIN_PPRZ-1)
 
#define UAVCAN_EQUIPMENT_ESC_STATUS_ID   1034
 
#define UAVCAN_EQUIPMENT_ESC_STATUS_SIGNATURE   (0xA9AF28AEA2FBB254ULL)
 
#define UAVCAN_EQUIPMENT_ESC_STATUS_MAX_SIZE   ((110 + 7)/8)
 
#define UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_ID   1030
 
#define UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_SIGNATURE   (0x217F5C87D7EC951DULL)
 
#define UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_MAX_SIZE   ((285 + 7)/8)
 
#define UAVCAN_EQUIPMENT_ACTUATOR_STATUS_ID   1011
 
#define UAVCAN_EQUIPMENT_ACTUATOR_STATUS_SIGNATURE   (0x5E9BBA44FAF1EA04ULL)
 
#define UAVCAN_EQUIPMENT_ACTUATOR_STATUS_MAX_SIZE   ((64 + 7)/8)
 
#define UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_ID   1010
 
#define UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_SIGNATURE   (0xD8A7486238EC3AF3ULL)
 
#define UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_MAX_SIZE   ((484 + 7)/8)
 
#define UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_ID   1110
 
#define UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_SIGNATURE   (0x70261C28A94144C6ULL)
 
#define UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_MAX_SIZE   ((40 + 7)/8)
 

Functions

static struct actuators_uavcan_telem_tactuators_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
 

Detailed Description

UAVCan actuators using RAWCOMMAND message and ESC_STATUS telemetry.

Definition in file actuators_uavcan.c.


Data Structure Documentation

◆ actuators_uavcan_telem_t

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

Macro Definition Documentation

◆ UAVCAN_ACTUATORS_USE_CURRENT

#define UAVCAN_ACTUATORS_USE_CURRENT   TRUE

Definition at line 35 of file actuators_uavcan.c.

◆ UAVCAN_CMD_UNUSED

#define UAVCAN_CMD_UNUSED   (MIN_PPRZ-1)

Definition at line 84 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_ID

#define UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_ID   1010

Definition at line 102 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_MAX_SIZE

#define UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_MAX_SIZE   ((484 + 7)/8)

Definition at line 104 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_SIGNATURE

#define UAVCAN_EQUIPMENT_ACTUATOR_ARRAYCOMMAND_SIGNATURE   (0xD8A7486238EC3AF3ULL)

Definition at line 103 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ACTUATOR_STATUS_ID

#define UAVCAN_EQUIPMENT_ACTUATOR_STATUS_ID   1011

Definition at line 97 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ACTUATOR_STATUS_MAX_SIZE

#define UAVCAN_EQUIPMENT_ACTUATOR_STATUS_MAX_SIZE   ((64 + 7)/8)

Definition at line 99 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ACTUATOR_STATUS_SIGNATURE

#define UAVCAN_EQUIPMENT_ACTUATOR_STATUS_SIGNATURE   (0x5E9BBA44FAF1EA04ULL)

Definition at line 98 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_ID

#define UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_ID   1110

Definition at line 107 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_MAX_SIZE

#define UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_MAX_SIZE   ((40 + 7)/8)

Definition at line 109 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_SIGNATURE

#define UAVCAN_EQUIPMENT_DEVICE_TEMPERATURE_SIGNATURE   (0x70261C28A94144C6ULL)

Definition at line 108 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_ID

#define UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_ID   1030

Definition at line 92 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_MAX_SIZE

#define UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_MAX_SIZE   ((285 + 7)/8)

Definition at line 94 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_SIGNATURE

#define UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_SIGNATURE   (0x217F5C87D7EC951DULL)

Definition at line 93 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ESC_STATUS_ID

#define UAVCAN_EQUIPMENT_ESC_STATUS_ID   1034

Definition at line 87 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ESC_STATUS_MAX_SIZE

#define UAVCAN_EQUIPMENT_ESC_STATUS_MAX_SIZE   ((110 + 7)/8)

Definition at line 89 of file actuators_uavcan.c.

◆ UAVCAN_EQUIPMENT_ESC_STATUS_SIGNATURE

#define UAVCAN_EQUIPMENT_ESC_STATUS_SIGNATURE   (0xA9AF28AEA2FBB254ULL)

Definition at line 88 of file actuators_uavcan.c.

Function Documentation

◆ actuators_uavcan_actuator_status_cb()

static void actuators_uavcan_actuator_status_cb ( struct uavcan_iface_t iface,
CanardRxTransfer *  transfer 
)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ actuators_uavcan_cmd_commit()

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.

+ Here is the call graph for this function:

◆ actuators_uavcan_commit()

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.

+ Here is the call graph for this function:

◆ actuators_uavcan_device_temperature_cb()

static void actuators_uavcan_device_temperature_cb ( struct uavcan_iface_t iface,
CanardRxTransfer *  transfer 
)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ actuators_uavcan_esc_status_cb()

◆ actuators_uavcan_init()

◆ actuators_uavcan_next_telem()

static struct actuators_uavcan_telem_t* actuators_uavcan_next_telem ( void  )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ actuators_uavcan_send_esc()

static void actuators_uavcan_send_esc ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Variable Documentation

◆ actuator_status_ev

uavcan_event actuator_status_ev
static

Definition at line 114 of file actuators_uavcan.c.

Referenced by actuators_uavcan_init().

◆ actuators_uavcan_initialized

bool actuators_uavcan_initialized = false
static

Definition at line 112 of file actuators_uavcan.c.

Referenced by actuators_uavcan_init().

◆ device_temperature_ev

uavcan_event device_temperature_ev
static

Definition at line 115 of file actuators_uavcan.c.

Referenced by actuators_uavcan_init().

◆ esc_idx

uint8_t esc_idx = 0
static

◆ esc_status_ev

uavcan_event esc_status_ev
static

Definition at line 113 of file actuators_uavcan.c.

Referenced by actuators_uavcan_init().

◆ old_idx

uint8_t old_idx = 0
static

Definition at line 120 of file actuators_uavcan.c.

Referenced by actuators_uavcan_next_telem(), and actuators_uavcan_send_esc().