rosgenmsg

Generate custom messages from ROS definitions

Description

example

rosgenmsg(folderpath) generates ROS custom messages in MATLAB® by reading ROS custom message and service definitions in the specified folder path. The function expects ROS package folders inside the folder path. These packages contain the message definitions in .msg files and the service definitions in .srv files. The packages require a package.xml file to define its contents.

After calling this function, you can send and receive your custom messages in MATLAB like all other supported messages. You can create these messages using rosmessage or view the list of messages by calling rosmsg list.

Note

To use the function, you must install the ROS Toolbox Interface for the ROS Custom Messages add-on using rosAddons.

Examples

collapse all

After you install the support package and prepare your custom message package folder, specify the path to the parent folder and call rosgenmsg.

Note

You must set the folderpath based on your ROS package setup.

folderpath = "C:/Users/user1/Documents/robot_custom_msg/";
rosgenmsg(folderpath)

Input Arguments

collapse all

Path to the parent folder of ROS message packages, specified as a string scalar or character vector. The parent folder should contain a package.xml file and package folders. These folders contain message definitions in .msg files and the service definitions in .srv files. The packages require a package.xml file to define its contents.

Example: "/opt/ros/kinetic/share"

Limitations

  • You must install the ROS Toolbox Interface for ROS Custom Messages add-on using rosAddons to use this function.

Introduced in R2019b