Main Content

rostype

Access available ROS message types

Syntax

Description

rostype creates a blank message of a certain type by browsing the list of available message types. You can use tab completion and do not have to rely on typing error-free message type character vectors. By typing rostype.partialname, and pressing Tab, a list of matching message types appears in a list. By setting the message type equal to a variable, you can create a character vector of that message type. Alternatively, you can create the message by supplying the message type directly into rosmessage as an input argument.

example

Examples

collapse all

Create Message Type String

t = rostype.std_msgs_String
t = 
'std_msgs/String'

Create ROS Message from ROS Type

msg = rosmessage(rostype.std_msgs_String)
msg = 
  ROS String message with properties:

    MessageType: 'std_msgs/String'
           Data: ''

  Use showdetails to show the contents of the message

Version History

Introduced in R2019b