AP_Gripper: servo gripper not valid unless aux channel assigned

This commit is contained in:
Peter Barker 2016-12-20 14:18:18 +11:00 committed by Randy Mackay
parent 4c320373eb
commit b4d1d0f918
3 changed files with 15 additions and 1 deletions

View File

@ -35,7 +35,7 @@ public:
virtual void release() = 0;
// valid - returns true if the backend should be working
bool valid() const { return true; };
virtual bool valid() const { return true; };
// released - returns true if currently in released position
virtual bool released() const = 0;

View File

@ -55,3 +55,14 @@ bool AP_Gripper_Servo::grabbed() const
// type-specific periodic updates:
void AP_Gripper_Servo::update_gripper() { };
bool AP_Gripper_Servo::valid() const
{
if (!AP_Gripper_Backend::valid()) {
return false;
}
if (!RC_Channel_aux::function_assigned(RC_Channel_aux::k_gripper)) {
return false;
}
return true;
}

View File

@ -36,6 +36,9 @@ public:
// released - returns true if gripper in released state
bool released() const override;
// valid - returns true if the backend should be working
bool valid() const;
protected:
// type-specific intiailisations: