Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for docking clamps, including automated Copter release #27343

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

peterbarker
Copy link
Contributor

@peterbarker peterbarker commented Jun 20, 2024

This work sponsored by FreeSpace.

@peterbarker peterbarker force-pushed the pr/clamp-release branch 4 times, most recently from b03b09e to b1d20bf Compare June 20, 2024 12:28
@peterbarker
Copy link
Contributor Author

Is the option bit really needed?

@@ -142,6 +143,9 @@ void SRV_Channel::aux_servo_function_setup(void)
case k_egg_drop:
set_range(100);
break;
#if AP_TIE_DOWN_CLAMPS_ENABLED
case k_tie_down_release:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my preference for new options would be to set the range to 1.0, its a float now so the value doesn't matter. Eventually I would like to move everything to 0 -> 1 or -1 -> 1

Copy link
Member

@IamPete1 IamPete1 Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could also call set_range from landing gear of course, that would remove the need this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done and done

@IamPete1
Copy link
Member

This does feel like it might be more of a scripting feature. We do have vehicle:is_landing() and vehicle:is_taking_off().

Copy link
Collaborator

@Hwurzburg Hwurzburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to update Parameters.cpp also

@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Jun 24, 2024
@rmackay9
Copy link
Contributor

I agree with @IamPete1, it's so simple that it seems like it could be handled in scripting. I suspect the reason that scripting isn't being used because scripts are a bit more difficult to deploy. If that's the reason then perhaps we should investigate how we could make deploying scripts easier.

Copy link
Collaborator

@Hwurzburg Hwurzburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still needs FLIGHT_OPTIONS metadata addition

@peterbarker
Copy link
Contributor Author

still needs FLIGHT_OPTIONS metadata addition

Added metadata.

@@ -1000,7 +1000,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @Param: FLIGHT_OPTIONS
// @DisplayName: Flight mode options
// @Description: Flight mode specific options
// @Bitmask: 0:Disable thrust loss check, 1:Disable yaw imbalance warning, 2:Release gripper on thrust loss, 3:Require position for arming
// @Bitmask: 0:Disable thrust loss check, 1:Disable yaw imbalance warning, 2:Release gripper on thrust loss, 3:Require position for arming, 4:Enable automated docking clamp release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could simplify this by removing the FLIGHT_OPTIONS bit and just enable the feature if the user defines the SERVOx_FUNCTION.

@@ -54,6 +54,11 @@ void Mode::_TakeOff::start(float alt_cm)
_running = true;
take_off_start_alt = copter.pos_control->get_pos_target_z_cm();
take_off_complete_alt = take_off_start_alt + alt_cm;
#if AP_TIE_DOWN_CLAMPS_ENABLED
if (copter.option_is_enabled(Copter::FlightOption::TAKEOFF_TIEDOWN_RELEASE)) {
copter.landinggear.tie_down_release();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving this outside of landing gear. While the tie-down is perhaps physically on the landing gear I'm not sure it's too related is it?

@@ -1283,6 +1289,26 @@ bool RC_Channel::run_aux_function(AUX_FUNC ch_option, AuxSwitchPos pos, AuxFuncT
return ret;
}

#if AP_TIE_DOWN_CLAMPS_ENABLED
void RC_Channel::do_aux_function_TIE_DOWN_RELEASE(const AuxSwitchPos ch_flag)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about putting "TIE_DOWN_RELEASE" in lower case? It's a little shouty :-)

@rmackay9
Copy link
Contributor

rmackay9 commented Jul 3, 2024

Re lua vs C++, I apparently said C++ was fine at some point (I have no memory) and so if it's OK with @IamPete1 and others, I think it's only fair that we allow it to be added to the c++. I suspect that the flash cost is low and if we did it as a script, I can imagine that adding access to the state takeoff state machine could require as much flash as the C++ equivalent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants