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

"ERROR: Broken Pipe" on simple action server

asked 2019-06-04 09:20:31 -0600

dmb gravatar image

Apologies if this is a newbie error but I can't find any previous posts on the subject.

I have a simple Action server that takes two arguments, a speed and duration, and outputs a message along the lines of "Drive in a square at 100 speed, 2 seconds per side".

It appears to work but I see a "Broken Pipe" message in the output, along with a TCP/IP connection failed warning:

[DEBUG] [1559657743.097583]: connecting to storm 33977
[DEBUG] [1559657743.173149]: The action server has received a new goal request
[DEBUG] [1559657743.184566]: A new goal /square_action_client-1-1559657743.170has been recieved by the single goal action server
[DEBUG] [1559657743.209280]: Accepting a new goal
[DEBUG] [1559657743.218293]: Accepting goal, id: /square_action_client-1-1559657743.170, stamp: 1559657743.17
[DEBUG] [1559657743.227325]: Drive in a square at 100 speed, 2 seconds per side
[DEBUG] [1559657743.235513]: Setting status to succeeded on goal, id: /square_action_client-1-1559657743.170, stamp: 1559657743.17
[DEBUG] [1559657743.310479]: connecting to storm 33977
[DEBUG] [1559657743.315485]: connecting to storm 33977
[WARN] [1559657744.034893]: Inbound TCP/IP connection failed: connection from sender terminated before handshake header received. 0 bytes were received. Please check sender for additional details.
[DEBUG] [1559657744.339137]: connecting to storm 33977
[DEBUG] [1559657748.262286]: Item stamp: 
  secs: 1559657743
  nsecs: 170017957
id: "/square_action_client-1-1559657743.170" with destruction time of 1559657743.243 being removed from list.  Now = 1559657748.259

This might be expected behaviour I guess (client has exited so nothing to read) but I wondered if maybe I needed to signal that I was exiting somehow ?

Source code below in case it helps.

Thanks for any help or advice,

David

Square_action_server.py:

#! /usr/bin/env python
import rospy
import time
import actionlib
from storm.msg import SquareAction, SquareGoal, SquareResult

def drive_square(goal):
        start_time = time.time()

        # extract the goal parameters
        speed = goal.speed
        secs_per_side = goal.secs_per_side.to_sec()

        # perform the necessary actions

        rospy.logdebug("Drive in a square at %d speed, %d seconds per side", speed, secs_per_side)

        # send the result
        result = SquareResult()
        result.time_driven = rospy.Duration.from_sec(time.time() - start_time)
        result.updates_sent = 0
        server.set_succeeded(result)

rospy.init_node('ROS_SQUARE_DRIVE', log_level=rospy.DEBUG)

server = actionlib.SimpleActionServer('square_drive', SquareAction, drive_square, False)
server.start()
rospy.spin()

Square_action_client.py:

#! /usr/bin/env python
import rospy
import actionlib
from storm.msg import SquareAction, SquareGoal, SquareResult

rospy.init_node('square_action_client')
client = actionlib.SimpleActionClient('square_drive', SquareAction)
client.wait_for_server()

# Drive in a square at a specified speed, for a specified number of seconds per side
# 0 is full reverse, 180 is full lspeed forward, 90 is stopped

# e.g. drive forward at speed 100 for 2 seconds per side

goal = SquareGoal()
goal.secs_per_side = rospy.Duration.from_sec(2.0)
goal.speed = 100

client.send_goal(goal)
client.wait_for_result()
print('Time elapsed: %f'%(client.get_result().time_driven.to_sec()))
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2019-06-11 03:13:21 -0600

VictorCP gravatar image

Hi,

I would say that this might be happening because the action client finishes and the server can't find it anymore. Also I would suggest to use rospy logging for all your outputs.

Best.

edit flag offensive delete link more
1

answered 2019-06-11 03:59:45 -0600

EdwinvanEmmerik gravatar image

updated 2019-06-11 09:24:09 -0600

1: From the actionlib tutorials (http://wiki.ros.org/actionlib_tutoria...), is this what is happening?

“The action server will process the goal and eventually terminate. We want the result from the termination, but we wait until the server has finished with the goal.“

2: take a good look in difference of how you define your server compared to the python tutorials. You define it as actionlib.simpleActionServer(). While in the tutorial they use “FibonacciAction()”.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-06-04 09:20:31 -0600

Seen: 1,470 times

Last updated: Jun 11 '19