Use Robot Operating System (ROS) to share data between two nodes.
Generally, the steps to set up one node as a master node (on your host machine), 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 where your master node resides isn't necessarily your development host.
$ . /opt/ros/kinetic/setup.bash
If your development host and the host machine where your master node resides are one and the same, then ensure that the terminal from where you set up your master node is different from the terminal you may be using to build your ROS sensor publisher node.
The setup script that you use to set up the master node and the one that you use to build your ROS sensor publisher node set your environment variables differently. Therefore, you must use separate terminals if you're using the same host machine for your master node and for building.
$ roscore& $ ps -ae | grep ros
$rosnode list /rosout
$ rostopic list /rosout /rosout_agg
The target is what publishes the data. The necessary files should be on the image you booted on the board.
# . /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
Run a visualization tool from your host machine (where your master node resides) to visualize the data sent from the target. You can use the following visualization tools:
$ . /keypoint.py
The script visualizes the data for you. You should see the camera data from the target appear in your terminal on your host machine. This script is available from the QNX Software Center (QNX Platform for ADAS 2.0 Robot OS Examples Source Code from ). After you install and extract the contents of this package, the keypoint.py script is located at $QNX_BASE/source/source_package_adas_ros/apps/sensor/rospy_camera_example.
Note that in the available reference images, the recorded video that's provided as the default in the sensor configuration files (e.g., /etc/system/config/adas_example_capture.conf) uses a recorded video file that keypoint.py isn't able to visualize. Therefore, to display a viewfinder with keypoint.py, you must instead, connect a PointGrey USB 3.0 camera to the target, and configure the Sensor service to use the USB camera configuration that's provided in the reference image. For example:
# slay sensor # sensor -U 521:521,1001 -r /accounts/1000/shared/camera -c /base/etc/system/config/usb_camera.conf &
This tool is available with the standard full-desktop ROS software installation. For more information, see http://wiki.ros.org/rviz.
On your host computer, the source code is provided for Robot OS example application as part of a ZIP file. You can build the source and deploy the binary on to your target.