Contents¶
Introduction¶
Now that we have added both a model of our dynamics and a model of our sensors to CRS in the previous tutorials, let's take care of the msg files before we begin building our ROS architecture. ROS messages define the data format our ROS nodes will use to communicate later on. Almost all of the ROS-related code for CRS is defined within the ros4crs directory. We will just be dipping our toes in to src/ros4crs/crs_msgs, so don't worry about all those other folders (yet).
Step-by-Step¶
Folder Structure¶
Setup folder structure
1. Make sure you have matching folder for your model e.g. `crs_msgs/msg/parafoil`
2. Create `parafoil/core_messages` folder
State Message Definition¶
Create state msg file
- Duplicate
car_state_cart.msgintoparafoil/core_messages, and rename to match our model, e.g.parafoil_4dof_state.msg -
Edit state msg to match states from model e.g.
Input Message Definition¶
Create input msg file
- Duplicate
car_input.msgintoparafoil/core_messages, and rename to match our model, e.g.parafoil_4dof_input.msg -
Edit input msg to match input from model, e.g.
Sensor Message Definition¶
Create each sensor's msg file. Depending on your exact system architecture it may make sense to move these message files into a separate I/O folder or ROS package at a later date, but as a starting point it makes sense to define them within the generic crs_msgs package
- Duplicate a previous
.msgfile or create a new one, name to match our sensor e.gparafoil_imu.msg -
Edit message to match sensor output e.g. for the parafoil IMU sensor
Admin Files¶
Update CmakeLists.txt
-
Duplicate & update
add_message_files-block, matching your folder/file structure
Update package.xml
1. Update maintainer info (if necessary)
Review¶
Folder structure should then be equivalent to:
crs_msgs
├── CMakeLists.txt
├── msg
│ ├── car
│ │ └── ...
│ ├── ...
│ └── parafoil
│ └── core_messages
│ ├── parafoil_4dof_input.msg
│ ├── parafoil_4dof_state.msg
│ ├── parafoil_gps.msg
│ └── parafoil_imu.msg
└── package.xml
Up Next¶
Now that we have defined our messages we can begin integrating our model into ROS, either by developing our own, barebones ROS simulator (recommended for ROS beginners) or by directly integrating our model into CRS' ros4crs/ros_simulator (recommended for those familiar with ROS)