Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
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"
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 |
Power sensors on the uavcan bus.
Definition in file power_uavcan.c.
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 |
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 |
struct uavcan_circuit_battery_t |
Definition at line 96 of file power_uavcan.c.
Data Fields | ||
---|---|---|
uint16_t | circuit_id | |
uint8_t | node_id |
#define POWER_UAVCAN_BATTERIES_MAX 3 |
Definition at line 43 of file power_uavcan.c.
#define POWER_UAVCAN_BATTERY_CIRCUITS {} |
Definition at line 53 of file power_uavcan.c.
#define POWER_UAVCAN_CIRCUITS_MAX 15 |
Definition at line 48 of file power_uavcan.c.
#define UAVCAN_EQUIPMENT_POWER_BATTERYINFO_ID 1092 |
Definition at line 32 of file power_uavcan.c.
#define UAVCAN_EQUIPMENT_POWER_BATTERYINFO_MAX_SIZE 55 |
Definition at line 34 of file power_uavcan.c.
#define UAVCAN_EQUIPMENT_POWER_BATTERYINFO_SIGNATURE (0x249C26548A711966ULL) |
Definition at line 33 of file power_uavcan.c.
#define UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_ID 1091 |
Definition at line 37 of file power_uavcan.c.
#define UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_MAX_SIZE 7 |
Definition at line 39 of file power_uavcan.c.
#define UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_SIGNATURE (0x8313D33D0DDDA115ULL) |
Definition at line 38 of file power_uavcan.c.
|
static |
Definition at line 125 of file power_uavcan.c.
References uavcan_equipment_power_BatteryInfo::average_power_10sec, batteries, uavcan_equipment_power_BatteryInfo::battery_id, Electrical::current, uavcan_equipment_power_BatteryInfo::current, electrical, uavcan_equipment_power_BatteryInfo::full_charge_capacity_wh, uavcan_equipment_power_BatteryInfo::hours_to_full_charge, uavcan_equipment_power_BatteryInfo::model_instance_id, uavcan_equipment_power_BatteryInfo::node_id, uavcan_circuit_battery_t::node_id, POWER_UAVCAN_BATTERIES_MAX, uavcan_equipment_power_BatteryInfo::remaining_capacity_wh, uavcan_equipment_power_BatteryInfo::set, uavcan_equipment_power_BatteryInfo::state_of_charge_pct, uavcan_equipment_power_BatteryInfo::state_of_charge_pct_stdev, uavcan_equipment_power_BatteryInfo::state_of_health_pct, uavcan_equipment_power_BatteryInfo::status_flags, uavcan_equipment_power_BatteryInfo::temperature, transfer(), uavcan_equipment_power_BatteryInfo::voltage, and Electrical::vsupply.
Referenced by power_uavcan_init().
|
static |
Definition at line 206 of file power_uavcan.c.
References uavcan_equipment_power_CircuitStatus::circuit_id, uavcan_circuit_battery_t::circuit_id, circuits, Electrical::current, uavcan_equipment_power_CircuitStatus::current, electrical, uavcan_equipment_power_CircuitStatus::error_flags, uavcan_equipment_power_CircuitStatus::node_id, uavcan_circuit_battery_t::node_id, POWER_UAVCAN_CIRCUITS_MAX, uavcan_equipment_power_CircuitStatus::set, transfer(), uavcan_equipment_power_CircuitStatus::voltage, and Electrical::vsupply.
Referenced by power_uavcan_init().
void power_uavcan_init | ( | void | ) |
Definition at line 259 of file power_uavcan.c.
References battery_circuits, uavcan_equipment_power_CircuitStatus::circuit_id, uavcan_circuit_battery_t::circuit_id, circuit_uavcan_ev, circuits, DefaultPeriodic, init_random(), uavcan_equipment_power_CircuitStatus::is_battery, uavcan_equipment_power_CircuitStatus::node_id, uavcan_circuit_battery_t::node_id, power_uavcan_battery_cb(), power_uavcan_circuit_cb(), power_uavcan_ev, power_uavcan_send_power_device(), register_periodic_telemetry(), uavcan_equipment_power_CircuitStatus::set, uavcan_bind(), UAVCAN_EQUIPMENT_POWER_BATTERYINFO_ID, UAVCAN_EQUIPMENT_POWER_BATTERYINFO_SIGNATURE, UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_ID, and UAVCAN_EQUIPMENT_POWER_CIRCUITSTATUS_SIGNATURE.
|
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().
|
static |
Definition at line 58 of file power_uavcan.c.
Referenced by power_uavcan_battery_cb().
|
static |
Definition at line 58 of file power_uavcan.c.
Referenced by power_uavcan_init().
|
static |
Definition at line 58 of file power_uavcan.c.
Referenced by power_uavcan_init().
|
static |
Definition at line 58 of file power_uavcan.c.
Referenced by power_uavcan_circuit_cb(), power_uavcan_init(), and power_uavcan_send_power_device().
|
static |
Definition at line 57 of file power_uavcan.c.
Referenced by power_uavcan_init().