FlexBE / flexbe_behavior_engine

Contains the behavior engine FlexBE.
Other
47 stars 14 forks source link

Fixed bug when trying to get result state/GoalStatus. #16

Closed YBachmann closed 6 months ago

YBachmann commented 7 months ago

Hi,

this should fix the bug from Issue https://github.com/FlexBE/flexbe_behavior_engine/issues/3.

It is now possible to use ProxyActionClient.get_state("my_test_topic") to query the result state/GoalStatus:

if self._action_client.has_result(self._topic):
    result = self._action_client.get_result(self._topic)
    result_state = self._action_client.get_state(self._topic)
    Logger.loginfo(f'Got result from action server: {result=} ; {result_state=}')

Output:

[start_behavior-4] [INFO] [1711467116.679000009] [behavior]: Got result from action server: result=nav2_msgs.action.NavigateToPose_Result(result=std_msgs.msg.Empty()) ; result_state=4

In this case self._action_client.get_state(self._topic) returned 4 which corresponds to STATUS_SUCCEEDED (see action_msgs/msg/GoalStatus.msg).

PS: I am not sure whether the humble branch is the right one for this pull request, feel free to change the target branch if needed.

dcconner commented 7 months ago

Received. I will need to review this in light of some changes in ros2-devel / iron branches. It will probably be mid-May before I will find the bandwidth to work on this with my team. Thanks for the PR.

dcconner commented 6 months ago

I think we should clear the result_status when we remove result. I'll be doing some testing over the next week, so I've pulled your change locally. `
@classmethod def remove_result(cls, topic):

    ProxyActionClient._result[topic] = None
    ProxyActionClient._result_status[topic] = None

`

dcconner commented 6 months ago

incorporated into humble, iron, rolling, and ros2-devel branches