<?xml version="1.0" ?>
<launch>
  <arg name="sim" />
  <arg name="launch_rviz" default="true" />

  <!-- Load parameters -->
  <rosparam command="load" file="$(find active_grasp)/cfg/active_grasp.yaml" subst_value="true" />

  <!-- Launch MoveIt -->
  <node pkg="tf2_ros" type="static_transform_publisher" name="to_panda" args="0 0 0 0 0 0  world panda_link0" />
  <include file="$(find panda_moveit_config)/launch/move_group.launch">
    <arg name="transmission" value="position" />
  </include>

  <!-- Simulated environment -->
  <group if="$(arg sim)">
    <param name="robot_description" command="$(find xacro)/xacro $(find active_grasp)/assets/franka/panda_arm_hand.urdf.xacro" />
    <node pkg="active_grasp" type="bt_sim_node.py" name="bt_sim" output="screen" />
    <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" />
  </group>

  <!-- Real environment -->
  <group unless="$(arg sim)">
    <node pkg="active_grasp" type="hw_node.py" name="hw" output="screen" />
  </group>

  <!-- Launch rviz -->
  <node if="$(arg launch_rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(find active_grasp)/cfg/active_grasp.rviz" />
</launch>
