Building and using the ROS sensor publisher node

You can build and run the ROS sensor publisher node that's provided with the QNX Platform for ADAS.

You can also customize the ROS sensor publisher node example to meet the needs of your system. Some of the reasons why you may wish to customize the ROS sensor publisher are:

The ROS sensor publisher node example is intended to be a basis from where you can start your customizations. The following sections below describe how to build, deploy, configure, and run the ROS sensor publisher nodelet. The instructions speak specifically to the ROS sensor publisher node example, but you can reference the example and follow similar steps to develop your own nodelet.

For more information on ROS packages and catkin workspaces, see http://wiki.ros.org/catkin/Tutorials/CreatingPackage.

Before you begin

You must have the then you must have the QNX Platform for ADAS 2.0 - Robot OS and Publisher and QNX Platform for ADAS 2.0 - Sensor packages installed.

Extracting the ROS sensor publisher node example

The Robot OS Examples Source Code is provided as a ZIP file that's found at $QNX_BASE/source/adas-ros-examples-version.zip on your host system. Extract (e.g., using the unzip utility) archive to a working directory. For example:

$ unzip -d adas-ros-examples-2.0.1145.zip
            

After extracting the archive file, you should see a directory structure that starts with source_package_adas_ros.

Building the ROS sensor publisher node example

To build and install the sensor publisher ROS workspace, run the build script (build.sh) that's located at extraction_directory/source_package_adas_ros/apps/sensor/ros_publisher. For example:

$ . /build.sh
            

To clean up the workspace (remove all catkin build, development and installation directories, run the cleanup script (clean.sh. For example:

$ . /clean.sh
            

You can find details of your build, or any errors, in log files that are created under a logs directory.

Deploying the ROS sensor publisher node example

The ROS setup scripts that are generated when you built the ROS sensor publisher node example assumes that the workspace will be deployed under /opt/ros/sensor_publisher on your target.

You can change where the workspace is deployed on your target by changing the TARGET_INSTALL_DIR environment variable in the build.sh build script. For example:

...
    catkin_make install --build build_$arch \
                        --cmake-args \
                            -DCMAKE_TOOLCHAIN_FILE=$ROS_ROOT/../catkin/cmake/platform/qnx.nto.toolchain.cmake \
                            -DTARGET_INSTALL_DIR="/opt/ros/sensor_publisher" \
                            -DCMAKE_BUILD_TYPE=Release \
                            -DCATKIN_DEVEL_PREFIX=devel_$arch \
                            -DCMAKE_INSTALL_PREFIX=install/target/qnx7/$arch/opt/ros/sensor_publisher \
                        --make-args \
                        VERBOSE=1 \
...
            

Ensure that you clean and rebuild your workspace after modifying your build script.

After building the ROS sensor publisher node example, deploy the workspace to your target by copying all the files from the install directory to your target. For example:

$ scp -r install/target/qnx7/arch/opt root@target_ip:/
            
where arch is your target's CPU architecture and target_ip is the IP address of your target. Run ifconfig on your target to determine its IP address

Configuring the ROS sensor publisher node example

The sensor publisher nodelet supports the following parameters:

publish_radar_markers

Set to true to use visualization/MarkerArray messages (default) or false to publish sensor_publisher/RadarTrackArray messages for radar sensors.

The sensor publisher nodelet supports two types of ROS messages to publish radar sensor data: visualization/MarkerArray and sensor_publisher/RadarTrackArray messages.

By default visualization/MarkerArray messages are used. You can view these messages by using the rviz visualization tool that's provided with your ROS desktop software. However, these messages don't contain all the available information that's captured by the radar sensors (e.g., speed, object width).

The customized ROS message called RadarTrack (see definition in extraction_directorysource_package_adas_ros/apps/sensor/ros_publisher/src/sensor_publisher/msg/RadarTrack.msg) will provide more sensor information by using messages of type RadarTrackArray.

publish_cameras

Set to true to 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. For this reason, the camera sensor data isn't published by default. To change this, set publish_cameras to true. To visualize the data, you should use the keypoint.py script that's provided with this release.

message_queue_size

Set the message queue size that's used for all published topics.

All ROS topics that are created by the sensor publisher nodelets use a queue depth of message_queue_size. The default queue size is 1.

frame_id

Set the identifer of the frame that's used for all published topics.

This is the header identifier that's used for all ROS messages that are published by the sensor publisher nodelet. The default is QNX_SENSOR.

These parameters are defined in $QNX_BASE/source/source_package_adas_ros/apps/sensor/ros_publisher/src/sensor_publisher/config.yaml.

Use the command-line tool rosparam to query and set parameters. For more information, see hhttp://wiki.ros.org/rosparam.

Running the ROS sensor publisher node example on your target

A launch file (sensor_publisher_standalone_nodelet.launch) is available in the directory $QNX_BASE/source/source_package_adas_ros/apps/sensor/ros_publisher/src/sensor_publisher/launch. This file launches the nodelet in standalone mode and loads the file config.yaml to configure it.

Before you can run the sensor publisher nodelet, you must set up the ROS environment on our target. Do so by running the setup script and extending the workspace For example:

# . /opt/ros/kinetic/setup.sh
# . /opt/ros/sensor_publisher/setup.sh --extend
            

After setting up your target environment, use either roslaunch or rosrun to launch the sensor publisher node example on your target.

When the ROS sensor publisher node example is successfully running, a new ROS node is created, along with ROS topics (one for every configured sensor unit). You can verify this by running the rosnode list and rostopic list commands. For example:

# 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