Dmivaka / STM32-HAL-Libcanard

Libcanard 2.0 example for STM32 HAL
3 stars 2 forks source link

How create TX payload? #1

Open disk1244 opened 2 months ago

disk1244 commented 2 months ago

How can create And send TX like this:

Full name: uavcan.equipment.power.BatteryInfo Default data type ID: 1092


#

Single battery info.

#

Typical publishing rate should be around 0.2~1 Hz.

#

Please refer to the Smart Battery data specification for some elaboration.

#

#

Primary parameters.

Some fields can be set to NAN if their values are unknown.

Full charge capacity is expected to slowly reduce as the battery is aging. Normally its estimate is updated after

every charging cycle.

# float16 temperature # [Kelvin] float16 voltage # [Volt] float16 current # [Ampere] float16 average_power_10sec # [Watt] Average power consumption over the last 10 seconds float16 remaining_capacity_wh # [Watt hours] Will be increasing during charging float16 full_charge_capacity_wh # [Watt hours] Predicted battery capacity when it is fully charged. Falls with aging float16 hours_to_full_charge # [Hours] Charging is expected to complete in this time; zero if not charging

#

Status flags.

Notes:

- CHARGING must be always set as long as the battery is connected to a charger, even if the charging is complete.

- CHARGED must be cleared immediately when the charger is disconnected.

# uint11 STATUS_FLAG_IN_USE = 1 # The battery is currently used as a power supply uint11 STATUS_FLAG_CHARGING = 2 # Charger is active uint11 STATUS_FLAG_CHARGED = 4 # Charging complete, but the charger is still active uint11 STATUS_FLAG_TEMP_HOT = 8 # Battery temperature is above normal uint11 STATUS_FLAG_TEMP_COLD = 16 # Battery temperature is below normal uint11 STATUS_FLAG_OVERLOAD = 32 # Safe operating area violation uint11 STATUS_FLAG_BAD_BATTERY = 64 # This battery should not be used anymore (e.g. low SOH) uint11 STATUS_FLAG_NEED_SERVICE = 128 # This battery requires maintenance (e.g. balancing, full recharge) uint11 STATUS_FLAG_BMS_ERROR = 256 # Battery management system/controller error, smart battery interface error uint11 STATUS_FLAG_RESERVED_A = 512 # Keep zero uint11 STATUS_FLAG_RESERVED_B = 1024 # Keep zero uint11 status_flags

#

State of Health (SOH) estimate, in percent.

http://en.wikipedia.org/wiki/State_of_health

# uint7 STATE_OF_HEALTH_UNKNOWN = 127 # Use this constant if SOH cannot be estimated uint7 state_of_health_pct # Health of the battery, in percent, optional

#

Relative State of Charge (SOC) estimate, in percent.

http://en.wikipedia.org/wiki/State_of_charge

# uint7 state_of_charge_pct # Percent of the full charge [0, 100]. This field is required uint7 state_of_charge_pct_stdev # SOC error standard deviation; use best guess if unknown

#

Battery identification.

Model instance ID must be unique within the same battery model name.

Model name is a human-readable string that normally should include the vendor name, model name, and chemistry

type of this battery. This field should be assumed case-insensitive. Example: "Zubax Smart Battery v1.1 LiPo".

# uint8 battery_id # Identifies the battery within this vehicle, e.g. 0 - primary battery uint32 model_instance_id # Set to zero if not applicable uint8[<32] model_name # Battery model name

udit2720001 commented 3 weeks ago

are you able to implement battery info header file to the code