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

Mesh file not loading in RVIZ and Gazebo

asked 2021-12-02 09:28:13 -0600

GilmarCorreia gravatar image

Hello ros developers. I'm new in ROS and I'm trying to create a robot using this .xacro file:

<?xml version='1.0'?>
<robot name="teste_bot" xmlns:xacro="">

  <!-- Import Rviz colors -->
  <xacro:include filename="$(find ntu_gazebo)/urdf/materials.xacro" />

  <!-- Base Link -->
  <link name="base_link">
      <origin xyz="0 0 0" rpy="0 0 0" />
          <mesh filename="file:///home/gilmar/ros_ws/simulators/src/ntu_gazebo/meshes/chassis.stl" />
      <material name="black"/>

and this launch file:

<?xml version="1.0" encoding="UTF-8" ?>
    <!-- Valores passados por linha de comando -->
    <arg name="model" />
    <arg name="gui" default="False" />

    <!-- seta os parâmetros no Servidor de Parâmetros -->
    <param name="robot_description" command="$(find xacro)/xacro '$(find ntu_gazebo)/urdf/$(arg model)'" /> <!--textfile="$(find ntu_gazebo)/urdf/$(arg model)"/>-->
    <param name="use_gui" value="$(arg gui)"/>

    <!-- Inicia 3 nós ros -->
    <node name="joint_state_publisher_gui" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui"/>

    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>

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

but I'm having a problem loading the mesh. All the files are in the respective directory so that when I launch the node no error seems to occur, but the mesh simply doesn't show up. Does someone know what is happening?

gilmar@MARK-I:~/ros_ws/simulators$ roslaunch ntu_gazebo robot_rviz.launch model:=teste_bot.xacro
... logging to /home/gilmar/.ros/log/60c6946e-5380-11ec-9d65-00155d5e503d/roslaunch-MARK-I-12725.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://MARK-I:42729/


 * /robot_description: <?xml version="1....
 * /rosdistro: noetic
 * /rosversion: 1.15.13
 * /use_gui: False

    joint_state_publisher_gui (joint_state_publisher_gui/joint_state_publisher_gui)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    rviz (rviz/rviz)

auto-starting new master
process[master]: started with pid [12786]

setting /run_id to 60c6946e-5380-11ec-9d65-00155d5e503d
process[rosout-1]: started with pid [12814]
started core service [/rosout]
process[joint_state_publisher_gui-2]: started with pid [12818]
process[robot_state_publisher-3]: started with pid [12823]
process[rviz-4]: started with pid [12824]
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-gilmar'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-gilmar'

I'm using: - ros-noetic - ubuntu-20.04 - RViz r1.14.10 - Gazebo11

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2022-01-13 12:41:51 -0600

GilmarCorreia gravatar image

I've solved the problem. The main effect was caused by the OpenGL version. I have created a virtual machine in WSL, and it does not have OpenGL 4 support.

edit flag offensive delete link more


I have the same problem, maybe also caused by my virtual machine in WSL. How did you resolve it?

znerke gravatar image znerke  ( 2022-04-06 03:26:30 -0600 )edit

I needed to update my OpenGL version in WSL 2. Here is the link that I have followed.

GilmarCorreia gravatar image GilmarCorreia  ( 2022-04-06 09:32:48 -0600 )edit

answered 2021-12-05 10:37:51 -0600

muratkoc503 gravatar image

"file:///home/gilmar..... , after file you use three///, try two //, and package, try bottom

<mesh filename="package://home/gilmar/ros_ws/simulators/src/ntu_gazebo/meshes/chassis.stl"/>

Do you spawned your robot on Gazebo? In launch file, this not exist. spawn:

<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model deneme_1 -param robot_description"/>

deneme_1 your robot name: teste_bot

edit flag offensive delete link more

Question Tools



Asked: 2021-12-02 09:28:13 -0600

Seen: 953 times

Last updated: Jan 13 '22