rosdevice
Connect to remote ROS device
Description
The rosdevice
object is used to create a connection with a
ROS device. The ROS device can be the local device or a remote device. The object
contains the necessary login information and other parameters of the ROS distribution.
Once a connection is made using rosdevice
, you can run and stop a ROS
core or ROS nodes and check the status of the ROS network. Before running ROS nodes, you
must connect MATLAB® to the ROS network using the rosinit
function.
You can deploy ROS nodes to a ROS device using Simulink® models. For an example, see Generate a Standalone ROS Node from Simulink.
You can also deploy ROS nodes generated from MATLAB code.
Note
To connect to a remote ROS 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
= rosdevice(deviceAddress
,username
,password
)rosdevice
object connected to the ROS device at
the specified address and with the specified user name and password.
creates a
device
= rosdevicerosdevice
object connected to a ROS device using the
saved values for deviceAddress
,
username
, and password
.
creates a device
= rosdevice('localhost'
)rosdevice
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 |
runCore | Start ROS core |
stopCore | Stop ROS core |
isCoreRunning | Determine if ROS core 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
ROSFolder
property when connected to local host. For local host connections, it will always point to the ROS folder within MATLAB installation.
Version History
Introduced in R2019b
See Also
runNode
| stopNode
| runCore
| isNodeRunning