Main Content

system

Execute system command on device

Since R2019b

Description

example

system(device,command) runs a command in the Linux® command shell on the ROS or ROS 2 device. This function does not allow you to run interactive commands.

system(device,command,'sudo') runs a command with superuser privileges.

response = system(___) runs a command using any of the previous syntaxes with the command shell output returned in response.

Examples

collapse all

Connect to a ROS device and run commands on the Linux(R) command shell.

Connect to a ROS device. Specify the device address, user name, and password of your ROS device.

d = rosdevice('192.168.17.128','user','password');

Run a command that lists the contents of the Catkin workspace folder.

system(d,'ls /home/user/catkin_ws_test')
ans = 
    'build
     devel
     src
     '

Input Arguments

collapse all

ROS or ROS 2 device, specified as a rosdevice or ros2device object, respectively.

Linux command, specified as a character vector.

Example: 'ls -al'

Output Arguments

collapse all

Output from Linux shell, returned as a character vector.

Version History

Introduced in R2019b