Robotics StackExchange | Archived questions

Problems visualizing robotmodel and tf's of urdf model in rviz

Hi! I have build my own robot on sketchup, created an urdf file for it with plugins for the laser (libgazeboroslaser.so) and for the odometry (libgazeborosp3d.so) and i'm simulating an navigation with it in gazebo. Until here it's almost 100% correct...

I run rviz to visualize what is happening with the sensors, tf's, etc... I just run rviz in command line and then i add what i need in the left bar (tf's, LaserScan, RobotModel and map).

Problems:

1 - i can't see correctly the tf's of my robot that are "continuous";

2 - i can't see the robot model

I think i' having this problem due to the type of the joints that are "continuous", but i have to use this for the odometry plugin for gazebo. Maybe is some problem on the jointstatepublisher, i don't know.

Do i have to create any kind of a launch file to launch rviz with jointstatepublisher too, just like for gazebo?

And why can't i see the RobotModel in rviz for my model, even if the joints are fixed? Maybe because it was designed in Sketchup?

Here is my model in urdf.

<?xml version="1.0"?>

<!--Links -->

<link name="base_footprint"/>

<link name="base_link">
     <visual>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <mesh filename="package://navigation_robot/meshes/guide_robot.dae"/>
      </geometry>
    </visual>

    <collision>
        <origin rpy="0 0 0" xyz="0 0 0"/>
        <geometry>
            <mesh filename="package://navigation_robot/meshes/guide_robot.dae"/>
        </geometry>
    </collision>

    <inertial>
        <mass value="15.0"/>
        <origin xyz="0 0 0"/>
        <inertia ixx="1.7" ixy="0" ixz="0" iyy="0.9" iyz="0" izz="1.7" />
    </inertial>

</link>

    <link name="left_wheel_link">

    <visual>
        <origin rpy="0 0 0" xyz="0 0 0"/>
        <geometry>
            <mesh filename="package://navigation_robot/meshes/left_wheel.dae"/>
        </geometry>
    </visual>

    <collision>
      <origin rpy="1.5707963 0 0" xyz="0 0.055 0"/>
      <geometry>
        <cylinder length="0.02" radius="0.08"/>
      </geometry>
    </collision>

    <inertial>
      <mass value="2.0"/>
      <origin xyz="0 0 0"/>
          <inertia ixx="0.003266" ixy="0.0" ixz="0.0" iyy="0.003266" iyz="0.0" izz="0.00064"/>
    </inertial>

</link>

<link name="right_wheel_link">

    <visual>
        <origin rpy="0 0 0" xyz="0 0 0"/>
        <geometry>
            <mesh filename="package://navigation_robot/meshes/right_wheel.dae"/>
        </geometry>
    </visual>

    <collision>
      <origin rpy="1.5707963 0 0" xyz="0 -0.055 0"/>
      <geometry>
        <cylinder length="0.02" radius="0.08"/>
      </geometry>
    </collision>

    <inertial>
      <mass value="1.0"/>
      <origin xyz="0 0 0"/>
      <inertia ixx="0.003266" ixy="0.0" ixz="0.0" iyy="0.003266" iyz="0.0" izz="0.00064"/>
    </inertial>

</link>


<link name="caster_support_link">

    <visual>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <mesh filename="package://navigation_robot/meshes/caster_support.dae"/>
      </geometry>
    </visual>

    <collision>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <mesh filename="package://navigation_robot/meshes/caster_support.dae"/>
      </geometry>
    </collision>

    <inertial>
      <mass value="0.181436948"/>
      <origin xyz="0 0 0"/>
      <inertia ixx="0.0109375" ixy="0.0" ixz="0.0" iyy="0.021125" iyz="0.0" izz="0.0109375"/>
    </inertial>

</link>

<link name="caster_wheel_link">

    <visual>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <mesh filename="package://navigation_robot/meshes/caster_wheel.dae"/>
      </geometry>
    </visual>

    <collision>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <mesh filename="package://navigation_robot/meshes/caster_wheel.dae"/>
      </geometry>
    </collision>

    <inertial>
      <mass value="0.181436948"/>
      <origin xyz="0 0 0"/>
      <inertia ixx="0.0109375" ixy="0.0" ixz="0.0" iyy="0.021125" iyz="0.0" izz="0.0109375"/>
    </inertial>

</link>

<!-- Hokuyo Laser -->

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
           <mesh filename="package://navigation_robot/meshes/hokuyo.dae"/>
      </geometry>
    </visual>

    <inertial>
      <mass value="1e-5" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
    </inertial>
</link>

<!--Joints -->

<joint name="left_wheel_joint" type="continuous">
    <axis xyz="0 1 0"/>
    <origin rpy="0 0 0" xyz="0.16 0.25 0.04"/>
    <anchor xyz="0 0 0"/>
    <limit effort="100" velocity="100"/>
    <joint_properties damping="0" friction="0"/>
    <parent link="base_link"/>
    <child link="left_wheel_link"/>
