V-REP crashes on ros interface

Report crashes, strange behaviour, or apparent bugs
Post Reply
Filipe Rocha
Posts: 14
Joined: 28 May 2017, 20:51

V-REP crashes on ros interface

Post by Filipe Rocha »

Hello everyone.

I have developed a robot in V-REP and managed to communicate him with ROS using the v-rep ros interface (https://github.com/fferri/v_repExtRosInterface). Everything used to work fine.

Recently I have upgraded my computer from Ubuntu 14.04 to 16.04, and logically, from ROS Indigo to Kinetic. Things used to work fine with my model. The thing is, I have downloaded the new version of V-REP (3.4) and the interface, from the git repository.

Now, when I try to run my ancient code, V-REP crashes with the following message:

Code: Select all

./vrep.sh: line 33: 20159 Segmentation fault      (core dumped) "$dirname/$appname" "${PARAMETERS[@]}"
I have debugged and noticed that the program crashes when it tries to execute those lines, that have functions from the ROS interface:

Code: Select all

simTimePub=simExtRosInterface_advertise('/tempo_sim','std_msgs/Float32')
simMotorPositionPub=simExtRosInterface_advertise('/espeleoMotorPosition','vrep_common/EspeleoMotorPosition')
What could be the problem? It is driving me crazy and I need this thing to finish my master.


PS1. This message is showing when V-REP is loading:

Code: Select all

Plugin 'RosInterface': loading...
Plugin 'RosInterface': warning: replaced variable 'simROS'
Plugin 'RosInterface': load succeeded.
PS2. Inside V-REP lua script editor, when I finish to write the function sintax to advertise ROS master that I am going to publish something (exactly the function that is crashing my program), V-REP says to me:

Code: Select all

DEPRECATED, Please use simROS.advertise
So, if I understood well, simROS is a global variable that gives me functionalities to communicate with ROS. The thing is, when I try to use this function as suggested, the program gives me the following error:

Code: Select all

Lua runtime error: [string "SCRIPT Pioneer_p3dx"]:46: attempt to index global 'simROS' (a nil value)
stack traceback:
	[string "SCRIPT Pioneer_p3dx"]:46: in main chunk
I am new in LUA programming, so maybe I am letting something pass, but I do not managed to find in Internet something describing the functionality or how to use simROS.

Thank you a lot in advance.
Best regards.

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: V-REP crashes on ros interface

Post by coppelia »

Hello Filipe,

do not mind about the messages about the new API notation simROS: this is something in preparation for next release. The old notation still works.
Can you tell us which of the two functions is causing the crash?

Cheers

Filipe Rocha
Posts: 14
Joined: 28 May 2017, 20:51

Re: V-REP crashes on ros interface

Post by Filipe Rocha »

Thank you for your fast response.

Well, the crash is being cause, inside the LUA script in V-REP, by every function of the type:

Code: Select all

simExtRosInterface_*
And the bizzarrest thing is that even the scene example "controlTypeExamples.ttt" is crashing the program. That makes me think if the problem could be in the interaction between V-REP and the Ros Interface.

My specs:

Code: Select all

ubuntu:16.04
rosdistro: kinetic
rosversion: 1.12.7
v-rep_version:3.4.0
vrep_ros_interface_version:3.3.0

fferri
Posts: 1193
Joined: 09 Sep 2013, 19:28

Re: V-REP crashes on ros interface

Post by fferri »

I could not reproduce your problem.

Can you confirm that V-REP does crash by putting this code in an object's script?

Code: Select all

if (sim_call_type==sim_childscriptcall_initialization) then
    pub=simROS.advertise('/test','std_msgs/Float32')
end

if (sim_call_type==sim_childscriptcall_actuation) then
    simROS.publish(pub,{data=simGetSimulationTime()})
end
Can you provide a stacktrace?
In order to get a stacktrace on Linux, open a terminal, cd to the V-REP directory, and execute:

Code: Select all

env LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH gdb vrep
and input run at the (gdb) prompt. When the program crashes, input bt at the (gdb) prompt, and paste the output here.
But before doing this, please compile vrep_ros_interface with:

Code: Select all

catkin build --cmake-args -DCMAKE_BUILD_TYPE=Debug
and install it in the V-REP directory, so that debug information will be available.

Filipe Rocha
Posts: 14
Joined: 28 May 2017, 20:51

Re: V-REP crashes on ros interface

Post by Filipe Rocha »

The "crashing code" is when I use some functions with the sintax simExtRosInterface_*. As for example:

Code: Select all

simMotorPositionPub=simExtRosInterface_advertise('/espeleoMotorPosition','vrep_common/EspeleoMotorPosition')
MotorSpeedSub=simExtRosInterface_subscribe('/EspeleoRobo_SpeedSubscribe','vrep_common/EspeleoSpeedSet','setMotorsVelocity_cb')
As you requested, I did every step you said to me. The result is this log file:

Code: Select all

filipe@filipe-Inspiron-5557:~/.vrep$ env LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH gdb vrep
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vrep...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/filipe/.vrep/vrep 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffebfd0700 (LWP 5284)]
[New Thread 0x7fffe03f9700 (LWP 5285)]
[New Thread 0x7fffdfbf8700 (LWP 5286)]
[New Thread 0x7fffdf3f7700 (LWP 5287)]
[New Thread 0x7fffce2df700 (LWP 5288)]
[New Thread 0x7fffcdade700 (LWP 5289)]
Using the default Lua library.
Loaded the video compression library.
[Thread 0x7fffce2df700 (LWP 5288) exited]
Add-on script 'vrepAddOnScript-addOnScriptDemo.lua' was loaded.
QSplitter::setCollapsible: Index 0 out of range
Simulator launched.
Plugin 'MeshCalc': loading...
Plugin 'MeshCalc': load succeeded.
Plugin 'BubbleRob': loading...
Plugin 'BubbleRob': load succeeded.
Plugin 'Bwf': loading...
Plugin 'Bwf': load succeeded.
Plugin 'Collada': loading...
Plugin 'Collada': load succeeded.
Plugin 'ConvexDecompose': loading...
Plugin 'ConvexDecompose': load succeeded.
Plugin 'CustomUI': loading...
Plugin 'CustomUI': load succeeded.
Plugin 'DynamicsBullet-2-78': loading...
Plugin 'DynamicsBullet-2-78': load succeeded.
Plugin 'DynamicsBullet-2-83': loading...
Plugin 'DynamicsBullet-2-83': load succeeded.
Plugin 'DynamicsNewton': loading...
Plugin 'DynamicsNewton': load succeeded.
Plugin 'DynamicsOde': loading...
Plugin 'DynamicsOde': load succeeded.
Plugin 'DynamicsVortex': loading...
Plugin 'DynamicsVortex': load succeeded.
Plugin 'ExternalRenderer': loading...
Plugin 'ExternalRenderer': load succeeded.
Plugin 'K3': loading...
Plugin 'K3': load succeeded.
Plugin 'LuaRemoteApiClient': loading...
Plugin 'LuaRemoteApiClient': load succeeded.
Plugin 'Mtb': loading...
Plugin 'Mtb': load succeeded.
Plugin 'OMPL': loading...
Plugin 'OMPL': load succeeded.
Plugin 'OpenMesh': loading...
Plugin 'OpenMesh': load succeeded.
Plugin 'PovRay': loading...
Plugin 'PovRay': load succeeded.
Plugin 'Qhull': loading...
Plugin 'Qhull': load succeeded.
Plugin 'RRS1': loading...
Plugin 'RRS1': load succeeded.
Plugin 'ReflexxesTypeII': loading...
Plugin 'ReflexxesTypeII': load succeeded.
Plugin 'RemoteApi': loading...
[New Thread 0x7fffce2df700 (LWP 5291)]
Starting a remote API server on port 19997
Plugin 'RemoteApi': load succeeded.
Plugin 'RosInterface': loading...
[New Thread 0x7fffb229c700 (LWP 5354)]
[New Thread 0x7fffb1a9b700 (LWP 5355)]
[New Thread 0x7fffb129a700 (LWP 5356)]
[New Thread 0x7fffb0a99700 (LWP 5361)]
Plugin 'RosInterface': warning: replaced variable 'simROS'
Plugin 'RosInterface': load succeeded.
Plugin 'SDF': loading...
Plugin 'SDF': load succeeded.
Plugin 'SimpleFilter': loading...
Plugin 'SimpleFilter': load succeeded.
Plugin 'SurfaceReconstruction': loading...
Plugin 'SurfaceReconstruction': load succeeded.
Plugin 'Urdf-a': loading...
Plugin 'Urdf-a': load succeeded.
Plugin 'Urdf': loading...
Plugin 'Urdf': load succeeded.
Plugin 'Vision': loading...
Plugin 'Vision': load succeeded.
Using the 'MeshCalc' plugin.
[New Thread 0x7fffaaaa4700 (LWP 5363)]
[New Thread 0x7fffa90f2700 (LWP 5368)]

