Implement a new subscriber type

Typically: "How do I... ", "How can I... " questions
Post Reply
Aurora
Posts: 4
Joined: 21 May 2015, 21:29

Implement a new subscriber type

Post by Aurora »

Hi,
I was following viewtopic.php?f=9&t=801 this post to implement a new subscriber type. I successfully compiled the code. But when I modify my code in V-rep's non-threaded script, V-rep couldn't recognize the new subscriber type I added. Below is the code I added in V-rep's script.

Code: Select all

simExtROS_enableSubscriber('/particle_cloud',10,simros_strmcmd_set_object_pose_array,-1,-1,'')
When I run the scene, it says
Lua API call error: [string "SCRIPT Pioneer_p3dx"]:143: Argument 3 is not correct. (simExtROS_enableSubscriber)
Best,
Aurora

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

Re: Implement a new subscriber type

Post by coppelia »

Hello Aurora,

it seems that the simros_strmcmd_set_object_pose_array identifier is not registered in Lua. You can do this with:

Code: Select all

simRegisterCustomLuaVariable("simros_strmcmd_set_object_pose_array",(boost::lexical_cast<std::string>(int(simros_strmcmd_set_object_pose_array))).c_str());
As it is done with the other publisher/subscriber types in programming/ros_packages/vrep_plugin/src/vrep_plugin.cpp

Best would however be to implement new messages in a separate plugin. Have a look at the example plugin programming/ros_packages/vrep_plugin_skeleton

Cheers

Post Reply