ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

Mesh file not loading in RVIZ and Gazebo

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

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="http://www.ros.org/wiki/xacro">

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

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

and this launch file:

<?xml version="1.0" encoding="UTF-8" ?>
<launch>
    <!-- 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"/>
</launch>

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/

SUMMARY
========

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

NODES
  /
    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]
ROS_MASTER_URI=http://localhost:11311

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
0

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

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

Comments

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 -0500 )edit

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

https://www.linuxcapable.com/install-...

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

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

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

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

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

Seen: 356 times

Last updated: Jan 13