0
$\begingroup$

Rosanswers logo

Hello,

I am trying to create a simple 4 wheel robot with a camera and I have written this code for the urdf model:

<robot name="labrob">
  <!-- Base link -->
  <link name="base_link">
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
          <box size="1 0.5 0.25"/>
      </geometry>
      <material name="yellow">
        <color rgba="0.8 0.8 0 1"/>
      </material>
    </visual>
  </link>
  <!-- Front Right Wheel -->
  <link name="f_r_wheel">
    <visual>
      <origin xyz="0 0 0" rpy="1.570795 0 0" />
      <geometry>
          <cylinder length="0.1" radius="0.2" />
      </geometry>
      <material name="black">
        <color rgba="0.05 0.05 0.05 1"/>
      </material>
    </visual>
  </link>
  <joint name="joint_f_r_wheel" type="continuous">
    <parent link="base_link"/>
    <child link="f_r_wheel"/>
    <origin xyz="0.25 -0.30 0" rpy="0 0 0" /> 
    <axis xyz="0 1 0" rpy="0 0 0" />
  </joint>  
  <!-- Back Right Wheel -->
  <link name="b_r_wheel">
    <visual>
      <origin xyz="0 0 0" rpy="1.570795 0 0" />
      <geometry>
          <cylinder length="0.1" radius="0.2" />
      </geometry>
      <material name="black"/>
    </visual>
  </link>
  <joint name="joint_b_r_wheel" type="continuous">
    <parent link="base_link"/>
    <child link="b_r_wheel"/>
    <origin xyz="-0.25 -0.30 0" rpy="0 0 0" /> 
    <axis xyz="0 1 0" rpy="0 0 0" />
  </joint>  
  <!-- Front Left Wheel -->
  <link name="f_l_wheel">
    <visual>
      <origin xyz="0 0 0" rpy="1.570795 0 0" />
      <geometry>
          <cylinder length="0.1" radius="0.2" />
      </geometry>
      <material name="black"/>
    </visual>
  </link>
  <joint name="joint_f_l_wheel" type="continuous">
    <parent link="base_link"/>
    <child link="f_l_wheel"/>
    <origin xyz="0.25 0.30 0" rpy="0 0 0" /> 
    <axis xyz="0 1 0" rpy="0 0 0" />
  </joint>
  <!-- Back Left Wheel -->
  <link name="b_l_wheel">
    <visual>
      <origin xyz="0 0 0" rpy="1.570795 0 0" />
      <geometry>
          <cylinder length="0.1" radius="0.2" />
      </geometry>
      <material name="black"/>
    </visual>
  </link>
  <joint name="joint_b_l_wheel" type="continuous">
    <parent link="base_link"/>
    <child link="b_l_wheel"/>
    <origin xyz="-0.25 0.30 0" rpy="0 0 0" /> 
    <axis xyz="0 1 0" rpy="0 0 0" />
  </joint>


</robot>

As you can read I haven't put yet the camera or the trasmission blocks. I just have written the basic structure of the model with the joints. I have also written this .launch file:

<launch>
  <!-- urdf xml robot description loaded on the Parameter Server-->
  <param name="robot_description" textfile="$(find labrob_description)/urdf/labrob.urdf" />
  <arg name="gui" default="true" />
  <arg name="rvizconfig" default="$(find labrob_description)/rviz/urdf.rviz" />


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

  <!-- source that publishes the joint positions as a sensor_msgs/JointState -->
  <param name="use_gui" value="true"/>
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
 
 
  <!-- publish all the frames to TF -->
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="rob_st_pub" >
  <param name="publish_frequency" value="50"/> <!-- Hz -->
  </node>


  <!-- robot visualization -->
  <node name="rviz" pkg="rviz" args="-d $(arg rvizconfig)" type="rviz" required="true" />
</launch>

In this launch file I am trying to display my model in the rviz environment. Via the launch file I call a .rviz configuration file which is this one:

Panels:
  - Class: rviz/Displays
    Help Height: 78
    Name: Displays
    Property Tree Widget:
      Expanded:
        - /Global Options1
        - /Status1
        - /RobotModel1
        - /TF1
      Splitter Ratio: 0.5
    Tree Height: 557
  - Class: rviz/Selection
    Name: Selection
  - Class: rviz/Tool Properties
    Expanded:
      - /2D Pose Estimate1
      - /2D Nav Goal1
      - /Publish Point1
    Name: Tool Properties
    Splitter Ratio: 0.588679
  - Class: rviz/Views
    Expanded:
      - /Current View1
    Name: Views
    Splitter Ratio: 0.5
  - Class: rviz/Time
    Experimental: false
    Name: Time
    SyncMode: 0
    SyncSource: ""
