ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Requrements:

from gazebo_msgs.srv import ApplyBodyWrench from geometry_msgs.msg import Wrench

Gazebo service call for applying a force on a body

def applyForce(): rospy.wait_for_service('/gazebo/apply_body_wrench') force = rospy.ServiceProxy('/gazebo/apply_body_wrench',ApplyBodyWrench)

wrench          = Wrench()
wrench.force.x  = 0
wrench.force.y  = 0
wrench.force.z  = 0
wrench.torque.x = 0
wrench.torque.y = 0
wrench.torque.z = 0
# You can also define the start time if necessary... 
force(body_name = "base_link",wrench = wrench, duration = rospy.Duration(10))