Starting The ROS Bridge

PolySync messages can be transcribed to ROS topics at runtime. PolySync provides a toolchain to build and run a ROS bridge node, which acts as a bridge between the PolySync bus, and the ROS bus. The ROS bridge node can be generated against any PolySync data model using the PolySync provided `pdm-gen` tool. ### Building the ROS bridge ```bash $ echo $PSYNC_HOME /usr/local/polysync $ cd /usr/local/polysync $ source /opt/ros/jade/setup.bash $ pdm-gen -r modules/dtc/dtc.idl modules/sensor/sensor.idl modules/navigation/navigation.idl modules/control/control.idl ``` The `pdm-gen` tool creates all ROS resources (scripts, headers, libraries) along with a custom ROS topic for each PolySync 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 `pdm/` directory. Notable files: - pdm/ros_bridge/lib/libps_ros_bridge_library.so - pdm/ros_bridge/include/RosMessageCopy.h - pdm/ros_bridge/share/polysync_ros_bridge/BridgeNode ### Running the ROS bridge Print help: ```bash 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 `ps_gps_msg` or `ps_lidar_points_msg`. #### Enumerating available message types The bridge node enumerates the supported messages that can be subscribed to on the PolySync side, and be translated to a complimentary ROS topic. ```bash $ 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 ps_file_transfer_ext_msg 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 ps_file_ext_msg 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 ``` #### Starting the bridge node For each message type that needs to be transcribed from the PolySync bus to the ROS bus, pass in the `-t` flag and the message names. ```bash $ source /usr/local/polysync/pdm/ros_bridge/setup.bash $ roscore $ polysync-manager $ rosrun polysync_ros_bridge BridgeNode -t ps_objects_msg ```