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

example

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.

example

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

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 default port 11311.

core = ros.Core
core = 
  Core with properties:

         Port: 33945
    MasterURI: 'http://bat584805glnxa64:33945/'

Clear the ROS core to shut down the ROS network.

clear('core')

Create a ROS core on localhost and port 12000.

core = ros.Core(12000)
core = 
  Core with properties:

         Port: 12000
    MasterURI: 'http://bat1073807glnxa64:12000/'

Clear the ROS core to shut down the ROS network.

clear('core')

Introduced in R2019b