Skip to content

Commit

Permalink
return nil if :get-result called without sending a goal
Browse files Browse the repository at this point in the history
  • Loading branch information
k-okada committed Oct 29, 2023
1 parent 795e764 commit 09a70e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion roseus/euslisp/actionlib.l
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@
(if (eq (send self :get-state) actionlib_msgs::GoalStatus::*preempted*)
(ros::ros-warn "[~A] :wait-for-result finished with preempted status" name-space))
(eq (send self :get-state) actionlib_msgs::GoalStatus::*succeeded*)))
(:get-result () (send (send comm-state :latest-result) :result))
(:get-result ()
(if (send comm-state :latest-result)
(send (send comm-state :latest-result) :result)
(progn
(ros::ros-error "[~A] :get-result called without sending goal, returns null result" name-space)
nil))) ;; return nil instead of (instance action-result-class :init)
(:get-state ()
(let (state)
(setq state (send (send comm-state :latest-goal-status) :status))
Expand Down
2 changes: 2 additions & 0 deletions roseus/test/test-actionlib.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
<node name="fibonacci_client" pkg="roseus" type="roseus" args="$(find roseus)/test/fibonacci-client.l" />
<test test-name="test_actionlib_client" pkg="roseus" type="roseus" args="$(find roseus)/test/test-actionlib.l"
time-limit="600" retry="3"/>
<test test-name="test_actionlib_client_result_before_start" pkg="roseus" type="roseus" args="$(find roseus)/test/test-actionlib-get-result-before-start.l"
time-limit="60" retry="1"/>
</launch>

0 comments on commit 09a70e6

Please sign in to comment.