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

URDF not moving and not publishing tf on RViz using Robot_localization

asked 2019-05-30 15:24:35 -0600

RayROS gravatar image

Hello, I am using robot_localization to visualize in RViz my urdf moving according to the rosbag output files I prepared using robot_localization. robot_localization works, my rosbag works well and all the messages are being published/subscribed properly. It seems that everything works but when it comes to visualize my urdf moving on RViz that is not happening. I extensively studied robot_localization from the official website but I don't understand what the problem could be.

robot_localization is basically not publishing the transform and I think that because of that, I am able to see the model and the two reference frames, but I am not able to see it moving. So the usbl is the problem. I spent some days now trying to figure out the possible problem but have arrived to a dead end. If anyone can shed some light on this matter it would be great.

See below a print screen of what is happening in RVizbefore I apply the urdf model:

before

And after I add the model:

after

Below I am showing my urdf file:

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

    <!-- Material & Color  -->
    <material name="blue">
        <color rgba="0 0 0.8 1"/>
    </material>
    <material name="white">
        <color rgba="1 1 1 1"/>
    </material>
    <material name="black">
        <color rgba="0 0 0 1"/>
    </material>

<!-- Base Link Declaration  -->
    <link name="base_link">
        <visual>
            <geometry>
<!-- This is the main body of the float  -->
                <cylinder length="0.865" radius="0.09"/>
            </geometry>
            <material name="blue"/>
        </visual>
    </link>
<!-- usbl  -->
    <link name="usbl">
        <visual>
            <origin rpy="0 0 0" xyz="0 0.127 0.0508"/>
        </visual>
    </link>
    <joint name="base_to_usbl" type="fixed">
        <parent link="base_link"/>
        <child link="usbl"/>
        <origin xyz="0 0.22 0.25"/>
    </joint>
</robot>

float_localization.launch

<?xml version="1.0"?>
<launch>
<param name="use_sim_time" value="true" />

 <node pkg="tf" type="static_transform_publisher" name="link1_broadcaster"
 args="0 0 0 0 0 0 imu base_link 100" />

 <node pkg="robot_localization" type="ekf_localization_node"
     name="ekf_localization" clear_params="false">
    <param name="use_sim_time" value="true" />
    <param name="sensor_timeout" value="2.0"/>
    <param name="two_d_mode" value="true"/>
    <param name="map_frame" value="map"/>
    <param name="odom_frame" value="odom"/>
    <param name="base_link_frame" value="base_link"/>
    <param name="world_frame" value="map"/>
    <param name="publish_tf" value="true"/>
    <param name="frequency" value="100"/>

    <param name="odom0" value="/usbl/pose_projected"/>
    <rosparam param="odom0_config">[true,  true,  false,
                                   false, false, false,
                                   false, false, false,
                                   false, false, false,
                                   false, false, false]</rosparam>
    <param name="odom0_differential" value="false"/>

    <param name="imu0" value="/imu/data_w_orientation"/>
    <rosparam param="imu0_config">[false, false, false,
                                   true, true, true,
                                   false, false, false,
                                   true, true, true,
                                   true, true, true]</rosparam>
    <param name="imu0_differential" value="false"/>

    <param name="smooth_lagged_data" value="true"/>
  </node>
</launch>

floatModel_urdf.launch

<launch>

  <arg name="floatModel" default="$(find ros_float)/urdf/floatModel.urdf"/>
  <arg name="gui" default="true" />
  <arg name="rvizconfig" default="$(find ros_float)/rviz/urdf.rviz" />

  <param name="robot_description" command="$(find xacro)/xacro.py $(arg floatModel)" />
  <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="robot_state_publisher" />
  <node name="rviz" pkg="rviz" type="rviz" args ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-05-31 01:21:30 -0600

gvdhoorn gravatar image

updated 2019-05-31 01:23:02 -0600

<link name="usbl">
    <visual>
        <origin rpy="0 0 0" xyz="0 0.127 0.0508"/>
    </visual>
</link>

There is no geometry child of the visual element. This would seem to be a malformed urdf. That is most likely why you are getting that error Could not parse visual element for Link [usbl].

The geometry element is a required child of visual. Refer to wiki/urdf/XML/link - Elements.

edit flag offensive delete link more

Comments

Thanks gvdhoorn, that was exactly what happened. In case anyone needs, I fixed the error adding the following lines to my urdf model which solved the problem:

<link name="usbl">
    <visual>
        <geometry>
            <cylinder length="0.10" radius="0.015"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 0.127 0.0508"/>
        <material name="cyan"/>
    </visual>
</link>
RayROS gravatar image RayROS  ( 2019-05-31 10:07:09 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-05-30 15:24:35 -0600

Seen: 916 times

Last updated: May 31 '19