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

Power sensors on the uavcan bus. More...

#include "power_uavcan.h"
#include "uavcan/uavcan.h"
#include "modules/energy/electrical.h"
#include "math/pprz_random.h"
#include "modules/datalink/telemetry.h"
+ Include dependency graph for power_uavcan.c:

Go to the source code of this file.

Data Structures

struct  uavcan_equipment_power_BatteryInfo
 
struct  uavcan_equipment_power_CircuitStatus
 
struct  uavcan_circuit_battery_t
 

Macros

#define UAVCAN_EQUIPMENT_POWER_BATTERYINFO_ID   1092
 
#define UAVCAN_EQUIPMENT_POWER_BATTERYINFO_SIGNATURE   (0x249C26548A711966ULL)
 
#define UAVCAN_EQUIPMENT_POWER_BATTERYINFO_MAX_SIZE   55
 
#define UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_ID   1091
 
#define UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_SIGNATURE   (0x8313D33D0DDDA115ULL)
 
#define UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_MAX_SIZE   7
 
#define POWER_UAVCAN_BATTERIES_MAX   3
 
#define POWER_UAVCAN_CIRCUITS_MAX   15
 
#define POWER_UAVCAN_BATTERY_CIRCUITS   {}
 

Functions

static void power_uavcan_send_power_device (struct transport_tx *trans, struct link_device *dev)
 
static void power_uavcan_battery_cb (struct uavcan_iface_t *iface, CanardRxTransfer *transfer)
 
static void power_uavcan_circuit_cb (struct uavcan_iface_t *iface, CanardRxTransfer *transfer)
 
void power_uavcan_init (void)
 

Variables

static uavcan_event power_uavcan_ev
 
static uavcan_event circuit_uavcan_ev
 
static struct uavcan_equipment_power_BatteryInfo batteries [POWER_UAVCAN_BATTERIES_MAX] = {0}
 
static struct uavcan_equipment_power_CircuitStatus circuits [POWER_UAVCAN_CIRCUITS_MAX] = {0}
 
static struct uavcan_circuit_battery_t battery_circuits [] = POWER_UAVCAN_BATTERY_CIRCUITS
 

Detailed Description

Power sensors on the uavcan bus.

Definition in file power_uavcan.c.


Data Structure Documentation

◆ uavcan_equipment_power_BatteryInfo

struct uavcan_equipment_power_BatteryInfo

Definition at line 61 of file power_uavcan.c.

Data Fields
float average_power_10sec
uint8_t battery_id
float current
float full_charge_capacity_wh
float hours_to_full_charge
uint32_t model_instance_id
uint8_t node_id
float remaining_capacity_wh
bool set
uint8_t state_of_charge_pct
uint8_t state_of_charge_pct_stdev
uint8_t state_of_health_pct
uint16_t status_flags
float temperature
float voltage

◆ uavcan_equipment_power_CircuitStatus

struct uavcan_equipment_power_CircuitStatus

Definition at line 83 of file power_uavcan.c.

Data Fields
uint16_t circuit_id
float current
uint8_t error_flags
bool is_battery
uint8_t node_id
bool set
float voltage

◆ uavcan_circuit_battery_t

struct uavcan_circuit_battery_t

Definition at line 96 of file power_uavcan.c.

Data Fields
uint16_t circuit_id
uint8_t node_id

Macro Definition Documentation

◆ POWER_UAVCAN_BATTERIES_MAX

#define POWER_UAVCAN_BATTERIES_MAX   3

Definition at line 43 of file power_uavcan.c.

◆ POWER_UAVCAN_BATTERY_CIRCUITS

#define POWER_UAVCAN_BATTERY_CIRCUITS   {}

Definition at line 53 of file power_uavcan.c.

◆ POWER_UAVCAN_CIRCUITS_MAX

#define POWER_UAVCAN_CIRCUITS_MAX   15

Definition at line 48 of file power_uavcan.c.

◆ UAVCAN_EQUIPMENT_POWER_BATTERYINFO_ID

#define UAVCAN_EQUIPMENT_POWER_BATTERYINFO_ID   1092

Definition at line 32 of file power_uavcan.c.

◆ UAVCAN_EQUIPMENT_POWER_BATTERYINFO_MAX_SIZE

#define UAVCAN_EQUIPMENT_POWER_BATTERYINFO_MAX_SIZE   55

Definition at line 34 of file power_uavcan.c.

◆ UAVCAN_EQUIPMENT_POWER_BATTERYINFO_SIGNATURE

#define UAVCAN_EQUIPMENT_POWER_BATTERYINFO_SIGNATURE   (0x249C26548A711966ULL)

Definition at line 33 of file power_uavcan.c.

◆ UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_ID

#define UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_ID   1091

Definition at line 37 of file power_uavcan.c.

◆ UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_MAX_SIZE

#define UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_MAX_SIZE   7

Definition at line 39 of file power_uavcan.c.

◆ UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_SIGNATURE

#define UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_SIGNATURE   (0x8313D33D0DDDA115ULL)

Definition at line 38 of file power_uavcan.c.

Function Documentation

◆ power_uavcan_battery_cb()

◆ power_uavcan_circuit_cb()

◆ power_uavcan_init()

◆ power_uavcan_send_power_device()

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

Definition at line 105 of file power_uavcan.c.

References uavcan_equipment_power_CircuitStatus::circuit_id, circuits, dev, idx, uavcan_circuit_battery_t::node_id, POWER_UAVCAN_CIRCUITS_MAX, and rand_uniform().

Referenced by power_uavcan_init().

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

Variable Documentation

◆ batteries

Definition at line 58 of file power_uavcan.c.

Referenced by power_uavcan_battery_cb().

◆ battery_circuits

struct uavcan_circuit_battery_t battery_circuits[] = POWER_UAVCAN_BATTERY_CIRCUITS
static

Definition at line 58 of file power_uavcan.c.

Referenced by power_uavcan_init().

◆ circuit_uavcan_ev

uavcan_event circuit_uavcan_ev
static

Definition at line 58 of file power_uavcan.c.

Referenced by power_uavcan_init().

◆ circuits

◆ power_uavcan_ev

uavcan_event power_uavcan_ev
static

Definition at line 57 of file power_uavcan.c.

Referenced by power_uavcan_init().