Hello,
I'm launching two agents simultaneously, both of which create an action server, but only one makes a request (hardcoded that way). The problem is that while both processes seem to run fine on their own, the request from the client doesn't seem to reach the server. I don't understand what might be wrong. I'm putting below a snippet of code.
class Agent:
def __init__(self, ...):
..............
self.server = actionlib.SimpleActionServer(rospy.get_name(), doMeFavorAction, self.execute, False)
self.server.start()
def run():
if self.ID == 1: #
print 'I am asking for smth'
self.test_action_server()
def test_action_server(self):
#the names of the agents are as follows /robot[ID]/brain_node
client = actionlib.SimpleActionClient('/robot2/brain_node', doMeFavorAction)
client.wait_for_server()
print rospy.get_name()
print 'I am requesting a favor'
goal = doMeFavorGoal(3500)
print str(goal)
# Fill in the goal here
client.send_goal(goal)
client.wait_for_result(rospy.Duration.from_sec(5.0))
print client.get_result()
def execute(self, goal):
# Do lots of awesome groundbreaking robot stuff here
print dishwasher_id
time.sleep(100)
percent = 0
while percent < 100:
percent = percent + 10
print percent
self.server.publish_feedback(percent)
self.server.set_succeeded(48)
time.sleep(100)
Any help is very much appreciated :).
Originally posted by highWaters on ROS Answers with karma: 176 on 2016-11-27
Post score: 0
Original comments
Comment by gvdhoorn on 2016-11-27:
Could you please check and correct the indentation of your Python code? def run()
and the code below seem to be at the same indent level at the moment, which is rather confusing.
Comment by highWaters on 2016-11-27:
Sorry about that, I fixed!