(vrep:5280): Gtk-WARNING **: Failed to read filechooser settings from "/home/filipe/.config/gtk-2.0/gtkfilechooser.ini": Permission denied

(vrep:5280): Gtk-WARNING **: Failed to read filechooser settings from "/home/filipe/.config/gtk-2.0/gtkfilechooser.ini": Permission denied
[New Thread 0x7fffa88f1700 (LWP 5369)]

(vrep:5280): Gtk-WARNING **: Failed to read filechooser settings from "/home/filipe/.config/gtk-2.0/gtkfilechooser.ini": Permission denied
[Thread 0x7fffa90f2700 (LWP 5368) exited]
[Thread 0x7fffa88f1700 (LWP 5369) exited]
Initializing the Bullet physics engine in plugin 'DynamicsBullet_2_78'...
Engine version: 2.78
Plugin version: 9
Initialization successful.
------------------------------
*** PROCURANDO PELO PLUGIN DO ROS ***
MeshCalc
BubbleRob
Bwf
Collada
ConvexDecompose
CustomUI
DynamicsBullet-2-78
DynamicsBullet-2-83
DynamicsNewton
DynamicsOde
DynamicsVortex
ExternalRenderer
K3
LuaRemoteApiClient
Mtb
OMPL
OpenMesh
PovRay
Qhull
RRS1
ReflexxesTypeII
RemoteApi
RosInterface
*** PLUGIN DO ROS ENCONTRADO ***
SDF
SimpleFilter
SurfaceReconstruction
Urdf-a
Urdf
Vision
nil
------------------------------
Continuando o processamento...
Iniciando configuracoes do ROS

