Gazebo | Ignition | Community
Ask Your Question
0

Merging sensor and model plugin

asked 2017-05-04 10:06:25 -0500

antonio_ia gravatar image

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-05-04 11:04:22 -0500

chapulina gravatar image

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.

edit flag offensive delete link more

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!

antonio_ia gravatar imageantonio_ia ( 2017-05-04 11:39:43 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-05-04 10:06:25 -0500

Seen: 436 times

Last updated: May 04 '17