<launch>

  <!-- sick_line_guidance: configuration for two OLS20 devices (can node ids A and B) -->
  <arg name="yaml" default="sick_line_guidance_ols20_twin.yaml"/>
  <rosparam command="load" file="$(find sick_line_guidance)/$(arg yaml)" />                    <!-- Global CAN configuration two OLS20 devices (can node ids A and B) incl. link to eds-file -->
  
  <!-- sick_line_guidance: run canopen_chain_node -->
  <!-- to run sick_line_guidance_can_chain_node in gdb: add parameter launch-prefix="gdb -ex run - -args": -->
  <!-- node name="sick_line_guidance_can_chain_node" pkg="sick_line_guidance" type="sick_line_guidance_can_chain_node" launch-prefix="gdb -ex run - -args" output="screen" -->
  <node name="sick_line_guidance_can_chain_node" pkg="sick_line_guidance" type="sick_line_guidance_can_chain_node" output="screen" >
    <rosparam command="load" file="$(find sick_line_guidance)/$(arg yaml)" />                 <!-- Private CAN configuration for canopen_chain_node by ols or mls yaml-file -->
    <param name="diagnostic_topic" type="str" value="diagnostics" />                          <!-- ROS topic for diagnostic messages -->
  </node>

  <!-- sick_line_guidance: run sick_line_guidance_node, which implements the ROS driver for OLS and MLS -->
  <node name="sick_line_guidance_node" pkg="sick_line_guidance" type="sick_line_guidance_node" output="screen" >
    <param name="diagnostic_topic" type="str" value="diagnostics" />                           <!-- ROS topic for diagnostic messages -->
    <param name="can_connect_init_at_startup" type="bool" value="true" />                      <!-- Additional CAN configuration: if true, canopen services are initialized at startup -->
    <param name="initial_sensor_state" type="int" value="7" />                                 <!-- initial sensor states (f.e. 0x07 for 3 detected lines, or 8 to indicate sensor error) -->
    <param name="subscribe_queue_size" type="int" value="16" />                                <!-- buffer size for ros messages -->
    <param name="max_sdo_rate" type="double" value="100.0" />                                  <!-- max. sdo query and publish rate -->
    <param name="max_num_retries_after_sdo_error" type="int" value="2" />                      <!-- After SDO error, the SDO query is repeated max. N times (default: N=2). If the SDO error persists, the can driver is shutdown and restarted. -->
  </node>

  <!-- sick_line_guidance: cloud_publisher_node to convert OLS_Measurement messages of first OLS20 device (can node id A) to PointCloud2 (topic "cloudA", frame id "olsA_frame") -->
  <node name="sick_line_guidance_cloudA_publisher" pkg="sick_line_guidance" type="sick_line_guidance_cloud_publisher" output="screen" >
    <param name="mls_topic_publish" type="str" value="mlsA" />                                 <!-- MLS_Measurement data are published in topic "/mlsA" -->
    <param name="ols_topic_publish" type="str" value="olsA" />                                 <!-- OLS_Measurement data are published in topic "/olsA" -->
    <param name="cloud_topic_publish" type="str" value="cloudA" />                             <!-- sensor_msgs::PointCloud messages are published in topic "/cloudA" -->
    <param name="mls_cloud_frame_id" type="str" value="mlsA_frame" />                          <!-- MLS PointCloud data are published with frame id "mlsA_frame" -->
    <param name="ols_cloud_frame_id" type="str" value="olsA_frame" />                          <!-- OLS PointCloud data are published with frame id "olsA_frame" -->
    <param name="subscribe_queue_size" type="int" value="1" />                                 <!-- buffer size for ros messages -->
  </node>

  <!-- sick_line_guidance: cloud_publisher_node to convert OLS_Measurement messages of second OLS20 device (can node id B) to PointCloud2 (topic "cloudB", frame id "olsB_frame") -->
  <node name="sick_line_guidance_cloudB_publisher" pkg="sick_line_guidance" type="sick_line_guidance_cloud_publisher" output="screen" >
    <param name="mls_topic_publish" type="str" value="mlsB" />                                 <!-- MLS_Measurement data are published in topic "/mlsB" -->
    <param name="ols_topic_publish" type="str" value="olsB" />                                 <!-- OLS_Measurement data are published in topic "/olsB" -->
    <param name="cloud_topic_publish" type="str" value="cloudB" />                             <!-- sensor_msgs::PointCloud messages are published in topic "/cloudB" -->
    <param name="mls_cloud_frame_id" type="str" value="mlsB_frame" />                          <!-- MLS PointCloud data are published with frame id "mlsB_frame" -->
    <param name="ols_cloud_frame_id" type="str" value="olsB_frame" />                          <!-- OLS PointCloud data are published with frame id "olsB_frame" -->
    <param name="subscribe_queue_size" type="int" value="1" />                                 <!-- buffer size for ros messages -->
  </node>

</launch>