Thread 13 "Thread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffaaaa4700 (LWP 5363)]
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff2f86671 in _genericFunctionHandler_new(void*, CLuaCustomFunction*, std::string&) () from /home/filipe/.vrep/libv_rep.so
#2  0x00007ffff2f8784f in _simGenericFunctionHandler(void*) ()
   from /home/filipe/.vrep/libv_rep.so
#3  0x00007ffff7ed81d4 in luaD_precall () from /home/filipe/.vrep/liblua5.1.so
#4  0x00007ffff7ee190f in luaV_execute () from /home/filipe/.vrep/liblua5.1.so
#5  0x00007ffff7ed861e in luaD_call () from /home/filipe/.vrep/liblua5.1.so
#6  0x00007ffff7ed7d77 in luaD_rawrunprotected ()
   from /home/filipe/.vrep/liblua5.1.so
#7  0x00007ffff7ed7df5 in luaD_pcall () from /home/filipe/.vrep/liblua5.1.so
#8  0x00007ffff7ed3d35 in lua_pcall () from /home/filipe/.vrep/liblua5.1.so
#9  0x00007ffff2eb919a in CLuaScriptObject::_luaPCall(void*, int, int, int) ()
   from /home/filipe/.vrep/libv_rep.so
#10 0x00007ffff2ebd064 in CLuaScriptObject::_runNonThreadedChildScriptNow(CInterfaceStack&, int) () from /home/filipe/.vrep/libv_rep.so
#11 0x00007ffff2ec3187 in CLuaScriptObject::_runNonThreadedChildScript(CInterfaceStack&, int) () from /home/filipe/.vrep/libv_rep.so
#12 0x00007ffff2ec320f in CLuaScriptObject::runNonThreadedChildScript(CInterfaceStack&, int) () from /home/filipe/.vrep/libv_rep.so
#13 0x00007ffff2f834be in handleChildScriptsRoutine(int, CLuaScriptObject*, CInterfaceStack&) () from /home/filipe/.vrep/libv_rep.so
#14 0x00007ffff2ffc177 in _simHandleChildScripts(void*) ()
---Type <return> to continue, or q <return> to quit---
  ep/libv_rep.so
