ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You probably want something like:
def Receive(req):
#Motion= ALproxy("ALMotion")
names = "HeadYaw"
fractionMaxSpeed = 0.1
useSensors = True
HeadYaw = Motion.getAngles(names, useSensors)
Motion.setAngles(names, req.HeadYawSet,fractionMaxSpeed)
names = "HeadPitch"
HeadPitch=Motion.getAngles(names, useSensors)
Motion.setAngles(names, req.HeadPitchSet, fractionMaxSpeed)
# new code
resp = headResponse()
resp.HeadYaw= HeadYaw
resp.HeadPitch= HeadPitch
return resp
Assuming that your service is in a file called head.srv
Note that for headResponse to be defined you may also need to add a line like this towards the top of your source:
from your_pkg.srv import *