<launch>
    <arg name="fcu_conn" default="usb"/>
    <arg name="fcu_ip" default="127.0.0.1"/>
    <arg name="fcu_sys_id" default="1"/>
    <arg name="gcs_bridge" default="tcp"/>
    <arg name="rangefinder_vl53l1x" default="true"/>
    <arg name="led" default="true"/>

    <!-- log formatting -->
    <env name="ROSCONSOLE_FORMAT" value="[${severity}] [${time}]: ${logger}: ${message}"/>

    <!-- mavros -->
    <include file="$(find clover)/launch/mavros.launch">
        <arg name="fcu_conn" value="$(arg fcu_conn)"/>
        <arg name="fcu_ip" value="$(arg fcu_ip)"/>
        <arg name="gcs_bridge" value="$(arg gcs_bridge)"/>
    </include>

    <!-- main nodelet manager -->
    <node pkg="nodelet" type="nodelet" name="nodelet_manager" args="manager" output="screen" clear_params="true">
        <param name="num_worker_threads" value="2"/>
    </node>

    <node pkg="tf2_ros" type="static_transform_publisher" name="map_flipped_frame" args="0 0 0 3.1415926 3.1415926 0 map map_flipped"/>

    <!-- simplified offboard control -->
    <node name="simple_offboard" pkg="clover" type="simple_offboard" output="screen" clear_params="true">
        <param name="reference_frames/body" value="map"/>
        <param name="reference_frames/base_link" value="map"/>
        <param name="reference_frames/navigate_target" value="map"/>
    </node>

    <!-- vl53l1x ToF rangefinder -->
    <node name="rangefinder" pkg="vl53l1x" type="vl53l1x_node" output="screen" if="$(arg rangefinder_vl53l1x)">
        <param name="frame_id" value="rangefinder"/>
        <param name="min_signal" value="0.4"/>
        <param name="pass_statuses" type="yaml" value="[0, 6, 7, 11]"/>
    </node>

    <!-- led strip -->
    <include file="$(find clover)/launch/led.launch" if="$(arg led)"/>

</launch>
