v_repExtRosInterface not working

Report crashes, strange behaviour, or apparent bugs
rick187
Posts: 9
Joined: 02 Jul 2014, 08:55

v_repExtRosInterface not working

Post by rick187 » 26 May 2016, 10:26

Hello,

I am not sure this is a bug or something due to my own configuration.
I wanted to try the new v_repExtRosInterface.
I followed the instructions here http://www.coppeliarobotics.com/helpFil ... Indigo.htm to compile it and copied the following files:
libv_repExtRosInterface.so libv_repExtRosSkeleton.so libv_repExtRos.so
to my vrep folder.

When I launch V-Rep I get this message:
Plugin 'RosInterface': loading...
Plugin 'RosInterface': load succeeded.

however only the old /vrep node is running and if I try running the lua script in http://www.coppeliarobotics.com/helpFil ... Indigo.htm I get a bunch of
Lua runtime error: [string "SCRIPT Sphere"]:59: attempt to call global 'simExtROSInterface_shutdownPublisher' (a nil value)

I can also see that none of the v_repExtRosInterface are highlighted in the script editor.

I am using ros jade. Could this be the source of the problem? (the old ros plugin works flawlessly)

Thank you and cheers.

Riccardo

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

Re: v_repExtRosInterface not working

Post by coppelia » 26 May 2016, 10:54

Hello,

this is strange, since the RosInterface plugin was loaded correctly as it seems. The new Lua functions not being highlighted indicates that they haven't been registered.

Can you tell me what your function registerScriptStuff() in stubs.cpp look like? registerScriptStuff() is called in the plugin initialization function v_repStart().
Also, try maybe to add debug text prints inside of the try-section in registerScriptStuff() function, at the beginning and end.

Cheers

rick187
Posts: 9
Joined: 02 Jul 2014, 08:55

Re: v_repExtRosInterface not working

Post by rick187 » 26 May 2016, 12:54

Hello,

this is what my registerScriptStuff looks like

