Merging sensor and model plugin
Hi guys, I'm developing a laser plugin (sensor type) that when detects an object makes some robot's joints move. The problem is that I don't know how to recover the model from the sensor plugin (in case of a model plugin, I can recover the pointer in the Load function but in this case I have only the sensor's parent). Have you got any ideas about how to solve my problem? Thanks for the attention!
Asked by antonio_ia on 2017-05-04 10:06:25 UTC
Answers
Hi @antonio_ia,
Sensor plugins run in the sensor library, which is separate from the physics library, that's why you're not able to get a sensor's parent link from a sensor pointer.
You could however use the physics::get_world() function to get a pointer to the world, and get to the desired entity from there.
Note however that sensors and physics run in different threads, so you must be careful with the calls you're going to make. An alternative approach would be to run a model plugin on the model you want to control, and subscribe to messages coming from your sensor there. This way you can control your robot on the physics thread.
Asked by chapulina on 2017-05-04 11:04:22 UTC
Comments
Ok! I'll try the pub/sub way but I don't know how to receive the data coming from the laser scan. I haven't found any tutorial, could you explain me how to do? Thanks @chapulina!
Asked by antonio_ia on 2017-05-04 11:39:43 UTC
Comments