BØ is a cross-platform middleware which provides tools for interconnecting pieces of software running in multiple threads, multiple processes and even multiple machines. It has some similarities with ROS, although it only focuses on providing communication paradigms (client/server and publisher/subscriber) and message transport (based on ZeroMQ), while being agnostic to message serialization format or common protocols and data structures.
CoppeliaSim can act as a one or several BØ nodes that other nodes can communicate with via BØ services, BØ publishers and BØ subscribers.
The BlueZero Interface functionality in CoppeliaSim is enabled via a plugin: simExtB0.dll, libsimExtB0.so or libsimExtB0.dylib. The code to the plugin, which can be found here, can easily be adapted to your own needs. The plugin is loaded when CoppeliaSim is launched, but you should make sure to have b0_ resolver running. Make sure to inspect CoppeliaSim's console window or terminal for details on plugin load operations. Various BlueZero tools can be found already compiled in the CoppeliaSim folder.
As an example, a vision sensor publisher could look like:
function sysCall_init() visionSensor=sim.getObjectHandle('Vision_sensor') -- Enable an image publisher: b0Node=simB0.nodeCreate('b0Node') pub=simB0.publisherCreate(b0Node,'image') simB0.nodeInit(b0Node) end function sysCall_sensing() -- Publish the image of the vision sensor: local msg=sim.getVisionSensorCharImage(visionSensor) simB0.publisherPublish(pub,msg) end function sysCall_cleanup() if b0Node then simB0.nodeCleanup(b0Node) simB0.publisherDestroy(pub) simB0.nodeDestroy(b0Node) end end
The subscriber on the other hand could look like:
function sysCall_init() -- Enable an image subscriber: b0Node=simB0.nodeCreate('b0Node') sub=simB0.subscriberCreate(b0Node,'image','image_callback') simB0.nodeInit(b0Node) end function image_callback(msg) -- Here we have received an image end function sysCall_sensing() simB0.nodeSpinOnce(b0Node) end function sysCall_cleanup() if b0Node then simB0.nodeCleanup(b0Node) simB0.subscriberDestroy(sub) simB0.nodeDestroy(b0Node) end end
Have a look at following simulation scene for a quick start with the BlueZero interface:
Also have a look at the external controller tutorial.