# how to generate urdf.rviz file

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 close merge delete ## 3 Answers Sort by » oldest newest most voted 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. 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! ( 2017-01-06 06:44:46 -0500 )edit 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>

more

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

( 2018-03-03 04:38:13 -0500 )edit

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.

more