Custom action goal: "has no attribute" error
I have created a custom action called TakePosition.action with the following data :
#goal
int64 x
int64 y
int64 z
string position
---
#result
bool completed
---
#feeback
string report
When I try using my TakePositionActionGoal in my client.py script, I get an error saying :
File "/home/sisko/catkin_ws/devel/lib/python2.7/dist-packages/sweepbot_tools/msg/_TakePositionActionGoal.py", line 122, in serialize
buff.write(_get_struct_3q().pack(_x.goal.x,
_x.goal.y, _x.goal.z)) AttributeError: 'TakePositionActionGoal' object has no attribute 'x'
Here's my client.py script :
#! /usr/bin/env python
from __future__ import print_function
import rospy
from sweepbot_tools.msg import TakePositionAction, TakePositionActionGoal
import actionlib
def setPosition():
client = actionlib.SimpleActionClient('sweepbot_movebase_server', TakePositionAction)
client.wait_for_server()
goal = TakePositionActionGoal()
goal.goal.x = 7
goal.goal.y = 7
goal.goal.z = 7
goal.goal.position = ''
client.send_goal(goal)
client.wait_for_result()
return client.get_result()
if __name__ == '__main__':
try:
rospy.init_node('sweepbot_movebase_client')
result = setPosition()
rospy.logdebug(result)
except rospy.ROSInterruptException:
print("program interrupted before completion", file=sys.stderr)
The porpose is to create pose data which I can pass to my custom action server which would calls move_base with the recieved pose.
Clearly there is an x attribute in my action definition. I don't understand what the souce of this error is.
I've updated the title of your question to better reflect the problem you were having.
Seeing as action servers are servers, using the words "not responding" makes it seem there is something wrong with your server, while you're having problems writing the client script.