The custom ROS2 interfaces package for the BotBrain robot platform. This package defines all custom message types, service definitions, and action interfaces used throughout the robot system.
The bot_custom_interfaces package serves as the central repository for all custom ROS2 communication interfaces used by the R1 robot platform. It provides standardized message types for robot control, status reporting, device management, and system communication across all robot packages.
bot_custom_interfaces/
├── msg/ # Custom message definitions
├── srv/ # Custom service definitions
├── action/ # Custom action definitions
├── CMakeLists.txt # CMake build configuration
├── package.xml # ROS2 package manifest
└── README.md # This file
-
Create Message File: Create a new
.msgfile in themsg/directory# Example: MyCustomMessage.msg std_msgs/Header header string data int32 value
-
Update CMakeLists.txt: Add the message to the
rosidl_generate_interfacescallrosidl_generate_interfaces(${PROJECT_NAME} # ... existing interfaces ... "msg/MyCustomMessage.msg" )
-
Build and Test: Build the package and verify the interface is generated
colcon build --packages-select bot_custom_interfaces ros2 interface show bot_custom_interfaces/msg/MyCustomMessage
-
Create Service File: Create a new
.srvfile in thesrv/directory# Example: MyCustomService.srv # Request string command int32 value --- # Response bool success string message
-
Update CMakeLists.txt: Add the service to the
rosidl_generate_interfacescallrosidl_generate_interfaces(${PROJECT_NAME} # ... existing interfaces ... "srv/MyCustomService.srv" )
-
Create Action File: Create a new
.actionfile in theaction/directory# Example: MyCustomAction.action # Goal string goal_data --- # Result bool success string result_message --- # Feedback float32 progress string status
-
Update CMakeLists.txt: Add the action to the
rosidl_generate_interfacescallrosidl_generate_interfaces(${PROJECT_NAME} # ... existing interfaces ... "action/MyCustomAction.action" )
- Messages: Use descriptive names ending with the data type (e.g.,
RobotStatus.msg,DeviceInfo.msg) - Services: Use action-oriented names (e.g.,
StartMapping.srv,SwitchGait.srv) - Actions: Use action-oriented names ending with "Action" (e.g.,
NavigateAction.action) - Fields: Use snake_case for field names (e.g.,
robot_status,device_id)
- Keep Interfaces Simple: Use basic ROS2 types when possible
- Use Standard Types: Prefer
std_msgstypes over custom types - Include Headers: Add
std_msgs/Headerfor timestamped messages - Provide Feedback: Include success/error information in service responses
- Document Fields: Add comments explaining field purposes
- Version Compatibility: Consider backward compatibility when modifying interfaces
ament_cmake- CMake build systemstd_msgs- Standard ROS2 message typesaction_msgs- Standard ROS2 action typesrosidl_default_generators- Interface generation
rosidl_default_runtime- Interface runtime support
Note: This package is fundamental to the entire robot system. Changes to interfaces can break compatibility with existing packages. Always test thoroughly and consider backward compatibility when modifying existing interfaces.