- Host Configuration
- Runtime Node Configuration
- SDF Configuration
- Ecosystem Tools
- Application Development
- Dynamic Driver Development
This bidirectional bridge enables PolySync Core message to be transcribed to ROS topics, and ROS topics to be transcribed to PolySync Core messages at runtime. PolySync Core provides a toolchain to build and run a ROS bridge node, which acts as a bridge between the PolySync Core bus and the ROS bus.
This bridge enables synchronized sensor data from PolySync Core to flow into existing ROS applications. Allowing you to take advantage of PolySync Core’s massive suite of supported sensors, providing submillisecond timing fidelity and no data-loss, while using existing ROS applications and software APIs to create autonomous vehicle algorithms.
Here’s an example of LiDAR, RADAR, and object data visualized in RVIS, streaming from the PolySync Core bus via the bridge.
The ROS bridge node can be generated against any PolySync Core data model using the PolySync Core provided
pdm-gen tool. Once the files are generated the ROS bridge node can be spun up to subscribe to data from the PolySync Core bus, which the ROS bridge node begins transcribing and republishing to the ROS bus.
1. Building the ROS bridge
pdm-gen tool takes in IDL files as input arguments. The IDL files define C-style structures which make a PolySync Core high level message, for example the
After sourcing the ROS environment, use the
pdm-gen tool and pass in the IDL files containing the message types that you want transcribed to ROS topics.
$ cd ~ $ source /opt/ros/<ros version>/setup.bash $ pdm-gen -c -r $ source pdm/ros_bridge/setup.sh
The command above will generate a ROS topic for every message type defined in the PolySync Core data model. Create and supply additional IDL files to generate ROS topics for your custom-defined message types.
pdm-gen tool creates all ROS resources (scripts, headers, libraries) along with a custom ROS topic for each PolySync Core message that’s defined within the data model IDL files.
The output directory is
./pdm, and the generated ROS resources are in
./pdm/ros_bridge/. You do not need to manually copy files out of the
2. Running the ROS bridge
rosrun polysync_ros_bridge BridgeNode -h Node Type is a required option all others are optional Options: Flag: Description: Default: -t Node Type -o PolySync Ok State Timing 1 -n Node Name Prefix ROS_Bridge -w Number of ROS Threads 1 -q ROS Queue Size 1 -p ROS Topic Prefix polysync -m Print available messages -h Prints help
A node type is equivalent to the message type name, for example
2.1 Enumerating available message types
The bridge node enumerates the supported messages that can be subscribed to on the PolySync Core side, and be translated to a complimentary ROS topic.
$ rosrun polysync_ros_bridge BridgeNode -m Available bridge messages are: ps_platform_cabin_report_msg ps_rnr_msg ps_file_transfer_msg ps_imu_accuracy_msg ps_parameters_msg ps_event_msg ps_platform_tire_pressure_report_msg ps_platform_motion_msg ps_radar_targets_msg ps_image_data_msg ps_platform_wheel_speed_report_msg psync_file_transfer_ext_msg_handler ps_objects_msg ps_platform_obd_msg ps_imu_msg ps_platform_suspension_report_msg ps_platform_surround_report_msg ps_zones_msg ps_gps_msg ps_file_msg ps_byte_array_msg ps_response_msg ps_lane_model_msg ps_platform_steering_report_msg ps_platform_throttle_report_msg ps_platform_brake_information_msg ps_traffic_sign_msg ps_lidar_points_msg ps_diagnostic_trace_msg ps_can_frame_msg ps_platform_steering_command_msg ps_platform_brake_report_msg ps_gps_accuracy_msg ps_platform_turn_signal_command_msg ps_sdf_state_msg psync-file-ext-msg-handler ps_platform_brake_command_msg ps_command_msg ps_manager_status_msg ps_platform_throttle_command_msg ps_platform_gear_command_msg ps_platform_cabin_ext_report_msg ps_platform_gear_report_msg ps_rnr_sessions_msg ps_platform_control_msg
2.2 Starting the bridge node
Open two terminals.
In the first terminal:
$ source ~/pdm/ros_bridge/setup.bash $ roscore
In the second terminal:
$ source ~/pdm/ros_bridge/setup.bash $ sudo service polysync-core-manager start $ rosrun polysync_ros_bridge BridgeNode -t ps_diagnostic_trace_msg
2017-08-17 13:51:02.08s DEBUG [ps_to_ros-] - build version 2.3.0-1502486752 2017-08-17 13:51:03.08s DEBUG [ps_to_ros-281475018373488] - created participant - GUID: 0x00010000027BB970 d(281475018373488) 2017-08-17 13:51:03.08s DEBUG [ps_to_ros-281475018373488] - message types visible to this node: 83 Spinning up a node of type: ps_diagnostic_trace_msg
3. Visualize the data
Assuming you’ve left the BridgeNode running from above, you can use
rostopic to see the visualize the data by opening a new terminal and running the following command:
rostopic echo /polysync/ps_diagnostic_trace_msg
4. Additonal resources
To see an example of how to utilize the ROS bridge, see this example from the PolySync Core C++ GitHub repo.