Visualization Manager:
  Class: ""
  Displays:
    - Alpha: 0.5
      Cell Size: 1
      Class: rviz/Grid
      Color: 160; 160; 164
      Enabled: true
      Line Style:
        Line Width: 0.03
        Value: Lines
      Name: Grid
      Normal Cell Count: 0
      Offset:
        X: 0
        Y: 0
        Z: 0
      Plane: XY
      Plane Cell Count: 10
      Reference Frame: <Fixed Frame>
      Value: true
    - Alpha: 0.5
      Class: rviz/RobotModel
      Collision Enabled: false
      Enabled: true
      Links:
        All Links Enabled: true
        Expand Joint Details: false
        Expand Link Details: false
        Expand Tree: false
        Link Tree Style: Links in Alphabetic Order
        base_link:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
        right_leg:
          Alpha: 1
          Show Axes: false
          Show Trail: false
          Value: true
      Name: RobotModel
      Robot Description: robot_description
      TF Prefix: ""
      Update Interval: 0
      Value: true
      Visual Enabled: true
    - Class: rviz/TF
      Enabled: true
      Frame Timeout: 15
      Frames:
        All Enabled: true
        base_link:
          Value: true
        right_leg:
          Value: true
      Marker Scale: 0.5
      Name: TF
      Show Arrows: true
      Show Axes: true
      Show Names: true
      Tree:
        base_link:
          right_leg:
            {}
      Update Interval: 0
      Value: true
  Enabled: true
  Global Options:
    Background Color: 48; 48; 48
    Fixed Frame: base_link
    Frame Rate: 30
  Name: root
  Tools:
    - Class: rviz/Interact
      Hide Inactive Objects: true
    - Class: rviz/MoveCamera
    - Class: rviz/Select
    - Class: rviz/FocusCamera
    - Class: rviz/Measure
    - Class: rviz/SetInitialPose
      Topic: /initialpose
    - Class: rviz/SetGoal
      Topic: /move_base_simple/goal
    - Class: rviz/PublishPoint
      Single click: true
      Topic: /clicked_point
  Value: true
  Views:
    Current:
      Class: rviz/Orbit
      Distance: 4.48689
      Enable Stereo Rendering:
        Stereo Eye Separation: 0.06
        Stereo Focal Distance: 1
        Swap Stereo Eyes: false
        Value: false
      Focal Point:
        X: 0
        Y: 0
        Z: 0
      Name: Current View
      Near Clip Distance: 0.01
      Pitch: 0.695397
      Target Frame: <Fixed Frame>
      Value: Orbit (rviz)
      Yaw: 0.513582
    Saved: ~
Window Geometry:
  Displays:
    collapsed: false
  Height: 882
  Hide Left Dock: false
  Hide Right Dock: false
  QMainWindow State: 000000ff00000000fd00000004000000000000013c000002c3fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006400fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730100000043000002c3000000de00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002c3fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730100000043000002c3000000b800fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004c000000044fc0100000002fb0000000800540069006d00650100000000000004c00000025800fffffffb0000000800540069006d0065010000000000000450000000000000000000000269000002c300000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
  Selection:
    collapsed: false
  Time:
    collapsed: false
  Tool Properties:
    collapsed: false
  Views:
    collapsed: false
  Width: 1216
  X: 17
  Y: 28

The result of the roslaunch of the launch file of this package is a urdf model entirely wrong. On the left side panel under "Displays" I see the following:

  • Global Status (with a Warning) > Fixed Frame (with a Warning) --> No tf data. Actual error: Fixed Frame [base_link] does not exist
  • RobotModel (with Error) > Status:Error --> URDF (URDF parsed OK) b_l_wheel (with Error: No transform from [b_l_wheel] to [base_link]) b_r_wheel (with Error: No transform from [b_r_wheel] to [base_link]) base_link (Transform OK) f_l_wheel (with Error: No transform from [f_l_wheel] to [base_link]) f_r_wheel (with Error: No transform from [f_r_wheel] to [base_link])

I can also see the "TF" Display without Errors and with a tick.

I checked another similar answer, but it didn't help me. I also need to mention that I tried to use the display.launch from the urdf tutorials but the error still occurs.

Thank you for your time and your answers in advance.


Originally posted by patrchri on ROS Answers with karma: 354 on 2016-07-13

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I exited roscore, closed the terminal (I didn't change anything during that) and reopened it and it worked and showed my model correctly... I don't know what went wrong...


Originally posted by patrchri with karma: 354 on 2016-07-13

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by suab123 on 2019-11-07:
yes you are right restarting solved my issue..thanks

Comment by sree on 2020-08-08:
Sir I am facing with same issue .I have placed 8 sonar sensors around the turtlebot.its launching succesfully on gazebo but while launching on rviz it is showing error

[ERROR] [1596911402.861785142]: Failed to build tree: parent link [base_footprint] of joint [sonar_front_joint] not found. This is not valid according to the URDF spec. Every link you refer to from a joint needs to be explicitly defined in the robot description. To fix this problem you can either remove this joint [sonar_front_joint] from your urdf file, or add "" to your urdf file. [robot_state_publisher-2] process has died [pid 15687, exit code 255, cmd /opt/ros/kinetic/lib/robot_state_publisher/state_publisher __name:=robot_state_publisher __log:=/home/lekhasree/.ros/log/28d6ed84-d9a5-11ea-9c76-37d291b527b9/robot_state_publisher-2.log]. log file: /home/lekhasree/.ros/log/28d6ed84-d9a5-11ea-9c76-37d291b527b9/robot_state_publisher-2*.log

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.