A high-performance ROS2 command-line tool written in Rust
ROC is a modern replacement for the ROS2 CLI toolchain, built with Rust for performance and reliability. Unlike other implementations, ROC directly interfaces with the RCL (ROS Client Library) and RMW (ROS Middleware) layers through FFI bindings, providing native-level performance and detailed introspection capabilities.
- π― True Generic Message System: World's first truly generic ROS2 message handling - works with ANY message type without hardcoding
- β‘ Runtime Type Discovery: Automatic ROS2 message type introspection and serialization using native type support libraries
- π§ Direct RCL/RMW Integration: Native bindings to ROS2's core libraries with zero Python overhead
- π Comprehensive Topic Information: Detailed QoS profiles, endpoint discovery, and type introspection
- π High Performance: Built in Rust for speed and memory safety
- π Complete CLI Compatibility: Drop-in replacement for
ros2commands - π Advanced Debugging: Detailed endpoint information including GIDs and type hashes
- π₯οΈ Shell Completions: Dynamic completions for bash, zsh, and fish
cargo install roccgit clone https://github.com/your-org/roc.git
cd roc
cargo build --releaseDownload pre-built binaries from our releases page.
roc <COMMAND> [SUBCOMMAND] [OPTIONS] [ARGS]action[a]- Action server introspection and interactiontopic[t]- Topic monitoring, publishing, and detailed infoservice[s]- Service discovery and callingparam[p]- Parameter management and introspectionnode[n]- Node discovery and informationinterface[i]- Message/service type introspection
run[r]- Execute ROS2 packages and nodeslaunch[l]- Launch file executionwork[w]- Complete workspace management suitebuild- Colcon replacement build system with parallel builds, dependency resolution, and environment managementcreate- Package creation wizard for ament_cmake, ament_python, and cmake packageslist- Package discovery and listinginfo- Package metadata and dependency information
bag[b]- ROS bag recording and playbackdaemon[d]- Daemon and bridge managementmiddleware[m]- RMW configuration and diagnosticsframe[f]- Transform frame utilitiesidl[interface-def]- Interface Definition Language toolsprotobuf- Bidirectional conversion between Protobuf (.proto) and ROS2 (.msg) files
ROC bypasses the Python layer entirely, interfacing directly with RCL/RMW through optimized Rust FFI bindings. This provides:
- Faster startup times
- Lower memory usage
- More reliable operation
- Better error handling
ROC features a truly generic ROS2 message system that works with ANY message type without hardcoding:
# Works automatically with ANY message type - no code changes needed!
roc topic pub /my_topic custom_msgs/msg/MyComplexType '{field1: value, nested: {data: 42}}'
roc topic pub /sensors std_msgs/msg/Int8 '{data: 5}'
roc topic pub /control geometry_msgs/msg/Twist '{linear: {x: 1.0}}'
# Even custom message types work instantly
roc topic pub /robot_status my_robot/msg/CustomStatus '{active: true, battery: 85.5}'Key Innovation:
- Universal Compatibility: Works with std_msgs, geometry_msgs, sensor_msgs, and ANY custom message type
- Runtime Type Discovery: Automatically loads message type definitions at runtime using ROS2's introspection system
- Zero Configuration: No compilation or setup required for new message types
- Memory Safe: Full Rust safety guarantees with optimized C struct serialization
Get comprehensive topic details that exceed the standard ROS2 CLI:
roc topic info /chatter --verboseThis provides detailed QoS profiles, endpoint information, GIDs, type hashes, and publisher/subscriber discovery data.
ROC is built on a layered architecture:
- π― Generic Message System: Runtime type discovery and universal message handling
- π§ RCL/RMW FFI Layer: Direct bindings to ROS2 core libraries
- π Graph Context: Efficient ROS graph introspection
- π₯οΈ Command Interface: Familiar CLI matching ROS2 tools
- π Shell Integration: Dynamic completions and scripting support
Comprehensive documentation is available in the ROC Book, including:
- Architecture Overview: How ROC interfaces with ROS2
- RCL/RMW Integration: Technical details of the FFI bindings
- Implementation Guide: Deep dives into graph context and endpoint discovery
- Examples: Practical usage patterns and integration examples
To build and serve the documentation locally:
cd book
mdbook serveROC includes powerful tools for working with different interface definition languages, enabling seamless interoperability between ROS2 and other systems.
Convert between Protobuf (.proto) and ROS2 (.msg) formats with automatic direction detection:
# Convert .proto files to .msg files
roc idl protobuf robot.proto sensor_data.proto
# Convert .msg files to .proto files
roc idl protobuf RobotStatus.msg SensorData.msg
# Specify output directory
roc idl protobuf --output ./generated robot.proto
# Dry run to preview output
roc idl protobuf --dry-run robot.protoKey Features:
- Automatic Direction Detection: Detects conversion direction based on file extensions
- Advanced Protobuf Support: Handles nested messages, enums, oneofs, maps, and comments
- Dependency Resolution: Generates files in correct dependency order
- Inplace Output: Generates files in the same directory as input by default
- Type Mapping: Intelligent conversion between Protobuf and ROS2 types
- Pure Rust Implementation: No external dependencies or tools required
Supported Protobuf Features:
- Primitive types (int32, string, bool, etc.)
- Repeated fields (arrays)
- Nested messages and custom types
- Enums with value mapping
- Oneof fields
- Map types
- Comments and documentation
- Proto3 syntax
Example Conversion:
// robot.proto
syntax = "proto3";
package robotics;
message RobotStatus {
bool active = 1;
string name = 2;
repeated double joint_positions = 3;
}
message Robot {
RobotStatus status = 1;
int32 id = 2;
}Converts to:
# RobotStatus.msg
bool active
string name
float64[] joint_positions
# Robot.msg
RobotStatus status
int32 idROC includes a complete workspace management system that serves as a drop-in replacement for colcon:
- Full colcon compatibility: All major colcon build options supported
- Parallel builds: Multi-threaded compilation with automatic dependency resolution
- Package discovery: Automatic scanning and parsing of package.xml manifests
- Environment management: Automatic setup of build and runtime environments
- Isolated/merged installs: Support for both colcon install modes
- Build types supported: ament_cmake, ament_python, cmake
# Build entire workspace (like colcon build)
roc work build
# Build specific packages
roc work build --packages-select my_package another_package
# Parallel builds with custom worker count
roc work build --parallel-workers 8
# Build with merged install space
roc work build --merge-install
# Continue on errors
roc work build --continue-on-errorIntelligent package creation wizard that generates properly structured ROS2 packages:
# Create C++ package
roc work create my_cpp_package --build-type ament_cmake
# Create Python package
roc work create my_py_package --build-type ament_python
# Create with dependencies and metadata
roc work create my_package \
--build-type ament_cmake \
--dependencies rclcpp std_msgs \
--description "My awesome ROS2 package" \
--maintainer-name "Your Name" \
--maintainer-email "[email protected]"# List all packages in workspace
roc work list
# Get detailed package information
roc work info my_package --xml- Rust 1.70+
- ROS2 (Humble, Iron, or Rolling)
- clang/libclang (for bindgen)
cargo build --releasecargo testWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
ROC is actively developed and production-ready for most ROS2 workflows. Current implementation status:
- π Topic Operations: Full feature parity with revolutionary generic message system
- β Universal Message Support: Works with ANY ROS2 message type automatically
- β Runtime Type Discovery: Dynamic type support loading and introspection
- β Memory-Safe Serialization: Optimized C struct handling with Rust safety
- β Intelligent Fallbacks: Graceful handling of problematic middleware combinations
- β Service Operations: Complete service introspection and calling
- β Node Operations: Node discovery and detailed information
- β Parameter Operations: Full parameter management
- β Interface Operations: Message and service type introspection
- β
IDL Tools: Complete Protobuf β ROS2 conversion
- β Bidirectional conversion with automatic direction detection
- β Advanced Protobuf feature support (nested messages, enums, oneofs, maps)
- β Pure Rust implementation with no external dependencies
- β Intelligent type mapping and dependency resolution
- β
Workspace Operations: Complete colcon replacement build system
- β Build system with parallel execution and dependency resolution
- β Package creation wizard for all major build types
- β Environment management and setup script generation
- β Package discovery and metadata extraction
- π§ Action Operations: Basic functionality (expanding)
- π§ Bag Operations: Recording and playbook (in progress)
- β³ Launch Operations: Planning phase
ROC was created to address limitations in the existing ROS2 toolchain:
- π― Universal Message Support: First tool to work with ANY ROS2 message type without hardcoding or recompilation
- β‘ Performance: Native Rust implementation eliminates Python overhead
- π‘οΈ Reliability: Strong typing and memory safety reduce runtime errors
- π§ Completeness: Direct RCL/RMW access enables features not available in the standard CLI
- π¨βπ» Developer Experience: Better error messages, shell completions, and debugging tools
- ποΈ Build System Innovation: Modern colcon replacement with superior dependency resolution, parallel execution, and cleaner environment management
This project is licensed under the MIT License - see the LICENSE.md file for details.
