ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I was looking for an example of resetting joint angles using the /gazebo/set_model_configuration service in python and couldn't find one so I figured I would post it here:
import rospy
from gazebo_msgs.srv import SetModelConfiguration
from gazebo_msgs.srv import SetModelConfigurationRequest
reset_joints = rospy.ServiceProxy('/gazebo/set_model_configuration', SetModelConfiguration)
reset_req = SetModelConfigurationRequest()
reset_req.model_name = 'robot'
reset_req.urdf_param_name = 'robot_description'
reset_req.joint_names = ['joint1'] #list
reset_req.joint_positions = [-1.57] #list
res = reset_joints(reset_req)
Hopefully this will help someone else. Let me know if this example doesn't work