[BUG] IRIS multi vehicle simulation with gazebo

Hello,

I’m using Arch Linux, after an update for the entire system the last month,
I lost the ability to do simulation with gazebo, I remember that the problem was that ogre was not able to load resource file for iris model, after an extensive debug, we discovered that ogre has lost the ability to load PNG files.
We have comments the lines that corresponded to the png photo models filed for Iris. Since then every thing was
fine for single vehicle simulation even with Iris model.

Today I have tried to do multi vehicle simulation with Gazebo. I’m using ROS Melodic, I followed the instruction described in the website as usual, I did not realize any modifications on the launch files executed by ROS.
I receive now the following error message after launching mavros:
Using the following command:
roslaunch multi_uav_mavros_sitl.launch debug:=true verbose:=true

I got the following error after a while:

[Err] [InsertModelWidget.cc:433] Missing model.config for model “Firmware/Tools/sitl_gazebo/cmake”
[Err] [InsertModelWidget.cc:433] Missing model.config for model “Firmware/Tools/sitl_gazebo/external”
[Err] [InsertModelWidget.cc:433] Missing model.config for model “Firmware/Tools/sitl_gazebo/include”
[Err] [InsertModelWidget.cc:433] Missing model.config for model “Firmware/Tools/sitl_gazebo/models”
[Err] [InsertModelWidget.cc:433] Missing model.config for model “Firmware/Tools/sitl_gazebo/msgs”
[Err] [InsertModelWidget.cc:433] Missing model.config for model “Firmware/Tools/sitl_gazebo/scripts”
[Err] [InsertModelWidget.cc:433] Missing model.config for model “Firmware/Tools/sitl_gazebo/src”
[Err] [InsertModelWidget.cc:433] Missing model.config for model “Firmware/Tools/sitl_gazebo/worlds”
[Err] [RenderEngine.cc:543] EXCEPTION: Unable to load Ogre Resources.
Make sure theresources path in the world file is set correctly.

terminate called after throwing an instance of ‘gazebo::common::Exception’
/opt/ros/melodic/lib/gazebo_ros/gzclient: line 42: 30633 Aborted (core dumped) GAZEBO_MASTER_URI="$desired_master_uri" GAZEBO_MODEL_DATABASE_URI="$desired_model_database_uri" gzclient $final

I have no problem with single vehicle simulation now,

Do you have any idea about this problem?? I had ogre and gazebo updated in the last update of arch linux,

By the way, I have tried to start another vehicle than iris, it seemed that there is no xacro files for these vehicles,
Should I create one for each vehicles??

That’s odd. Could you make a pull request with your changes that you had to do to get this running with latest OGRE again, or send me a patch. That way I would understand what you have done and could probably reproduce this issue.

I’m still stuck at the single vehicle simulation which doesn’t work anymore.

Ok, so I tried with your patch:

diff --git a/worlds/iris.world b/worlds/iris.world
index f6e3239..a108bfb 100644
--- a/worlds/iris.world
+++ b/worlds/iris.world
@@ -9,10 +9,10 @@
     <include>
       <uri>model://ground_plane</uri>
     </include>
-    <!-- An asphalt plane -->
-    <include>
-      <uri>model://asphalt_plane</uri>
-    </include>
+    <!-- <!-\- An asphalt plane -\-> -->
+    <!-- <include> -->
+    <!--   <uri>model://asphalt_plane</uri> -->
+    <!-- </include> -->
     <include>
       <uri>model://iris</uri>
       <pose>1.01 0.98 0.83 0 0 1.14</pose>

but Gazebo still fails to start properly for me:

