supported file format for rviz2 besides .dae?
Hello,
I am able to successfully render a model .dae file in rviz2 with my urdf as such:
<robot name="diff_bot">
<link name="base_link">
<visual>
<origin xyz="0.0 0.0 0.0"/>
<geometry>
<mesh filename="package://model_pkg/models/urdfmodel-BodyBase.dae"/>
</geometry>
</visual>
</link>
</robot>
using the following launch file:
from launch import LaunchDescription
from launch_ros.actions import Node
import ament_index_python
package_name = 'model_pkg'
share_directory = ament_index_python.packages.get_package_share_directory(package_name)
urdf = share_directory + '/urdf/test.urdf.xml'
def generate_launch_description():
with open(urdf, 'r') as infp:
robot_desc = infp.read()
return LaunchDescription([
Node(
package='model_pkg',
executable='model',
output='screen',
parameters=[],
),
Node(
package='rviz2',
executable='rviz2',
output='screen',
arguments=['-d', share_directory + '/rviz/rviz_config_test.rviz'],
),
Node(
package= 'robot_state_publisher' ,
executable= 'robot_state_publisher' ,
name= 'robot_state_publisher' ,
output= 'screen' ,
parameters=[{'use_sim_time': True, 'robot_description': robot_desc}],
),
])
EDIT: Here are the rqt graphs successful and unsuccessful loads. Neither of them look different:
SUCCESSFUL: .dae file:
UNSUCCESSFUL: .stl C:\fakepath\unsuccessful_load.png
I know rviz is loading both of these file formats though because RVIZ throws the following format when I try with .bms format:
[rviz2-2] [ERROR] [1670616645.049797087] [rviz2]: Could not load resource [package://model_pkg/models/urdfmodel.bms]: No suitable reader found for the file format of file "package://model_pkg/models/urdfmodel.bms".
I would normally export to .dae, but my CAD's export to .dae is currently broken. I've tried .stl and .obj, but those don't seem to work. Are there other file formats supported in rviz2's robot_model? Or is there a different package I could use to render models besides RobotModel? https://wiki.ros.org/rviz/DisplayTypes/RobotModel
Asked by rydb on 2022-12-09 12:17:22 UTC
Answers
A binary .stl should certainly work. I do not believe RViz supports obj (unless that's changed somewhat recently).
Gazebo can visualize .obj meshes, as well as .stl and .dae, but only supports textures for .dae.
Meshlab is a great, easy to use tool to convert or manipulate meshes if you do want to use a particular format that your CAD package can't export to directly. Similarly, Blender is many people's go-to tool for mesh conversion, manipulation, and texturing.
I've never had an issue visualizing .stl or .dae meshes that open correctly in Meshlab using Rviz or Gazebo; when I do still have issues in RViz or Gazebo, the problem is usually my fault (e.g. meshes weren't installed to the correct path).
You may want to look more carefully at the output from RViz in your terminal to see what its complaining about.
Asked by shonigmann on 2022-12-09 13:03:43 UTC
Comments
A binary .stl should certainly work. I do not believe RViz supports obj (unless that's changed somewhat recently).
apparently not for me. I've changed the file extension to .stl and saved an .stl formated and .ast formated file and neither of them visualized in ros2. Rviz2 throws the folloiwng messages in the info log:
[rviz2-2] [INFO] [1670615455.854733992] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-2] [INFO] [1670615455.854860672] [rviz2]: OpenGl version: 4.6 (GLSL 4.6)
[rviz2-2] [INFO] [1670615455.884745034] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-2] Parsing robot urdf xml string
the above is posted for both unsucccessful and successful loads for .stl and .dae
I've added rqt graphs of unsuccessful loads and a successful loads
Asked by rydb on 2022-12-09 15:06:44 UTC
Meshlab is a great, easy to use tool to convert or manipulate meshes if you do want to use a particular format that your CAD package can't export to directly. Similarly, Blender is many people's go-to tool for mesh conversion, manipulation, and texturing.
Meshlab has a python api but Meshlab is under GPL.I might check out the blender api at some point if all else fails though...
Asked by rydb on 2022-12-09 15:15:11 UTC
the messages you quoted from the log are not referring to missing / unfound meshes and can safely be ignored in my experience.
If there's no other notable output in the terminal from RViz, might be worth a few other sanity checks; if you print out the URDF file (once its been parsed if you're using xacro) can you successfully follow the mesh paths to a valid location on your computer?
Have you set the RobotModel
Description Topic
topic in RViz to point to /robot_description
? This value is not filled by default when you add the RobotModel
view. Is the Fixed Frame
setting in the RViz Global Options a valid one?
If none of the above helps, I'd suggest updating your question with the full terminal output, a screenshot of what you see in RViz and your RobotModel view configuration.
Asked by shonigmann on 2022-12-09 20:53:52 UTC
Comments