64 lines
2.5 KiB
C++
64 lines
2.5 KiB
C++
#pragma once
|
|
#include "std_msgs/Header.h"
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <limits>
|
|
|
|
namespace sensor_msgs
|
|
{
|
|
|
|
struct BatteryState
|
|
{
|
|
// ===== Power supply status constants =====
|
|
static constexpr uint8_t POWER_SUPPLY_STATUS_UNKNOWN = 0;
|
|
static constexpr uint8_t POWER_SUPPLY_STATUS_CHARGING = 1;
|
|
static constexpr uint8_t POWER_SUPPLY_STATUS_DISCHARGING = 2;
|
|
static constexpr uint8_t POWER_SUPPLY_STATUS_NOT_CHARGING = 3;
|
|
static constexpr uint8_t POWER_SUPPLY_STATUS_FULL = 4;
|
|
|
|
// ===== Power supply health constants =====
|
|
static constexpr uint8_t POWER_SUPPLY_HEALTH_UNKNOWN = 0;
|
|
static constexpr uint8_t POWER_SUPPLY_HEALTH_GOOD = 1;
|
|
static constexpr uint8_t POWER_SUPPLY_HEALTH_OVERHEAT = 2;
|
|
static constexpr uint8_t POWER_SUPPLY_HEALTH_DEAD = 3;
|
|
static constexpr uint8_t POWER_SUPPLY_HEALTH_OVERVOLTAGE = 4;
|
|
static constexpr uint8_t POWER_SUPPLY_HEALTH_UNSPEC_FAILURE = 5;
|
|
static constexpr uint8_t POWER_SUPPLY_HEALTH_COLD = 6;
|
|
static constexpr uint8_t POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE = 7;
|
|
static constexpr uint8_t POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE = 8;
|
|
|
|
// ===== Power supply technology (chemistry) constants =====
|
|
static constexpr uint8_t POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0;
|
|
static constexpr uint8_t POWER_SUPPLY_TECHNOLOGY_NIMH = 1;
|
|
static constexpr uint8_t POWER_SUPPLY_TECHNOLOGY_LION = 2;
|
|
static constexpr uint8_t POWER_SUPPLY_TECHNOLOGY_LIPO = 3;
|
|
static constexpr uint8_t POWER_SUPPLY_TECHNOLOGY_LIFE = 4;
|
|
static constexpr uint8_t POWER_SUPPLY_TECHNOLOGY_NICD = 5;
|
|
static constexpr uint8_t POWER_SUPPLY_TECHNOLOGY_LIMN = 6;
|
|
|
|
// ===== Data fields =====
|
|
std_msgs::Header header;
|
|
|
|
float voltage = std::numeric_limits<float>::quiet_NaN(); // [V]
|
|
float temperature = std::numeric_limits<float>::quiet_NaN(); // [°C]
|
|
float current = std::numeric_limits<float>::quiet_NaN(); // [A]
|
|
float charge = std::numeric_limits<float>::quiet_NaN(); // [Ah]
|
|
float capacity = std::numeric_limits<float>::quiet_NaN(); // [Ah]
|
|
float design_capacity = std::numeric_limits<float>::quiet_NaN(); // [Ah]
|
|
float percentage = std::numeric_limits<float>::quiet_NaN(); // 0..1
|
|
|
|
uint8_t power_supply_status = POWER_SUPPLY_STATUS_UNKNOWN;
|
|
uint8_t power_supply_health = POWER_SUPPLY_HEALTH_UNKNOWN;
|
|
uint8_t power_supply_technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
|
|
bool present = false;
|
|
|
|
std::vector<float> cell_voltage;
|
|
std::vector<float> cell_temperature;
|
|
|
|
std::string location;
|
|
std::string serial_number;
|
|
};
|
|
|
|
} // namespace sensor_msgs
|