Ask Your Question
0

Error in rviz displaying urdf model

asked 2016-07-13 09:39:18 -0600

patrchri gravatar image

updated 2016-07-13 09:42:17 -0600

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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-07-13 09:46:36 -0600

patrchri gravatar image

updated 2016-07-13 09:48:29 -0600

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...

edit flag offensive delete link more

Comments

yes you are right restarting solved my issue..thanks

suab123 gravatar imagesuab123 ( 2019-11-07 03:21:59 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-07-13 09:39:18 -0600

Seen: 481 times

Last updated: Jul 13 '16