ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

What you want is to create multiple custom msgs (for how to create custom msgs, see @JackB answer).

Then, you need to nest the messages the way you want. Something along the line of the following msg definitions:

BatteryStatus.msg:

float32 current
float32 voltage

SystemStatus.msg:

int32 error_code
string error_msg

FullSystemInformation.msg

BatteryStatus battery
SystemStatus system

And then you can access the fields like, e.g. msg.battery.current or msg.system.error_code.