Gazebo multi-robot simulator, version 9.4.1
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.123
[Err] [Plugin.hh:180] Failed to load plugin /home/julianoes/src/Firmware-master/build/posix_sitl_default/build_gazebo/libgazebo_multirotor_base_plugin.so: libvtkInteractionStyle.so.1: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:180] Failed to load plugin /home/julianoes/src/Firmware-master/build/posix_sitl_default/build_gazebo/libgazebo_motor_model.so: libvtkInteractionStyle.so.1: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:180] Failed to load plugin /home/julianoes/src/Firmware-master/build/posix_sitl_default/build_gazebo/libgazebo_motor_model.so: libvtkInteractionStyle.so.1: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:180] Failed to load plugin /home/julianoes/src/Firmware-master/build/posix_sitl_default/build_gazebo/libgazebo_motor_model.so: libvtkInteractionStyle.so.1: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:180] Failed to load plugin /home/julianoes/src/Firmware-master/build/posix_sitl_default/build_gazebo/libgazebo_motor_model.so: libvtkInteractionStyle.so.1: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:180] Failed to load plugin /home/julianoes/src/Firmware-master/build/posix_sitl_default/build_gazebo/libgazebo_gps_plugin.so: libvtkInteractionStyle.so.1: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:180] Failed to load plugin /home/julianoes/src/Firmware-master/build/posix_sitl_default/build_gazebo/libgazebo_mavlink_interface.so: libvtkInteractionStyle.so.1: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:180] Failed to load plugin /home/julianoes/src/Firmware-master/build/posix_sitl_default/build_gazebo/libgazebo_imu_plugin.so: libvtkInteractionStyle.so.1: cannot open shared object file: No such file or directory
Gazebo multi-robot simulator, version 9.4.1
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.123
[Wrn] [GuiIface.cc:120] Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt.
You must not let any exception whatsoever propagate through Qt code.
If that is not possible, in Qt 5 you must at least reimplement
QCoreApplication::notify() and catch all exceptions there.

Any idea what else I need?

Interesting, I think this problem is related to Gazebo rather than ogre.
I’m using gazebo 9.3.0 I do not know if I am going to have this problem if I do an upgrade for gazebo.

I do not know the version of your firmware, I have the version 1.8.0-rc0

I used ldd to see if there is any dependency for VTK library, I discovered that it is not installed on my system at all.

Could you please post the output of ldd on the libgazebo_*.so ??

Ok, so I installed vtk and now I’m left with the OGRE error.

Which one? the one of iris simulation, or for multi-iris simulation??

Could you please post the error of ogre??

Just the iris simulation using make posix gazebo:

Gazebo multi-robot simulator, version 9.4.1
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.123
[Wrn] [GuiIface.cc:120] Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt.
You must not let any exception whatsoever propagate through Qt code.
If that is not possible, in Qt 5 you must at least reimplement
QCoreApplication::notify() and catch all exceptions there.

[Err] [main.cc:34] Ogre Error:ItemIdentityException: Can not find codec for 'png' image format.
Supported formats are: dds ktx pkm. in Codec::getCodec at /build/ogre/src/ogre-1.11.1/OgreMain/src/OgreCodec.cpp (line 66)

And if you started just gazebo --verbose??
Are you going to have the same error??

This problem appear only in gazebo 9.4.1,

One of my colleague have the same error on his arch linux machine (I suppose you are using arch),
we are trying to make a patch for this problem,

A patch with be added in the AUR website for arch

Please, re-compile gazebo with the patch added by my colleague,

You can find the patch in the last comments in gazebo AUR repository in arch

I remember that the patch existed already, but I think it was deleted by the maintainer of gazebo in aur

Waiting for your answer,

Hm, I tried rebuilding from AUR but the error is the same.

In fact, you need to download the sources from the AUR, and apply the patch manually to avoid this error
Otherwise it is going to take a lot of time waiting for the maintainer to apply this patch to the source

1 Like

So, Have you tried the patch?? I would like to resolve the original problem of this thread

Ok, I was able to install gazebo with the OGRE-1.9 change according to https://aur.archlinux.org/packages/gazebo/#comment-667054, and I made sure sitl_gazebo is using the same OGRE headers and libraries manually. However now I get:

In file included from /usr/include/gazebo-9/gazebo/rendering/ogre_gazebo.h:61,
                 from /usr/include/gazebo-9/gazebo/rendering/Camera.hh:46,
                 from /home/julianoes/src/Firmware-master/Tools/sitl_gazebo/include/gazebo_geotagged_images_plugin.h:25,
                 from /home/julianoes/src/Firmware-master/Tools/sitl_gazebo/src/gazebo_geotagged_images_plugin.cpp:18:
/opt/OGRE-1.9/include/OGRE/Terrain/OgreTerrainPaging.h:33:10: fatal error: OgrePagedWorldSection.h: No such file or directory
 #include "OgrePagedWorldSection.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

These dependencies are such a pain :frowning:

you need to update the version of ogre to avoid this error,

So that means I need to use OGRE 1.11 with the patch?

