From 0e2b3781aec055be6b7ad6fd562b0c03a4c9033e Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 18 Nov 2016 18:52:15 +1100 Subject: [PATCH] AP_Gripper: a valid() method --- libraries/AP_Gripper/AP_Gripper.cpp | 1 + libraries/AP_Gripper/AP_Gripper.h | 3 +++ libraries/AP_Gripper/AP_Gripper_Backend.h | 3 +++ 3 files changed, 7 insertions(+) diff --git a/libraries/AP_Gripper/AP_Gripper.cpp b/libraries/AP_Gripper/AP_Gripper.cpp index 30411405b6..7392c01030 100644 --- a/libraries/AP_Gripper/AP_Gripper.cpp +++ b/libraries/AP_Gripper/AP_Gripper.cpp @@ -125,6 +125,7 @@ PASS_TO_BACKEND(update) return false; \ } +PASS_TO_BACKEND(valid) PASS_TO_BACKEND(released) PASS_TO_BACKEND(grabbed) diff --git a/libraries/AP_Gripper/AP_Gripper.h b/libraries/AP_Gripper/AP_Gripper.h index 68fb5792a7..fde973abf7 100644 --- a/libraries/AP_Gripper/AP_Gripper.h +++ b/libraries/AP_Gripper/AP_Gripper.h @@ -44,6 +44,9 @@ public: // update - should be called at at least 10hz void update(); + // valid - returns true if we have a gripper and it should work + bool valid() const; + static const struct AP_Param::GroupInfo var_info[]; // parameters diff --git a/libraries/AP_Gripper/AP_Gripper_Backend.h b/libraries/AP_Gripper/AP_Gripper_Backend.h index 868f4b9be4..06b68d51fb 100644 --- a/libraries/AP_Gripper/AP_Gripper_Backend.h +++ b/libraries/AP_Gripper/AP_Gripper_Backend.h @@ -34,6 +34,9 @@ public: // release - move the servo output to the release position virtual void release() = 0; + // valid - returns true if the backend should be working + bool valid() const { return true; }; + // released - returns true if currently in released position virtual bool released() const = 0;