|
| 1 | +# Common Messages (common_msgs) |
| 2 | + |
| 3 | +## File Tree/Package Structure |
| 4 | +This message package follows standard ROS2 package scheme: |
| 5 | +``` |
| 6 | +common_msgs/ |
| 7 | +├── CMakeLists.txt |
| 8 | +├── package.xml |
| 9 | +├── README.md |
| 10 | +└── msg/ |
| 11 | + ├── ArmPose.msg |
| 12 | + ├── HandPose.msg |
| 13 | + └── JointState.msg |
| 14 | +``` |
| 15 | + |
| 16 | +## Purpose |
| 17 | +The `common_msgs` package serves as a global package for message definitions that are commonly used across various components and packages within the humanoid project. |
| 18 | + |
| 19 | +## Inputs & Outputs |
| 20 | +This package primarily defines message structures. Therefore: |
| 21 | +- **Outputs**: Provides `.msg` definitions that other ROS 2 packages can import and use. |
| 22 | +- **Inputs**: Does not process data or subscribe to topics; it only defines data structures. |
| 23 | + |
| 24 | +## Key Features |
| 25 | +- **Message Definitions**: Contains a collection of `.msg` files, each defining a specific data structure. These messages are designed to be generic and applicable in multiple contexts. |
| 26 | + |
| 27 | +### Message Definitions |
| 28 | +- `ArmPose.msg`: Describes the pose of an arm, including its major joints and optionally the hand. |
| 29 | +- `HandPose.msg`: Details the pose of a hand, including individual finger joint states. |
| 30 | +- `JointState.msg`: A custom message (similar message structure to [sensor_msgs/JointState](https://docs.ros.org/en/humble/p/sensor_msgs/msg/JointState.html)) to represent a single joint. |
| 31 | + |
| 32 | +## Usage |
| 33 | +To use the messages defined in this package within another ROS 2 package: |
| 34 | + |
| 35 | +1. **Copy the package into your Docker image's source workspace**: Add the following line to your Dockerfile (typically `root/docker/MODULE_NAME/MODULE_NAME.Dockerfile`), typically in the section where you copy your source code: |
| 36 | + ```dockerfile |
| 37 | + # # Copy in source code |
| 38 | + # # COPY autonomy/wato_msgs/sample_msgs sample_msgs |
| 39 | + COPY autonomy/wato_msgs/common_msgs common_msgs |
| 40 | + ``` |
| 41 | + |
| 42 | +2. **Add Dependency**: Ensure that `common_msgs` is listed as a dependency in the `package.xml` of your consuming package: |
| 43 | + ```xml |
| 44 | + <depend>common_msgs</depend> |
| 45 | + ``` |
| 46 | +3. **Include in CMakeLists.txt** (for C++ packages): |
| 47 | + ```cmake |
| 48 | + find_package(common_msgs REQUIRED) |
| 49 | + ament_target_dependencies(your_target_name common_msgs) |
| 50 | + ``` |
| 51 | +4. **Import in Python scripts**: |
| 52 | + ```python |
| 53 | + from common_msgs.msg import YourMessageName |
| 54 | + ``` |
| 55 | +5. **Include in C++ code**: |
| 56 | + ```cpp |
| 57 | + #include "common_msgs/msg/your_message_name.hpp" |
| 58 | + ``` |
| 59 | + |
| 60 | +### Testing |
| 61 | +Currently, this package primarily contains message definitions, so testing focuses on ensuring they can be correctly compiled and used by dependent packages. |
| 62 | + |
| 63 | +## Configuration |
| 64 | +- **Parameters**: No configurable parameters are defined within this package itself. |
0 commit comments