I’m having a hard time with this patch. I’m not familiar with PKGBUILD and I somehow can’t get the patch applied correctly. I’m going to have to wait until the maintainer pulls in the patch, I think.

Some Updates on the original problem:

I discovered that, spawn model files in gazebo_ros package uses python 2 .7 instead of 3.7 when importing library such as urllib. So, after a modification to the Python script of this package, I found myself in deeper non understood error

[INFO] [1540394622.726954, 0.068000]: Calling service /gazebo/spawn_urdf_model
Traceback (most recent call last):
File “/opt/ros/melodic/lib/gazebo_ros/spawn_model”, line 233, in
exit_code = sm.run()
File “/opt/ros/melodic/lib/gazebo_ros/spawn_model”, line 179, in run
self.args.gazebo_namespace)
File “/opt/ros/melodic/lib/python3.7/site-packages/gazebo_ros/gazebo_interface.py”, line 32, in spawn_urdf_model_client
resp = spawn_urdf_model(model_name, model_xml, robot_namespace, initial_pose, reference_frame)
File “/opt/ros/melodic/lib/python3.7/site-packages/rospy/impl/tcpros_service.py”, line 439, in call
return self.call(*args, **kwds)
File “/opt/ros/melodic/lib/python3.7/site-packages/rospy/impl/tcpros_service.py”, line 516, in call
transport.send_message(request, self.seq)
File “/opt/ros/melodic/lib/python3.7/site-packages/rospy/impl/tcpros_base.py”, line 668, in send_message
serialize_message(self.write_buff, seq, msg)
File “/opt/ros/melodic/lib/python3.7/site-packages/rospy/msg.py”, line 152, in serialize_message
msg.serialize(b)
File “/opt/ros/melodic/lib/python3.7/site-packages/gazebo_msgs/srv/_SpawnModel.py”, line 103, in serialize
_x = _x.encode(‘utf-8’)
AttributeError: ‘bytes’ object has no attribute ‘encode’
[INFO] [1540394622.882709, 0.220000]: Calling service /gazebo/spawn_urdf_model

If anyone has an idea about how does this package work, feel free to contact me

Best regards,

I executed the commands separately from roslaunch, I obtained the same error. The generated code should works out of the box for Python 3.
I was not able to understand the result error, especially that _x is a string and should have by default the encode() function.

/opt/ros/melodic/lib/gazebo_ros/spawn_model -sdf -file /meta/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf -model iris -x 0 -y 0 -z 0 -R 0 -P 0 -Y 0
Unable to register with master node [http://localhost:11311]: master may not be running yet. Will keep trying.
[INFO] [1540485626.864298, 0.000000]: Loading model XML from file /meta/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf
[INFO] [1540485626.873756, 0.000000]: Waiting for service /gazebo/spawn_sdf_model
[INFO] [1540485629.896535, 0.020000]: Calling service /gazebo/spawn_sdf_model
Traceback (most recent call last):
File “/opt/ros/melodic/lib/gazebo_ros/spawn_model”, line 233, in
exit_code = sm.run()
File “/opt/ros/melodic/lib/gazebo_ros/spawn_model”, line 183, in run
self.args.gazebo_namespace)
File “/opt/ros/melodic/lib/python3.7/site-packages/gazebo_ros/gazebo_interface.py”, line 20, in spawn_sdf_model_client
resp = spawn_sdf_model(model_name, model_xml, robot_namespace, initial_pose, reference_frame)
File “/opt/ros/melodic/lib/python3.7/site-packages/rospy/impl/tcpros_service.py”, line 439, in call
return self.call(*args, **kwds)
File “/opt/ros/melodic/lib/python3.7/site-packages/rospy/impl/tcpros_service.py”, line 516, in call
transport.send_message(request, self.seq)
File “/opt/ros/melodic/lib/python3.7/site-packages/rospy/impl/tcpros_base.py”, line 668, in send_message
serialize_message(self.write_buff, seq, msg)
File “/opt/ros/melodic/lib/python3.7/site-packages/rospy/msg.py”, line 152, in serialize_message
msg.serialize(b)
File “/opt/ros/melodic/lib/python3.7/site-packages/gazebo_msgs/srv/_SpawnModel.py”, line 103, in serialize
_x = _x.encode(‘utf-8’)
AttributeError: ‘bytes’ object has no attribute ‘encode’