Send joint torques directly to a joint in python without using ApplyJointEffort service
I'm currently developing a python script which implements a PID controller for a custom robot arm in gazebo. The script is going to be used for teaching students how PID controller works. Including the calculation of a PID controller is important for me, so I don't want to use ros_control. I tried to send joint torques with the /gazebo/apply_joint_effort service in the script, but it didn't work out very well because the amount of time to complete the service is too long and that time is not a fixed value.
So I'm looking for a way to send joint torques directly to the joints with python without using the /gazebo/apply_joint_effort service.
Afaik, without writing a Gazebo plugin, the service and topic interfaces are all there are to interact with Gazebo. So whether you're using Python or some other programming language, you'll probably have to use them.
Thank you for your comment, gvdhoorn. I've found a genpy auto-generated python script called _ApplyJointEffort.py under /opt/ros/kinetic/lib/python2.7/dist-packages/gazebo_msgs/srv. Is it possible to use that script directly?
The file you found is the Python code generated to interact with the ROS service called
ApplyJointEffort
, which is offered by Gazebo. Whenever you dofrom gazebo_msgs.msg import ApplyJointEffort
, that class is being imported.So I'm not sure how that would be different ..