#15 0x00007ffff7ed81d4 in luaD_precall () from /home/filipe/.vrep/liblua5.1.so
#16 0x00007ffff7ee190f in luaV_execute () from /home/filipe/.vrep/liblua5.1.so
#17 0x00007ffff7ed861e in luaD_call () from /home/filipe/.vrep/liblua5.1.so
#18 0x00007ffff7ed7d77 in luaD_rawrunprotected () from /home/filipe/.vrep/liblua5.1.so
#19 0x00007ffff7ed7df5 in luaD_pcall () from /home/filipe/.vrep/liblua5.1.so
#20 0x00007ffff7ed3d35 in lua_pcall () from /home/filipe/.vrep/liblua5.1.so
#21 0x00007ffff2eb919a in CLuaScriptObject::_luaPCall(void*, int, int, int) () from /home/filipe/.vrep/libv_rep.so
#22 0x00007ffff2ebc609 in CLuaScriptObject::_runMainScriptNow(int) () from /home/filipe/.vrep/libv_rep.so
#23 0x00007ffff2ebcb8f in CLuaScriptObject::_runMainScript() () from /home/filipe/.vrep/libv_rep.so
#24 0x00007ffff2ebff74 in CLuaScriptObject::runMainScript() () from /home/filipe/.vrep/libv_rep.so
#25 0x00007ffff2f35ef1 in simHandleMainScript_internal() () from /home/filipe/.vrep/libv_rep.so
#26 0x000000000040279a in simulatorLoop() ()
#27 0x00007ffff30aec88 in _workThread(void*) () from /home/filipe/.vrep/libv_rep.so
#28 0x00007ffff2d5dfc4 in Thread::run() () from /home/filipe/.vrep/libv_rep.so
#29 0x00007ffff77357df in ?? () from /home/filipe/.vrep/libQt5Core.so.5
#30 0x00007ffff68126ba in start_thread (arg=0x7fffaaaa4700) at pthread_create.c:333
#31 0x00007ffff6e3782d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb) 

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: V-REP crashes on ros interface

Post by coppelia »

Ok, it seems this is due to the fact that the recent modifications of the RosIntefrace are not backward compatible. So you can use and compile the RosInterface that comes with V-REP 3.4.0 (in the programming/ros_packages folder), or you can contact us and we can give you a beta of next version.

Cheers

Filipe Rocha
Posts: 14
Joined: 28 May 2017, 20:51

Re: V-REP crashes on ros interface

Post by Filipe Rocha »

Thank you a lot for your fast response for this issue.

I am already attacking both ways of solution and I sent the bug description to the repository of the ROS Interface.

Best regards.

Filipe Rocha
Posts: 14
Joined: 28 May 2017, 20:51

Re: V-REP crashes on ros interface

Post by Filipe Rocha »

Updating the status.

I have downloaded the beta (rev9) version of V-REP and it worked just fine with the newer ROS interface package available.

Hope now it will be easier for you to find and correct the problem in the next versions of the software.

Thank you a lot for V-REP, it is just great a great software!

Post Reply