You can use Robot Operating System (ROS) within MATLAB to acquire sensor data from your target.
For more information on getting started with ROS within MATLAB, see the following sites provided by MathWorks:
Generally, the steps to set up one node as a master node, and a second node on a target (e.g., from your reference image) so that you can see the data that's passed from a target to host over ROS are:
The host machine refers to where MATLAB resides.
$ rosinit
See rosinit from MATLAB for more information on connecting to a ROS network with MATLAB.
$rosnode list /matlab_global_node_11170
$ rostopic list /rosout
If you haven't yet started the ROS sensor publisher node on your target, you won't see any topics that you can subscribe to at the moment.
# . /opt/ros/kinetic/setup.sh # . /opt/ros/sensor_publisher/setup.sh --extend
# export ROS_MASTER_URI=http://10.123.123.10:11311
The URL should indicate where your roscore process is running.
In the configuration file on your target of the ROS sensor publisher node (/opt/ros/sensor_publisher/share/sensor_publisher/config.yaml), set the publish_cameras parameter to true. Do so such that the ROS sensor publisher node can publish camera raw video data.
ROS supports the transfer of raw video data using messages. However, the support is limited to a single YUV format, and the high bandwidth associated to transferring raw video data can result in performance degradation.
It's important to note that if you are sharing data from a camera, only the CbYCrY video format (SENSOR_FORMAT_VIDEO_CYBRY) can be published to ROS.
For sensors (lidar, radar, GPS, IMU), the following formats are supported:
# roslaunch /opt/ros/sensor_publisher/share/sensor_publisher/launch/sensor_publisher_standalone_nodelet.launch
If you have built a customized sensor publisher node, you can use the appropriate launch file that's associated with your custom application.
$ rosnode list /QNX/sensor_publisher /rosout $ rostopic list /QNX/sensor_publisher/esr2_5 /QNX/sensor_publisher/novatel_oem6_gps /QNX/sensor_publisher/novatel_oem6_imu /QNX/sensor_publisher/vlp_16 /QNX/sensor_publisher/vu8 /QNX/sensor_publisher/xsens_mti_g_710_gps /QNX/sensor_publisher/xsens_mti_g_710_imu /rosout /rosout_agg
$ sub = rossubscriber('/QNX/sensor_publisher/vlp_16')
This command creates a subscriber object to the topic that's specified. The name of the topic that you specify must be in the list of topics that was the output of the rostopic list command.
See rossubscriber from MATLAB for more information on subscribing to messages on a topic.
$ img_data = receive(sub)
This command returns the data in the format of the topic. For example, the topic may be an image. In this case you'll receive an Image message.
Usually, an application that processes sensor data calls the receive in a loop to ensure that it's continuously handling new data from a device.
See receive from MATLAB for more information on waiting for new ROS topic messages.