ros2device
Description
The ros2device
object creates a connection with a ROS 2 device.
The ROS 2 device can be the local device or a remote device. The object contains the necessary
login information and other parameters of the ROS 2 distribution. Once you have made a
connection using ros2device
, you can run and stop ROS 2
nodes.
You can deploy ROS 2 nodes to a ROS 2 device using Simulink® models. For an example, see Generate a Standalone ROS 2 Node from Simulink
You can also deploy ROS 2 nodes generated from MATLAB® code.
.
Note
To connect to a ROS 2 device, an SSH server must be installed on the device. To
connect to the local host, an SSH server installation on the local device is not required
if you specify the deviceAddress
as 'localhost'
.
Alternatively, if you specify the deviceAddress
as
'127.0.0.1'
or as the host name referring to the local device, then
an SSH server must be installed on the local device.
Creation
Syntax
Description
creates a device
= ros2device(deviceAddress
,username
,password
)ros2device
object connected to the ROS 2 device at the
specified address and with the specified user name and password.
creates a
device
= ros2deviceros2device
object connected to a ROS 2 device using the saved
values for deviceAddress
, username
, and
password
.
creates a device
= ros2device('localhost'
)ros2device
object connected to the local device.
Properties
Object Functions
runNode | Start ROS or ROS 2 node |
stopNode | Stop ROS or ROS 2 node |
isNodeRunning | Determine if ROS or ROS 2 node is running |
system | Execute system command on device |
putFile | Copy file to device |
getFile | Get file from device |
deleteFile | Delete file from device |
dir | List folder contents on device |
openShell | Open interactive command shell to device |
Examples
Limitations
You cannot change the
ROS2Folder
property when connected to local host. For local host connections, it will always point to the ROS 2 folder within MATLAB installation.
Version History
Introduced in R2021a