Robotics StackExchange | Archived questions

How to write a custom control plugin for Gazebo-Ros using Python ?

Helllo, I have been trying to write a custom control plugin for gazebo using python interpreter. I want to use ros to fetch the joint states and publish joint commands for my robot in the gazebo. I have been searching for what kind of packages do I need to import in my python script file in order to read the joint states from gazebo model. Can you please help me pointing me out in the right direction? All the tutorials I have been searching are for the plugin in C++. If available can you please give me any link of sample custom control plugin in python. Also I have come across Osrf_msgs package , I am not sure about what that package comprises of. Can you please help me with this. Thank you.

Asked by microbot on 2019-02-20 10:09:37 UTC

Comments

Did you check this http://gazebosim.org/tutorials?cat=&tut=drcsim_ros_python ?

Asked by pmuthu2s on 2019-02-20 10:14:41 UTC

Yea I have come across that, although I could not understand what Osrf_msg package is and then the scope of JointState() function whether this function gives the joint states of all the joints together or how the function is supposed to be used.

Asked by microbot on 2019-02-20 10:32:31 UTC

Also the whole tutorial is a bit raw when trying to understand what the code is supposed to do , like what he tried to do with having the Kp, Ki and Kd gain values and etc, if you could give me a brief explanation, it would be very much appreciated. Thanks in advance.

Asked by microbot on 2019-02-20 10:34:14 UTC

I guess joint states are from sensor msgs check this link They will provide all the joint states.

Asked by pmuthu2s on 2019-02-20 10:40:15 UTC

For OSRF, check this for the information on messages

Asked by pmuthu2s on 2019-02-20 10:41:31 UTC

I donot think The Post for altas robot is for a gazebo plugin. The post is about a ros node subscribing the JointState topic and publish JointCommand. A gazebo plugin should be referenced in SDF file and work in "OnLoad->OnUpdate" loop within the simulation loop of gazebo itself. The altas robot should have a plugin controller already and this plugin will subscribe the JointCommand and response to it.

Asked by frzybo on 2021-08-18 19:13:59 UTC

Answers