Gazebo & ROS Subscriber and Publisher C++
Hello all, I am new to ROS and I am trying to write a subscriber and publisher c++ code to talk with Gazebo. I want to get the states of each link and be able to publish to each link to control its joint angles.
I was successfully able to control my model in Gazebo via a rostopic pub command and am struggling to write a c++ code to do the same. Similarly, I have not been able to write any code to get the link states. I was able to get code working to subscribe to the /joint_states, but this does not reflect the link states in Gazebo.
Any help would be appreciated!
Ubuntu: 14.04 LTS ROS: Indigo Gazebo: 2.2.3
Asked by justinkgoh on 2016-06-30 08:51:43 UTC
Answers
It's not clear to me whether a gazebo plugin is necessary for what you want, so decide that before pursuing the following.
If it is, here are a couple gazebo plugin tutorial links (from the link above).
I'm leaving that sparse because I've found the gazebo tutorials to be, let's say, unhelpful -- call it information overload. What did work for me was to look at and learn from already written plugins as examples (like those from the ROS simulation github repository).
Asked by kramer on 2016-07-01 08:12:59 UTC
Comments
I apologize if what I wrote is confusing. I am not a computer science major. Is there anything I can provide that would be helpful in clearing whether I would need a gazebo plugin or not. I would like to stay away from plugins if possible since my programming knowledge is limited.
Asked by justinkgoh on 2016-07-05 09:56:37 UTC
Update: I was able to get the subscriber working and now I am having issues with the publisher.
Asked by justinkgoh on 2016-07-06 12:26:54 UTC
A plugin might be needed if the current topics don't provide needed functionality. If your issue is just duplicating CLI commands in code, then disregard my original answer, I mis-interpreted. If, OTOH, the sim isn't publishing link_states, then you might need a plugin.
Asked by kramer on 2016-07-09 09:08:05 UTC
I managed to get it working without using a plugin. Thanks for your time and help!
Asked by justinkgoh on 2016-07-11 14:53:13 UTC
hello @jutinkgoh i have the issue, please can you tell me how you did to solve that?
Asked by samo on 2018-06-26 08:21:22 UTC
Comments