Message Types
Messages are classes that implement the IMessage interface. These classes are used to send and receive information between Unity and an external service.
These messages are created using a combination of regular data types as fields.
Built-In Message Types
Simulation Foundation provides a variety of pre-defined messages in the package. They are generated from the message definitions provided in standard ROS packages. The build-in messages cover all standard data types and variety of robotic applications. These built-in message are generated using Message Generation. Below we provide a list of ROS packages whose messages use to define our built-in messages. You can refer to the ROS documentation of each package to see a list of all messages.
Package Name |
Description |
ROS Documentation |
C# message Definitions |
std_msgs std_srvs |
This package consists of message for all the primitive types defined in ROS. |
https://wiki.ros.org/std_msgs https://wiki.ros.org/std_srvs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Std |
actionlib_msgs |
This package allows the user to communicate with a process, allowing them to cancel or retrieve feedback from a process taking a long time. |
https://wiki.ros.org/actionlib_msgs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Actionlib |
diagnostic_msgs |
The diagnostics system is designed to collect information from hardware drivers and robot hardware to users and operators for analysis, troubleshooting, and logging. |
https://wiki.ros.org/diagnostic_msgs https://wiki.ros.org/diagnostic_srvs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Diagnostic |
geometry_msgs |
geometry_msgs provides messages for common geometric primitives such as points, vectors, and poses. |
https://wiki.ros.org/geometry_msgs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Geometry |
navigation_msgs |
This package provide information to manupilate maps stored on the map server |
http://docs.ros.org/en/noetic/api/map_msgs/html/index-msg.html |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Map |
move_base_msgs |
The move_base package provides an implementation of an action that, given a goal in the world, will attempt to reach it with a mobile base. The move_base node links together a global and local planner to accomplish its global navigation task. |
https://wiki.ros.org/move_base |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/MoveBase |
nav_msgs |
A 2D navigation stack that takes in information from odometry, sensor streams, and a goal pose and outputs safe velocity commands that are sent to a mobile base. |
https://wiki.ros.org/nav_msgs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Nav |
object_information_msgs |
This package provides stack for object recognition in images. |
http://docs.ros.org/en/noetic/api/object_recognition_msgs/html/index-msg.html |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/ObjectRecognition |
octomap_msgs |
The OctoMap library implements a 3D occupancy grid mapping approach, providing data structures and mapping algorithms. |
https://wiki.ros.org/octomap |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Octomap |
rosgraph_msgs |
rosgraph_msgs contains message relating to the ROS Computation Graph. Most users are not expected to interact with messages in this package, and it is strongly advised against. These messages are generally wrapped in higher level APIs. |
https://wiki.ros.org/rosgraph_msgs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Rosgraph |
sensor_msgs |
This package defines messages for commonly used sensors, including cameras and scanning laser rangefinders. |
https://wiki.ros.org/sensor_msgs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Sensor |
shape_msgs |
his package contains messages for defining shapes, such as simple solid object primitives (cube, sphere, etc), planes, and meshes. |
https://wiki.ros.org/sensor_msgs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Shape |
tf2_msgs |
tf2 is the second generation of the transform library, which lets the user keep track of multiple coordinate frames over time. tf2 maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time. |
https://wiki.ros.org/tf2_msgs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Tf2 |
trajectory_msgs |
This package defines messages for defining robot trajectories. |
https://wiki.ros.org/trajectory_msgs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Trajectory |
visualization_msgs |
The visualization_msgs message is used to send visualization "markers" such as boxes, spheres, arrows, lines, etc. to a visualization environment such as rviz. |
https://wiki.ros.org/visualization_msgs |
https://github.com/Unity-Technologies/Simulation-Foundation/tree/main/com.unity.simulation.foundation/Runtime/Messages/Visualization |
Message Generation
You can use the Message Generation feature to create custom messages using .msg files. msg files are simple text files that describe the fields of a ROS message. To know more about writing .msg files, you can follow this tutorial. They are used to generate source C# code for messages.
To generate C# code for the .msg file, select the menu option "Unity-Simulaton>RosMessageGeneration->Browse..." to open the message browser.
Select your ROS message folder at the top, then you can navigate through the folder structure to find the .msg files. Click the "Build msg" button to build the messages you want.
Message Importers
For a more automated workflow, you may find it useful to simply drag an entire ROS module folder into your Unity project. Unity will automatically find any .msg and .srv files in the folder structure, and convert them into C# message classes for you. And the classes will be updated if the .msg or .srv files change on disk.
Note: The message generation system looks for a ROS package.xml to determine what code to generate, so if you're working this way it's recommended to import an entire ROS module, rather than individual .msg files, into your Unity project.