MATLAB Answers

How to subscribe topic from gazebo by using the "gazebo subscribe block" in simulink

9 views (last 30 days)
shengqi xu
shengqi xu on 1 Mar 2021
Answered: Gaurav Bhosale on 15 Mar 2021
Gazebo (Ubuntu 18.04, gazebo-9) connect Simulink(matlab2020b) correctly!
then i used "gz topic -l", i could see all the topic in gazebo, means the topic have been published.
Connectin between ubuntu and matlab correctly, then i try to follow the tutorial: use "gazebo read block" to read GazeboPlugin msgs, that ok!
but if i use "gazebo subscribe block" , there was no topic that i could choose, when i clic on "select", it shows no topic could subscribe...?
very urgent, please help meto figure out this question!!! Is it the issues of version of ubuntu or gazebo? or code? used google protobuf 3.0.0
thanks in advance !

Answers (1)

Gaurav Bhosale
Gaurav Bhosale on 15 Mar 2021
Hi shengqi,
The Gazebo Subscribe block is designed for Custom Message Support. Basically, other than built-in support ( Read Block ), you can subscribe other topic from Gazebo to Simulink. To do that, you need to first define your own message or use Gazebo Msgs support provided in gazebogenmsg support
>> help gazebogenmsg
Once, you build required dependecies with 'gazebogenmsg' for specific cutom message, then you need to create plugin .zip with generated custom source path. Further, you need to copy and build plugin on VM.
In similar way, Gazebo Publish block, publish message on Gazebo from Simulink.
Thanks.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by