From 09a70e6a835c8726d301796f9a072681db534d5e Mon Sep 17 00:00:00 2001 From: Kei Okada Date: Sun, 29 Oct 2023 17:04:11 +0900 Subject: [PATCH] return nil if :get-result called without sending a goal c.f. https://github.com/yuki-asano/jsk_robot/pull/1#discussion_r1212576855 --- roseus/euslisp/actionlib.l | 7 ++++++- roseus/test/test-actionlib.test | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/roseus/euslisp/actionlib.l b/roseus/euslisp/actionlib.l index b44be29e6..6f250ce78 100644 --- a/roseus/euslisp/actionlib.l +++ b/roseus/euslisp/actionlib.l @@ -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)) diff --git a/roseus/test/test-actionlib.test b/roseus/test/test-actionlib.test index 4b8d610b0..7dd334fff 100644 --- a/roseus/test/test-actionlib.test +++ b/roseus/test/test-actionlib.test @@ -3,5 +3,7 @@ +