Page 1 of 2

v_repExtRosInterface not working

Posted: 26 May 2016, 10:26
by rick187
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

Re: v_repExtRosInterface not working

Posted: 26 May 2016, 10:54
by coppelia
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

Re: v_repExtRosInterface not working

Posted: 26 May 2016, 12:54
by rick187
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.

Re: v_repExtRosInterface not working

Posted: 26 May 2016, 13:57
by coppelia
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

Re: v_repExtRosInterface not working

Posted: 26 May 2016, 16:02
by rick187
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

Re: v_repExtRosInterface not working

Posted: 27 May 2016, 08:13
by coppelia
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

Re: v_repExtRosInterface not working

Posted: 29 May 2016, 13:26
by rick187
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.

Re: v_repExtRosInterface not working

Posted: 06 Jun 2016, 17:51
by v01d
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?

Re: v_repExtRosInterface not working

Posted: 06 Jun 2016, 18:35
by v01d
Got it, the tutorial is wrong. The functions spell "ros" in all caps, when it should be spelled "Ros". Function names were wrong.

Re: v_repExtRosInterface not working

Posted: 07 Jun 2016, 10:08
by coppelia
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