ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Hokuyo doesn't publish a frame,Error: Ingoring transform for child_frame_id "laser_2"...

asked 2019-10-31 03:23:23 -0500

wallybeam gravatar image

updated 2019-10-31 04:38:47 -0500

Delb gravatar image

I am using Ubuntu 16.04 and ROS Kinetic. I am trying to visualize two lidar data on rviz at the same time. I connected to the lidars by using following launch file.

<launch>
<master auto="start"/>
<node name="urg1" pkg="urg_node" type="urg_node">
    <param name="ip_address" value="192.168.1.10" />
    <remap from="scan" to="/scan1" />
    <param name="frame_id" type="string" value="laser_1" />
</node>


<node name="urg2" pkg="urg_node" type="urg_node">
    <param name="ip_address" value="192.168.1.11" />
    <remap from="scan" to="/scan2" />
    <param name="frame_id" type="string" value="laser_2" />
</node>

</launch>

After I run the launch file above, I checked published topics by using rostopic list

/diagnostics
/laser_status
/rosout
/rosout_agg
/scan1
/scan2
/urg1/parameter_descriptions
/urg1/parameter_updates
/urg2/parameter_descriptions
/urg2/parameter_updates

After that I checked published frames by using rosrun tf tf_monitor. The result is empty.

RESULTS: for all Frames
Frames:
All Broadcasters:

Finally I run my second launch file to create a TF tree and run rviz which is given bellow:

<?xml version="1.0"?> 
<launch>  
    <arg name="model"/>  
    <arg name="gui" default="false"/>   
    <arg name="rvizconfig" default="$(find model)/rviz/urdf.rviz"/>

    <param name="robot_description" command="$(find xacro)/xacro.py $(find model)/urdf/$(arg model)"/>   
    <param name="use_gui" value="$(arg gui)"/>

    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/>
    <node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0 0 0 0 0 0 0 base_link laser_1 100" />
     <node pkg="tf" type="static_transform_publisher" name="link2_broadcaster" args="0 0 0 0 0 0 0 hokuyo_2 laser_2 100" />
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true"/>

</launch>

I give my URDF file as input. The URDF file is given bellow:

    <?xml version="1.0" ?>
<robot name="agv">

  <material name="red">
    <color rgba="0.8 0 0 1"/>
  </material>
  <material name="black">
    <color rgba="0 0 0 1"/>
  </material>

  <!-- Base link -->
  <link name="base_link">
    <visual>
      <geometry>
        <box size="1.54 1.05 0.3"/>
      </geometry>
      <material name="red"/>
    </visual>
    <collision>
      <geometry>
        <box size="1.54 1.05 0.3"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="150"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0"
               iyy="1.0" iyz="0.0"
               izz="1.0"/>
    </inertial>
  </link>

  <!-- Wheels -->
  <link name="right_wheel_1">
    <visual>
      <geometry>
        <cylinder radius="0.1" length="0.05"/>
      </geometry>
      <material name="black"/>
      <origin xyz="0 0 0" rpy="0 1.57 1.57"/>
    </visual>
    <collision>
      <geometry>
        <cylinder radius="0.1" length="0.05"/>
      </geometry>
      <origin xyz="0 0 0" rpy="0 1.57 1.57"/>
    </collision>
    <inertial>
      <mass value="5"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0"
               iyy="1.0" iyz="0.0"
               izz ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-10-31 04:45:27 -0500

Delb gravatar image

You error comes from your second launch file :

<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0 0 0 0 0 0 0 base_link laser_1 100" />
<node pkg="tf" type="static_transform_publisher" name="link2_broadcaster" args="0 0 0 0 0 0 0 hokuyo_2 laser_2 100" />

Here you specify as arguments 7 zeros meaning you define the position and orientation using 3 postion coordiantes and a quaternion : {x; y; z; q_x; q_y; q_z; q_w}. The problem is that a default quaternion is not 4 zeros but the field q_w has to be set to 1. (Here is an online visualizer for quaternions that I find really useful).

So you have two options :

  • Propperly initialize your two quaternions :

    <node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0 0 0 0 0 0 1 base_link laser_1 100" />
    <node pkg="tf" type="static_transform_publisher" name="link2_broadcaster" args="0 0 0 0 0 0 1 hokuyo_2 laser_2 100" />
    
  • Change the argument and use roll, pitch and yaw instead of a quaternion arguments are then {x; y; z; roll; pitch; yaw} :

    <node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0 0 0 0 0 0 base_link laser_1 100" />
    <node pkg="tf" type="static_transform_publisher" name="link2_broadcaster" args="0 0 0 0 0 0 hokuyo_2 laser_2 100" />
    
edit flag offensive delete link more

Comments

Great visualizer, perfect explanation and answer. Thanks a lot

wallybeam gravatar image wallybeam  ( 2019-10-31 07:04:05 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-10-31 03:23:23 -0500

Seen: 150 times

Last updated: Oct 31 '19