<?xml version="1.0" encoding="utf-8"?>

<robot name="rm_gimbal"
  xmlns:xacro="http://ros.org/wiki/xacro">

  <xacro:arg name="xyz" default="0.10 0 0.05" />
  <xacro:arg name="rpy" default="0 0 0" />

  <link name="odom" />

  <link name="yaw_link" />

  <joint name="yaw_joint" type="continuous">
    <parent link="odom" />
    <child link="yaw_link" />
    <axis xyz="0 0 1" />
  </joint>

  <link name="pitch_link" />

  <joint name="pitch_joint" type="continuous">
    <parent link="yaw_link" />
    <child link="pitch_link" />
    <axis xyz="0 1 0" />
  </joint>

  <link name="camera_link" />

  <joint name="camera_joint" type="fixed">
    <origin xyz="$(arg xyz)" rpy="$(arg rpy)" />
    <parent link="pitch_link" />
    <child link="camera_link" />
    <axis xyz="0 0 0" />
  </joint>

  <link name="camera_optical_frame" />

  <joint name="camera_optical_joint" type="fixed">
    <origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}" />
    <parent link="camera_link" />
    <child link="camera_optical_frame" />
  </joint>

</robot>
