Initial commit
This commit is contained in:
139
srcs/RobotNet10/Shared/RobotNet10.Shared/Sensor/BatteryState.cs
Normal file
139
srcs/RobotNet10/Shared/RobotNet10.Shared/Sensor/BatteryState.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
namespace RobotNet10.Shared.Sensor;
|
||||
|
||||
/// <summary>
|
||||
/// BatteryState message (sensor_msgs/BatteryState)
|
||||
/// Describes the state of a battery
|
||||
/// </summary>
|
||||
public struct BatteryState
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Voltage in Volts (Mandatory)
|
||||
/// </summary>
|
||||
public double Voltage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current in Amperes (If not available: NaN)
|
||||
/// </summary>
|
||||
public double Current { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Charge in Ah (If not available: NaN)
|
||||
/// </summary>
|
||||
public double Charge { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Capacity in Ah (last full capacity) (If not available: NaN)
|
||||
/// </summary>
|
||||
public double Capacity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Design capacity in Ah (If not available: NaN)
|
||||
/// </summary>
|
||||
public double DesignCapacity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Percentage (0-100) (If not available: NaN)
|
||||
/// </summary>
|
||||
public double Percentage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Power supply status constants
|
||||
/// </summary>
|
||||
public const byte PowerSupplyStatusUnknown = 0;
|
||||
public const byte PowerSupplyStatusCharging = 1;
|
||||
public const byte PowerSupplyStatusDischarging = 2;
|
||||
public const byte PowerSupplyStatusNotCharging = 3;
|
||||
public const byte PowerSupplyStatusFull = 4;
|
||||
|
||||
/// <summary>
|
||||
/// Power supply status (PowerSupplyStatus constants)
|
||||
/// </summary>
|
||||
public byte PowerSupplyStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Power supply health constants
|
||||
/// </summary>
|
||||
public const byte PowerSupplyHealthUnknown = 0;
|
||||
public const byte PowerSupplyHealthGood = 1;
|
||||
public const byte PowerSupplyHealthOverheat = 2;
|
||||
public const byte PowerSupplyHealthDead = 3;
|
||||
public const byte PowerSupplyHealthOvervoltage = 4;
|
||||
public const byte PowerSupplyHealthUnspecifiedFailure = 5;
|
||||
public const byte PowerSupplyHealthCold = 6;
|
||||
|
||||
/// <summary>
|
||||
/// Power supply health (PowerSupplyHealth constants)
|
||||
/// </summary>
|
||||
public byte PowerSupplyHealth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Power supply technology (chemistry) constants
|
||||
/// </summary>
|
||||
public const byte PowerSupplyTechnologyUnknown = 0;
|
||||
public const byte PowerSupplyTechnologyNiMh = 1;
|
||||
public const byte PowerSupplyTechnologyLion = 2;
|
||||
public const byte PowerSupplyTechnologyLipo = 3;
|
||||
public const byte PowerSupplyTechnologyLife = 4;
|
||||
public const byte PowerSupplyTechnologyNiCd = 5;
|
||||
public const byte PowerSupplyTechnologyLiMn = 6;
|
||||
|
||||
/// <summary>
|
||||
/// Power supply technology (PowerSupplyTechnology constants)
|
||||
/// </summary>
|
||||
public byte PowerSupplyTechnology { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if the battery is present
|
||||
/// </summary>
|
||||
public bool Present { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An array of individual cell voltages. Each individual cell voltage should be > 0.0.
|
||||
/// If not available: empty array
|
||||
/// </summary>
|
||||
public double[] CellVoltage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An array of individual cell temperatures. Each individual cell temperature should be > 0.0.
|
||||
/// If not available: empty array
|
||||
/// </summary>
|
||||
public double[] CellTemperature { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The location into which the battery is inserted. (slot number or plug)
|
||||
/// </summary>
|
||||
public string Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The serial number of the battery pack.
|
||||
/// </summary>
|
||||
public string SerialNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public BatteryState()
|
||||
{
|
||||
Header = new Header();
|
||||
Voltage = 0.0;
|
||||
Current = double.NaN;
|
||||
Charge = double.NaN;
|
||||
Capacity = double.NaN;
|
||||
DesignCapacity = double.NaN;
|
||||
Percentage = double.NaN;
|
||||
PowerSupplyStatus = PowerSupplyStatusUnknown;
|
||||
PowerSupplyHealth = PowerSupplyHealthUnknown;
|
||||
PowerSupplyTechnology = PowerSupplyTechnologyUnknown;
|
||||
Present = false;
|
||||
CellVoltage = [];
|
||||
CellTemperature = [];
|
||||
Location = string.Empty;
|
||||
SerialNumber = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user