<?xml version="1.0"?>

<launch>
  <arg name="model"            default="$(find xacro)/xacro '$(find tsukuba2022)/urdf/orange2022.xacro'" />
  <arg name="cmd_vel"          default="cmd_vel"/>
  <arg name="motor_driver_dev" default="/dev/ZLAC8015D"/>
  <arg name="estop_dev"        default="/dev/E-Stop"/>
  <arg name="debug"            default="true"/>
  
  
  <param name="robot_description" command="$(arg model)"/>
  
  
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="false" output="screen"/>
    
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="use_gui" value="true"/>
    <param name="rate"    value="50"/>
  </node>
    
  
  <include file="$(find zlac8015d_ros)/launch/motor_driver_node.launch">
    <arg name="port"                value="$(arg motor_driver_dev)"/>
    <arg name="estop_port"          value="$(arg estop_dev)"/>
    <!--# Control mode
    # 1: relative position control mode
    # Default: Subscribe to "/zlac8015d/pos/cmd_deg" and "/zlac8015d/pos/cmd_dist"
    # 3: Speed rpm control mode
    # Default: Subscribe to "/zlac8015d/twist/cmd_vel", "/zlac8015d/vel/cmd_vel" and "/zlac8015d/vel/cmd_rpm"-->
    <arg name="control_mode"        value="3"/>
    <arg name="twist_cmd_vel_topic" value="$(arg cmd_vel)"/>
    <arg name="debug"               value="$(arg debug)"/>
    <arg name="publish_TF"          value="true"/>
    <arg name="TF_child_frame"      value="base_footprint"/>
    <arg name="publish_odom"        value="true"/>
    <arg name="odom_child_frame"    value="base_footprint"/>
    <arg name="output"              value="screen"/>
  </include>
</launch>
