Expand description
§ROS2 Message Parser
A comprehensive Rust library for parsing ROS2 message, service, and action files.
This crate provides functionality to parse .msg, .srv, and .action files
according to the ROS2 IDL specification.
§Features
- Message parsing: Parse
.msgfiles with support for primitive types, arrays, and constants - Service parsing: Parse
.srvfiles with request/response separation - Action parsing: Parse
.actionfiles with goal/result/feedback sections - Comprehensive validation: Validates names, types, and values according to ROS2 standards
- Error handling: Detailed error messages for debugging parsing issues
- Serde support: Optional serialization support with the
serdefeature
§Quick Start
use ros2msg::{parse_message_string, parse_service_string, parse_action_string};
// Parse a message
let msg_content = r#"
int32 x
int32 y
string name
"#;
let msg_spec = parse_message_string("geometry_msgs", "Point", msg_content)?;
println!("Parsed message: {}", msg_spec);
// Parse a service
let srv_content = r#"
int32 a
int32 b
---
int32 sum
"#;
let srv_spec = parse_service_string("example_msgs", "AddTwoInts", srv_content)?;
println!("Parsed service: {}", srv_spec);
// Parse an action
let action_content = r#"
int32 order
---
int32[] sequence
---
int32[] partial_sequence
"#;
let action_spec = parse_action_string("example_msgs", "Fibonacci", action_content)?;
println!("Parsed action: {}", action_spec);§Modules
Re-exports§
pub use msg::ActionSpecification;pub use msg::AnnotationValue;pub use msg::Annotations;pub use msg::BaseType;pub use msg::Constant;pub use msg::Field;pub use msg::InterfaceSpecification;pub use msg::MessageSpecification;pub use msg::PRIMITIVE_TYPES;pub use msg::ParseError;pub use msg::ParseResult;pub use msg::PrimitiveValue;pub use msg::ServiceSpecification;pub use msg::Type;pub use msg::Value;pub use msg::create_feedback_message;pub use msg::create_service_event_message;pub use msg::is_valid_constant_name;pub use msg::is_valid_field_name;pub use msg::is_valid_message_name;pub use msg::is_valid_package_name;pub use msg::parse_action_file;pub use msg::parse_action_string;pub use msg::parse_interface_file;pub use msg::parse_message_file;pub use msg::parse_message_string;pub use msg::parse_primitive_value_string;pub use msg::parse_service_file;pub use msg::parse_service_string;
Modules§
- generator
- Code generator for ROS2 interfaces
- idl
- ROS2 IDL parser
- idl_
adapter - MSG/SRV/Action to IDL converter
- msg
- ROS2 Message/Service/Action parser
Constants§
- VERSION
- Version information