</joint>

<joint name="right_wheel_joint" type="continuous">
    <axis xyz="0 1 0"/>
    <origin rpy="0 0 0" xyz="0.16 -0.23 0.04"/>
    <anchor xyz="0 0 0"/>
    <limit effort="100" velocity="100"/>
    <joint_properties damping="0" friction="0"/>
    <parent link="base_link"/>
    <child link="right_wheel_link"/>
</joint>

<joint name="caster_support_joint" type="continuous">
    <axis xyz="0 0 1"/>
    <origin rpy="0 0 3.1415926" xyz="-0.275 0 0.06"/>
    <anchor xyz="0 0 0"/>
    <limit effort="100" velocity="100"/>
    <joint_properties damping="0.0" friction="0.0"/>
    <parent link="base_link"/>
    <child link="caster_support_link"/>
</joint>

<joint name="caster_wheel_joint" type="continuous">
    <axis xyz="0 1 0"/>
    <origin rpy="0 0 0" xyz="0.03 0 -0.06"/>
    <anchor xyz="0 0 0"/>
    <limit effort="100" velocity="100"/>
    <joint_properties damping="0.0" friction="0.0"/>
    <parent link="caster_support_link"/>
    <child link="caster_wheel_link"/>
</joint>



<joint name="hokuyo_joint" type="fixed">
    <axis xyz="0 0 1" />
    <origin xyz="0.24 0 0.27" rpy="0 0 0"/>
    <parent link="base_link"/>
    <child link="hokuyo_link"/>
</joint>

<joint name="base_joint" type="fixed">
        <origin rpy="0 0 0" xyz="0 0 0.035"/>
        <anchor xyz="0 0 0"/>
        <parent link="base_footprint"/>
        <child link="base_link"/>
</joint>

-- GAZEBO

<gazebo>
    <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>100.0</updateRate>
        <leftJoint>left_wheel_joint</leftJoint>
        <rightJoint>right_wheel_joint</rightJoint>
        <wheelSeparation>0.59</wheelSeparation>
        <wheelDiameter>0.16</wheelDiameter>

        <commandTopic>cmd_vel</commandTopic>
        <odometryTopic>odom</odometryTopic>
        <odometryFrame>odom</odometryFrame>
        <robotBaseFrame>base_link</robotBaseFrame>

        <publishWheelTF>false</publishWheelTF>
        <publishWheelJointState>true</publishWheelJointState>
        <wheelAcceleration>0</wheelAcceleration>
        <wheelTorque>10</wheelTorque>
    </plugin>


    <plugin name="ground_truth" filename="libgazebo_ros_p3d.so">
        <frameName>map</frameName>
        <bodyName>base_link</bodyName>
        <topicName>robot_pose</topicName>
        <updateRate>100.0</updateRate>
    </plugin>

</gazebo> 

<gazebo reference="hokuyo_link">
<sensor type="ray" name="laser">
  <pose>0 0 0 0 0 0</pose>
  <visualize>true</visualize>
  <update_rate>40</update_rate>
  <ray>
    <scan>
      <horizontal>
        <samples>720</samples>
        <resolution>1</resolution>
        <min_angle>-1.5708</min_angle>
        <max_angle>1.5708</max_angle>
      </horizontal>
    </scan>
    <range>
      <min>0.10</min>
      <max>30.0</max>
      <resolution>0.01</resolution>
    </range>
    <noise>
      <type>gaussian</type>
      <!-- Noise parameters based on published spec for Hokuyo laser
           achieving "+-30mm" accuracy at range < 10m.  A mean of 0.0m and
           stddev of 0.01m will put 99.7% of samples within 0.03m of the true reading.-->
      <mean>0.0</mean>
      <stddev>0.01</stddev>
    </noise>
  </ray>
  <plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
    <topicName>/scan</topicName>
    <frameName>hokuyo_link</frameName>
  </plugin> 
</sensor>

Asked by andrefc on 2015-11-19 12:52:37 UTC

Comments

Could you provide your robot model? Maybe this helps to reproduce your issue.

Asked by Sabrina on 2015-11-20 10:55:01 UTC

here it is...

Asked by andrefc on 2015-11-20 12:37:30 UTC

Any errors or warnings on the terminal when you run rviz?

Asked by Akif on 2015-11-20 12:45:55 UTC

no, there are no errors... even in gazebo i got no errors

Asked by andrefc on 2015-11-20 13:20:14 UTC

Answers

Deleting the base_footprint link and the joint for base_link and base_footprint as well as changing parameters for the gazebo plugin referred to the odometry, seems to solve the problem. Thank you all ;-)

Asked by andrefc on 2015-11-20 15:03:11 UTC

Comments

Glad you figured it out.

Asked by Akif on 2015-11-23 06:59:35 UTC