Skip to content

CoreRC/rcgenmsg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rcgenmsg

Build Status

The message definition transpiler for ROS.

Usage

cargo run --  --namespace ros::std_msgs test_messages/BatteryInfo.msg

Caveats

  • The generator will generate a message ID deterministically.
  • Inline comments are preserved, however, due to the inherent arbitrary nature of ROS message definitions, it is not possible to reliably determine the association of out-of-line comments to values.

Example

Input

# Constants are chosen to match the enums in the linux kernel
# defined in include/linux/power_supply.h as of version 3.7
# The one difference is for style reasons the constants are
# all uppercase not mixed case.

# Power supply status constants
uint8 POWER_SUPPLY_STATUS_UNKNOWN = 0
uint8 POWER_SUPPLY_STATUS_CHARGING = 1
uint8 POWER_SUPPLY_STATUS_DISCHARGING = 2
uint8 POWER_SUPPLY_STATUS_NOT_CHARGING = 3
uint8 POWER_SUPPLY_STATUS_FULL = 4

# Power supply health constants
uint8 POWER_SUPPLY_HEALTH_UNKNOWN = 0
uint8 POWER_SUPPLY_HEALTH_GOOD = 1
uint8 POWER_SUPPLY_HEALTH_OVERHEAT = 2 # test
uint8 POWER_SUPPLY_HEALTH_DEAD = 3
uint8 POWER_SUPPLY_HEALTH_OVERVOLTAGE = 4
uint8 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE = 5
uint8 POWER_SUPPLY_HEALTH_COLD = 6
uint8 POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE = 7
uint8 POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE = 8

# Power supply technology (chemistry) constants
uint8 POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0
uint8 POWER_SUPPLY_TECHNOLOGY_NIMH = 1
uint8 POWER_SUPPLY_TECHNOLOGY_LION = 2
uint8 POWER_SUPPLY_TECHNOLOGY_LIPO = 3
uint8 POWER_SUPPLY_TECHNOLOGY_LIFE = 4
uint8 POWER_SUPPLY_TECHNOLOGY_NICD = 5
uint8 POWER_SUPPLY_TECHNOLOGY_LIMN = 6

Header  header
float32 voltage          # Voltage in Volts (Mandatory)
float32 current          # Negative when discharging (A)  (If unmeasured NaN)
float32 charge           # Current charge in Ah  (If unmeasured NaN)
float32 capacity         # Capacity in Ah (last full capacity)  (If unmeasured NaN)
float32 design_capacity  # Capacity in Ah (design capacity)  (If unmeasured NaN)
float32 percentage       # Charge percentage on 0 to 1 range  (If unmeasured NaN)
uint8   power_supply_status     # The charging status as reported. Values defined above
uint8   power_supply_health     # The battery health metric. Values defined above
uint8   power_supply_technology # The battery chemistry. Values defined above
bool    present          # True if the battery is present

float32[] cell_voltage   # An array of individual cell voltages for each cell in the pack
                         # If individual voltages unknown but number of cells known set each to NaN
string location          # The location into which the battery is inserted. (slot number or plug)
string serial_number     # The best approximation of the battery serial number

Output

# Automatically generated by rcgenmsg for test_messages/BatteryInfo.msg
@0xb182ad93e3657cff;


using Cxx = import "/capnp/c++.capnp";
$Cxx.namespace("ros::std_msgs");


struct BatteryInfo {
const powerSupplyStatusUnknown : UInt8 = 0;
const powerSupplyStatusCharging : UInt8 = 1;
const powerSupplyStatusDischarging : UInt8 = 2;
const powerSupplyStatusNotCharging : UInt8 = 3;
const powerSupplyStatusFull : UInt8 = 4;
const powerSupplyHealthUnknown : UInt8 = 0;
const powerSupplyHealthGood : UInt8 = 1;
const powerSupplyHealthOverheat : UInt8 = 2;# test
const powerSupplyHealthDead : UInt8 = 3;
const powerSupplyHealthOvervoltage : UInt8 = 4;
const powerSupplyHealthUnspecFailure : UInt8 = 5;
const powerSupplyHealthCold : UInt8 = 6;
const powerSupplyHealthWatchdogTimerExpire : UInt8 = 7;
const powerSupplyHealthSafetyTimerExpire : UInt8 = 8;
const powerSupplyTechnologyUnknown : UInt8 = 0;
const powerSupplyTechnologyNimh : UInt8 = 1;
const powerSupplyTechnologyLion : UInt8 = 2;
const powerSupplyTechnologyLipo : UInt8 = 3;
const powerSupplyTechnologyLife : UInt8 = 4;
const powerSupplyTechnologyNicd : UInt8 = 5;
const powerSupplyTechnologyLimn : UInt8 = 6;
header @0 : import "/std_msgs/Header.capnp".Header;
voltage @1 : Float32;# Voltage in Volts (Mandatory)
current @2 : Float32;# Negative when discharging (A)  (If unmeasured NaN)
charge @3 : Float32;# Current charge in Ah  (If unmeasured NaN)
capacity @4 : Float32;# Capacity in Ah (last full capacity)  (If unmeasured NaN)
designCapacity @5 : Float32;# Capacity in Ah (design capacity)  (If unmeasured NaN)
percentage @6 : Float32;# Charge percentage on 0 to 1 range  (If unmeasured NaN)
powerSupplyStatus @7 : UInt8;# The charging status as reported. Values defined above
powerSupplyHealth @8 : UInt8;# The battery health metric. Values defined above
powerSupplyTechnology @9 : UInt8;# The battery chemistry. Values defined above
present @10 : Bool;# True if the battery is present
cellVoltage @11 : List(Float32);# An array of individual cell voltages for each cell in the pack
location @12 : Text;# The location into which the battery is inserted. (slot number or plug)
serialNumber @13 : Text;# The best approximation of the battery serial number
}

LICENSE

MIT/Apache 2.0

About

ROS compatibility message generator in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published