Skip to content

Commit 8ce0d92

Browse files
committed
Address review comments
Signed-off-by: Barry Xu <[email protected]>
1 parent 9684067 commit 8ce0d92

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

ros2action/ros2action/verb/echo.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ def add_arguments(self, parser, cli_name):
8686
'multiple action interfaces. Action interfaces include "GOAL_SERVICE", '
8787
'"CANCEL_SERVICE", "RESULT_SERVICE", "FEEDBACK_TOPIC" and "STATUS_TOPIC". '
8888
'If this option is not set, output messages from all interfaces of the action.')
89-
parser.add_argument(
90-
'--queue-size', '-q', type=unsigned_int, default=100,
91-
help='The length of output message queue. The default is 100.')
9289
parser.add_argument(
9390
'--csv', action='store_true', default=False,
9491
help=(
@@ -142,7 +139,7 @@ def main(self, *, args):
142139
raise RuntimeError(f"The service type '{args.action_type}' is invalid")
143140

144141
if action_module is None:
145-
raise RuntimeError('Could not load the type for the passed action')
142+
raise RuntimeError(f"Could not load the action type for '{args.action_type}'")
146143

147144
self.csv = args.csv
148145
self.truncate_length = args.truncate_length if not args.full_length else None
@@ -165,8 +162,9 @@ def main(self, *, args):
165162
status_topic = args.action_name + '/_action/status'
166163
status_topic_type = action_module.Impl.GoalStatusMessage
167164

168-
# Queue for messages from above topic
169-
self.output_msg_queue = queue.Queue(args.queue_size)
165+
# Queue for messages from above topic. The queue size is set to 100.
166+
# If the queue is full, the message will be dropped.
167+
self.output_msg_queue = queue.Queue(100)
170168

171169
run_thread = True
172170
# Create a thread to output message from output_queue
@@ -184,6 +182,9 @@ def message_handler():
184182

185183
with NodeStrategy(args) as node:
186184
send_goal_event_sub = None
185+
# TODO: The QoS for the service event publisher, feedback publisher and status
186+
# publisher can be specified by the user, so new parameters need to be added to allow
187+
# specifying QoS of subscription to replace the current fixed QoS.
187188
if ActionInterfaces.GOAL_SERVICE.value in output_interface_list:
188189
send_goal_event_sub: Subscription[EventMessage] = node.create_subscription(
189190
send_goal_event_msg_type,

ros2action/test/fixtures/fibonacci_action_introspection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class FibonacciActionClient(Node):
5959
def __init__(self):
6060
super().__init__('fibonacci_action_client', namespace='/test')
6161
self._action_client = ActionClient(self, Fibonacci, 'fibonacci')
62+
self._action_client.configure_introspection(
63+
self.get_clock(), qos_profile_system_default, ServiceIntrospectionState.CONTENTS)
6264
self._timer = self.create_timer(2, self._timer_callback)
6365

6466
def _timer_callback(self):
@@ -95,7 +97,6 @@ def goal_response_callback(self, future):
9597
def get_result_callback(self, future):
9698
result = future.result().result
9799
self.get_logger().info('Result: {0}'.format(result.sequence))
98-
# rclpy.shutdown()
99100

100101
def feedback_callback(self, feedback_msg):
101102
feedback = feedback_msg.feedback

ros2action/test/test_echo.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,21 @@ def test_echo(self):
110110

111111
# Define the desired output message block.
112112
expected_output = [
113+
[
114+
'interface: GOAL_SERVICE',
115+
'info:',
116+
' event_type: REQUEST_SENT',
117+
' stamp:',
118+
re.compile(r' sec: \d+'),
119+
re.compile(r' nanosec: \d+'),
120+
" client_gid: '<array type: uint8[16]>'",
121+
re.compile(r' sequence_number: \d+'),
122+
"request: '<sequence type: test_msgs/action/Fibonacci_SendGoal_Request[1], "
123+
"length: 1>'",
124+
"response: '<sequence type: test_msgs/action/Fibonacci_SendGoal_Response[1], "
125+
"length: 0>'",
126+
'---',
127+
],
113128
[
114129
'interface: GOAL_SERVICE',
115130
'info:',
@@ -140,6 +155,21 @@ def test_echo(self):
140155
"length: 1>'",
141156
'---',
142157
],
158+
[
159+
'interface: GOAL_SERVICE',
160+
'info:',
161+
' event_type: RESPONSE_RECEIVED',
162+
' stamp:',
163+
re.compile(r' sec: \d+'),
164+
re.compile(r' nanosec: \d+'),
165+
" client_gid: '<array type: uint8[16]>'",
166+
re.compile(r' sequence_number: \d+'),
167+
"request: '<sequence type: test_msgs/action/Fibonacci_SendGoal_Request[1], "
168+
"length: 0>'",
169+
"response: '<sequence type: test_msgs/action/Fibonacci_SendGoal_Response[1], "
170+
"length: 1>'",
171+
'---',
172+
],
143173
[
144174
'interface: STATUS_TOPIC',
145175
"status_list: '<sequence type: action_msgs/msg/GoalStatus, length: 1>'",

0 commit comments

Comments
 (0)