bool registerScriptStuff()
{
try
{
std::cout << "start registering simExtRosInterface functions..." << std::endl;
simRegisterScriptCallbackFunctionE("simExtRosInterface_subscribe@RosInterface", "number subscriberHandle=simExtRosInterface_subscribe(string topicName,string topicType,string topicCallback,number queueSize=1)", subscribe_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_shutdownSubscriber@RosInterface", "simExtRosInterface_shutdownSubscriber(number subscriberHandle)", shutdownSubscriber_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_subscriberTreatUInt8ArrayAsString@RosInterface", "simExtRosInterface_subscriberTreatUInt8ArrayAsString(number subscriberHandle)", subscriberTreatUInt8ArrayAsString_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_advertise@RosInterface", "number publisherHandle=simExtRosInterface_advertise(string topicName,string topicType,number queueSize=1,bool latch=false)", advertise_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_shutdownPublisher@RosInterface", "simExtRosInterface_shutdownPublisher(number publisherHandle)", shutdownPublisher_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_publisherTreatUInt8ArrayAsString@RosInterface", "simExtRosInterface_publisherTreatUInt8ArrayAsString(number publisherHandle)", publisherTreatUInt8ArrayAsString_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_publish@RosInterface", "simExtRosInterface_publish(number publisherHandle,table message)", publish_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_serviceClient@RosInterface", "number serviceClientHandle=simExtRosInterface_serviceClient(string serviceName,string serviceType)", serviceClient_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_shutdownServiceClient@RosInterface", "simExtRosInterface_shutdownServiceClient(number serviceClientHandle)", shutdownServiceClient_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_serviceClientTreatUInt8ArrayAsString@RosInterface", "simExtRosInterface_serviceClientTreatUInt8ArrayAsString(number serviceClientHandle)", serviceClientTreatUInt8ArrayAsString_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_call@RosInterface", "bool result=simExtRosInterface_call(number serviceClientHandle,table request)", call_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_advertiseService@RosInterface", "number serviceServerHandle=simExtRosInterface_advertiseService(string serviceName,string serviceType,string serviceCallback)", advertiseService_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_shutdownServiceServer@RosInterface", "simExtRosInterface_shutdownServiceServer(number serviceServerHandle)", shutdownServiceServer_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_serviceServerTreatUInt8ArrayAsString@RosInterface", "simExtRosInterface_serviceServerTreatUInt8ArrayAsString(number serviceServerHandle)", serviceServerTreatUInt8ArrayAsString_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_sendTransform@RosInterface", "simExtRosInterface_sendTransform(table transform)", sendTransform_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_sendTransforms@RosInterface", "simExtRosInterface_sendTransforms(table transforms)", sendTransforms_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_imageTransportSubscribe@RosInterface", "number subscriberHandle=simExtRosInterface_imageTransportSubscribe(string topicName,string topicCallback,number queueSize=1)", imageTransportSubscribe_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_imageTransportShutdownSubscriber@RosInterface", "simExtRosInterface_imageTransportShutdownSubscriber(number subscriberHandle)", imageTransportShutdownSubscriber_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_imageTransportAdvertise@RosInterface", "number publisherHandle=simExtRosInterface_imageTransportAdvertise(string topicName,number queueSize=1)", imageTransportAdvertise_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_imageTransportShutdownPublisher@RosInterface", "simExtRosInterface_imageTransportShutdownPublisher(number publisherHandle)", imageTransportShutdownPublisher_callback);
simRegisterScriptCallbackFunctionE("simExtRosInterface_imageTransportPublish@RosInterface", "simExtRosInterface_imageTransportPublish(number publisherHandle,string data,number width,number height,string frame_id)", imageTransportPublish_callback);
std::cout << "... done registering simExtRosInterface functions." << std::endl;
}
catch(std::exception& ex)
{
std::cout << "Initialization failed (registerScriptStuff): " << ex.what() << std::endl;
return false;
}
catch(std::string& s)
{
std::cout << "Initialization failed (registerScriptStuff): " << s << std::endl;
return false;
}
catch(int& n)
{
std::cout << "Initialization failed (registerScriptStuff): error #" << n << std::endl;
return false;
}
return true;
}


I can see both messages in the terminal:
Plugin 'RosInterface': loading...
start registering simExtRosInterface functions...
... done registering simExtRosInterface functions.
Plugin 'RosInterface': load succeeded.

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

Re: v_repExtRosInterface not working

Post by coppelia » 26 May 2016, 13:57

I am at a loss here... and you say the RosInterface functions are not highlighted in the scripts?

Can you modify file system/usrset.txt, and set debugCApiAccess and sendDebugInformationToFile to true, then start V-REP. Then, show me please the first few lines of the created file debugLog.txt, until it says that the RosInterface plugin was successfully loaded?

Don't forget to set above values to false again, otherwise V-REP will run very slowly.

Cheers

rick187
Posts: 9
Joined: 02 Jul 2014, 08:55

Re: v_repExtRosInterface not working

Post by rick187 » 26 May 2016, 16:02

Hi,

I did what you asked but I don't see any message referring to RosInterface in the debug log.
The whole file is here https://gist.github.com/ricsp/2a708986f ... 15a4d421fd
Cheers,

Riccardo

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

Re: v_repExtRosInterface not working

Post by coppelia » 27 May 2016, 08:13

Right, the plugin load information only gets printed to the console, not the debug file. But the debug file looks fine so far. Very strange.
If you write following in a child script:

Code: Select all

simExtRRS1_CANCEL_EVENT()
does simExtRRS1_CANCEL_EVENT appear highlighted? Are you running on Ubuntu64 bits? I will then try to prepare a version to track down the problem. It seems the problem is not directly linked to ROS, but function registration..

Cheers

rick187
Posts: 9
Joined: 02 Jul 2014, 08:55

Re: v_repExtRosInterface not working

Post by rick187 » 29 May 2016, 13:26

Hi,

simExtRRS1_CANCEL_EVENT() is highlighted in red.
Thanks for the help. In the meantime I will get by with the old ros plugin

Cheers.

v01d
Posts: 3
Joined: 06 Jun 2016, 16:45

Re: v_repExtRosInterface not working

Post by v01d » 06 Jun 2016, 17:51

Hi,
I have the same problem. The example scene works but not for any other objects I add. Functions are not highlighted. However, the function suggested in the previous post is highlighted. Why is that the example scene works? What could be the problem?

v01d
Posts: 3
Joined: 06 Jun 2016, 16:45

Re: v_repExtRosInterface not working

Post by v01d » 06 Jun 2016, 18:35

Got it, the tutorial is wrong. The functions spell "ros" in all caps, when it should be spelled "Ros". Function names were wrong.

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

Re: v_repExtRosInterface not working

Post by coppelia » 07 Jun 2016, 10:08

Oh no, you are perfectly right, we forgot to correct that part of the documentation.. the online version is now fixed.

Thanks a lot,
Cheers

Post Reply