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

how to generate urdf.rviz file

asked 2017-01-06 06:20:14 -0600

shawnysh gravatar image

I am curious about how to generate the urdf.rviz file, since I have seen a lot of tutorials using urdf.rviz file when loading urdf to rviz.

It just happened but they did not explain how we can derive a urdf.rviz file by our own, without which we can not use below code in launch file:

<node name="rviz" pkg="rviz" type="rviz" args="-d $(find urdf_tutorial)/urdf.rviz" required="true" />

Instead, I have to rosrun a rviz instance and add a robotmodel mannually

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2017-01-06 06:40:32 -0600

NEngelhard gravatar image

updated 2018-02-28 01:43:46 -0600

urdf.rviz is just an configuration file that is not generated automatically. The easiest way to generate these files is to open RVIZ, add some panels and save the resulting configuration. It's only about personal preferences so that there isn't really a way to generate or derive .rviz files.

edit flag offensive delete link more

Comments

Thanks for your answer, it helps. I thought the rviz config file is related to the urdf file, so I wanted to find a way to generate it and use it in launch file. Now I know it really does not matter but a config for rviz . Thanks again!

shawnysh gravatar image shawnysh  ( 2017-01-06 06:44:46 -0600 )edit
1

answered 2018-03-02 17:55:31 -0600

Gayan Brahmanage gravatar image

Start with the following example:

<robot name="robot">

<link name="base_link">
  <inertial>
    <mass value="1"/>
    <inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
    <origin/>
  </inertial>
  <visual>
    <origin xyz="0.1 0 0.125" />
    <geometry>
        <box size=".50 .50 .250" />
    </geometry>
    <material name="red">
      <color rgba="1 0.47 0.13 1" />
    </material>
  </visual>

  <collision>
    <origin xyz="0.1 0 0.125" />
    <geometry>
      <box size=".50 .250 .50" />
    </geometry>
    <contact_coefficients mu="0" kp="1000.0" kd="1.0"/>
  </collision>
</link>

save this as robot_model.xml

use following launch file with robot_state_publisher

<launch>
        <param name="robot_description" command="cat $(find package_name)/robot_model.xml" />
        <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />           
</launch>
edit flag offensive delete link more

Comments

1

+1 for making the effort to put together an example, but the OP asks how to 'generate' an RViz configuration file. Not a urdf file.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-03 04:38:13 -0600 )edit
0

answered 2017-01-06 06:41:34 -0600

shawnysh gravatar image

I think I find the answer: In rviz/UserGuide

click ctrl+f and type, save a config

from here, I get a clue that I can save a rviz config on my own and copy it to the src folder in my own package. After having done this, I can use the code I mentioned in my question in the launch file.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-06 06:20:14 -0600

Seen: 3,371 times

Last updated: Mar 02 '18