Skip to content

Guard against failed take when taking action messages#281

Merged
jacobperron merged 1 commit intomasterfrom
python_action_tests
Mar 7, 2019
Merged

Guard against failed take when taking action messages#281
jacobperron merged 1 commit intomasterfrom
python_action_tests

Conversation

@jacobperron
Copy link
Copy Markdown
Member

@jacobperron jacobperron commented Mar 7, 2019

Some middlewares (e.g. Connext and OpenSplice) appear to send empty messages after a successful service call which results in a 'failed take'.
It is unclear if this is correct behavior from the rmw/rcl layers, but it doesn't hurt to guard against this scenario.

Connects to ros2/system_tests#332.

Some middlewares (e.g. Connext and OpenSplice) appear to send empty
messages after a successful service call which results in a 'failed
take'.
It is unclear if this is correct behavior from the rmw/rcl layers, but it
doesn't hurt to guard against this scenario.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron jacobperron added the in progress Actively being worked on (Kanban column) label Mar 7, 2019
@jacobperron jacobperron self-assigned this Mar 7, 2019
@jacobperron jacobperron added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Mar 7, 2019
@wjwwood
Copy link
Copy Markdown
Member

wjwwood commented Mar 7, 2019

For reference, rclcpp also allows take to fail, but only if the reason is "RET_TAKE_FAILED" (or similar):

https://github.com/ros2/rclcpp/blob/d2d9ad8796cb0528351482b1f55ba36fffaa9728/rclcpp/src/rclcpp/executor.cpp#L324-L332

This can happen if the sample is invalid (DDS's way of indicating the instance has been disposed), but we don't know that until we try to take (i.e. we don't know that is the reason rather than data being available after being woken up from the waitset).

Copy link
Copy Markdown
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Looks like this is doing the same thing as rclcpp as @wjwwood described

if (ret != RCL_RET_ACTION_CLIENT_TAKE_FAILED && ret != RCL_RET_ACTION_SERVER_TAKE_FAILED) { \
PyErr_Format(PyExc_RuntimeError, \
"Failed to take " #Type ": %s", rcl_get_error_string().str); \
rcl_reset_error(); \
return NULL; \
} \
return pytuple; \

@jacobperron jacobperron merged commit ba90da4 into master Mar 7, 2019
@jacobperron jacobperron deleted the python_action_tests branch March 7, 2019 19:10
@jacobperron jacobperron removed the in review Waiting for review (Kanban column) label Mar 7, 2019
jacobperron added a commit that referenced this pull request Mar 7, 2019
Some middlewares (e.g. Connext and OpenSplice) send invalid messages to indicate an instance has been disposed which results in a 'failed take'.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
nuclearsandwich pushed a commit that referenced this pull request Mar 10, 2019
* Add Action Client (#262)

* Add rclpy_action module

With functions for creating and destroying action clients.

* Implement action client

* Move common conversion function and typedefs to shared header file (impl/common.h)

* Add tests using mock action server

* Add action module for aggregating action related submodules

* Extend Waitable API so executors are aware of Futures

* Move check_for_type_support() to its own module

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Fix Executor not executing tasks if there are no ready entities in the wait set (#272)

If a task is created, then trigger the Executors guard condition. This will wake any blocking call to `rcl_wait()`.
In this scenario, no work is yielded, so we also have to move the check for 'in-progress' tasks into the wait loop.

Added a unit test to reproduce the issue.

This resolves an issue in some cases where the result response from the action server is never processed, therefore never reaching the action client.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Fix Node's reference to executor (#275)

Previously, if a `Node` was added to an `Executor` using the executors `add_node` method, then nodes `executor` property would return `None`.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Abstract type conversions into functions (#269)

* Abstract type conversions into functions

This helps with readability and maintainability.
Also eliminated use of assertions during conversions, defering to exceptions.

* Move common C functions to a shared library 'rclpy_common'

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Add ActionServer (#270)

* Add Action server functions to extension module
    * Separated service related macros into separate request and response calls
* Add server goal handle functions to extension module
* Update Action extension module to use conversion functions
* Add implementation of Python ActionServer
    * Handles goal and cancel requests, responds, and calls user-defined functions for executing goals.
    * Handle result requests
    * Handle expired goals
    * Publish goal status array and feedback
* Add `handle_accepted_callback` to ActionServer

Upon accepting a goal, the provided `handle_accepted_callback` is called with a reference to the goal handle.
The user can then decide to execute the goal or defer.
If `handle_accepted_callback` is not provided, then the default behavior is to execute the goal handle immediately.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Enable test using MultiThreadedExecutor (#280)

Signed-off-by: Jacob Perron <jacob@openrobotics.org>

* Guard against failed take when taking action messages (#281)

Some middlewares (e.g. Connext and OpenSplice) send invalid messages to indicate an instance has been disposed which results in a 'failed take'.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants