Main Content

Core

Create ROS Core

Description

The ROS Core encompasses many key components and nodes that are essential for the ROS network. You must have exactly one ROS core running in the ROS network for nodes to communicate. Using this class allows the creation of a ROS core in MATLAB®. Once the core is created, you can connect to it by calling rosinit or ros.Node.

Creation

Description

core = ros.Core returns a Core object and starts a ROS core in MATLAB. This ROS core has a default port of 11311. MATLAB allows the creation of only one core on any given port and displays an error if another core is detected on the same port.

core = ros.Core(port) starts a ROS core at the specified port, port.

example

Properties

expand all

This property is read-only.

Network port at which the ROS master is listening, returned as a scalar.

This property is read-only.

The URI on which the ROS master can be reached, returned as a character vector. The MasterURI is constructed based on the host name of your computer. If your host name is not valid, the IP address of your first network interface is used.

Examples

collapse all

Create a ROS core on localhost and port 12000.

core = ros.Core(12000)
Launching ROS Core...
Done in 0.5513 seconds.
core = 
  Core with properties:

         Port: 12000
    MasterURI: 'http://172.20.148.53:12000'

Clear the ROS core to shut down the ROS network.

clear('core')

Version History

Introduced in R2019b