Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ar_track_alvar output frame issue

Hi guys i need your help. I try to use ar_track_alvar to detect an ar_tag on gazebo sim using a simulated camera.

Here there is my urdf file of the robot:

<?xml version="1.0"?>

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

  <xacro:property name="M_PI" value="3.1415926535897931" />


    <link name="camera_link">

      <collision>
        <origin xyz="0 0 0" rpy="0 0 0" />
        <geometry>
          <box size="0.2 0.2 0.2"/>
        </geometry>
      </collision>

      <visual>
        <origin xyz="0 0 0" rpy="0 0 0" />
        <geometry>
          <box size="0.2 0.2 0.2"/>
        </geometry>
        <material name="grey">
            <color rgba="0.2 0.2 0.2 1.0"/>
        </material>
      </visual>


      <inertial>
        <mass value="0.001" />
        <origin xyz="0 0 0" rpy="0 0 0" />
        <inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001" />
      </inertial>

    </link>

  <!-- camera -->
  <gazebo reference="camera_link">
    <sensor type="camera" name="camera1">
      <update_rate>30.0</update_rate>
      <camera name="head">
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>
          <!-- Noise is sampled independently per pixel on each frame.
               That pixel's noise value is added to each of its color
               channels, which at that point lie in the range [0,1]. -->
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>
      </camera>
      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>rrbot/camera1</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

</robot>

And here my launch file

<?xml version="1.0" ?>

<launch>

  <arg name="x_robot" default="0.0"/>
  <arg name="y_robot" default="0.0"/>
  <arg name="z_robot" default="0.0"/>
  <arg name="tf_prefix" default="$(optenv ROS_NAMESPACE)"/>

  <arg name="marker_size" default="30.0" />
    <arg name="max_new_marker_error" default="0.08" />
    <arg name="max_track_error" default="0.2" />
    <arg name="cam_image_topic" default="/robot/rrbot/camera1/image_raw" />
    <arg name="cam_info_topic" default="/robot/rrbot/camera1/camera_info" />
    <arg name="output_frame" default="/camera_link" />

  <!-- Init Gazebo -->
  <include file="$(find gazebo_ros)/launch/empty_world.launch"/>

  <group ns="robot">
    <!-- Include the robot.urdf file -->
    <param name="robot_description" command="$(find xacro)/xacro.py $(find robot_simulation)/urdf/robot.urdf.xacro"/>

    <!-- Spawn the robot into gazebo -->
    <node name="spawn_robot" pkg="gazebo_ros" type="spawn_model"
            args="-param robot_description
                  -urdf
                  -x $(arg x_robot)
                  -y $(arg y_robot)
                  -z $(arg z_robot)
                  -model my_robot"
            respawn="false" output="screen" />
  </group>

  <group ns="tag">
    <!-- Include the robot.urdf file -->
    <param name="ar_tag_gazebo" command="$(find xacro)/xacro.py $(find robot_simulation)/urdf/ar_tag.urdf.xacro"/>

    <!-- Spawn the robot into gazebo -->
    <node name="spawn_tag" pkg="gazebo_ros" type="spawn_model"
            args="-param ar_tag_gazebo
                  -urdf
                  -x 0.0
                  -y 0.5
                  -z 0.5
            -R 1.57
            -P 0.0
            -Y 0.0
                  -model ar_gazebo"
            respawn="false" output="screen" />
  </group>

  <node name="ar_track_alvar" pkg="ar_track_alvar" type="individualMarkersNoKinect" respawn="false" output="screen">
        <param name="marker_size"           type="double" value="$(arg marker_size)" />
        <param name="max_new_marker_error"  type="double" value="$(arg max_new_marker_error)" />
        <param name="max_track_error"       type="double" value="$(arg max_track_error)" />
        <param name="output_frame"          type="string" value="$(arg output_frame)" />

        <remap from="camera_image"  to="$(arg cam_image_topic)" />
        <remap from="camera_info"   to="$(arg cam_info_topic)" />
    </node>

  <param name="tf_prefix" type="string" value="$(arg tf_prefix)" />

</launch>

When i launch it i obtain the following error:

[ERROR] [1566748744.446264644, 2.572000000]: "camera_link" passed to lookupTransform argument target_frame does not exist.

I don't understand where is the error but i think there is some problem using the output frame argument.

Please help me!

Thank you in advance.