Skip to content

Commit

Permalink
AP_Gripper: Add feedback when already in state
Browse files Browse the repository at this point in the history
  • Loading branch information
lthall authored and peterbarker committed Aug 9, 2022
1 parent 64d69c5 commit 4bf622d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions libraries/AP_Gripper/AP_Gripper_Servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ void AP_Gripper_Servo::init_gripper()

void AP_Gripper_Servo::grab()
{
// check if we are already grabbing
if (config.state == AP_Gripper::STATE_GRABBING) {
// do nothing
return;
}

// check if we are already grabbed
if (config.state == AP_Gripper::STATE_GRABBED) {
// inform user that we are already grabbed
gcs().send_text(MAV_SEVERITY_INFO, "Gripper load grabbing");
return;
}

// flag we are active and grabbing cargo
config.state = AP_Gripper::STATE_GRABBING;

Expand All @@ -28,6 +41,19 @@ void AP_Gripper_Servo::grab()

void AP_Gripper_Servo::release()
{
// check if we are already releasing
if (config.state == AP_Gripper::STATE_RELEASING) {
// do nothing
return;
}

// check if we are already released
if (config.state == AP_Gripper::STATE_RELEASED) {
// inform user that we are already released
gcs().send_text(MAV_SEVERITY_INFO, "Gripper load released");
return;
}

// flag we are releasing cargo
config.state = AP_Gripper::STATE_RELEASING;

Expand Down

0 comments on commit 4bf622d

Please sign in to comment.