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

implement GUIDED_HEADING_TYPE default mavlink message #28527

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

Conversation

timtuxworth
Copy link
Contributor

The MAVLink GUIDED_CHANGE_HEADING command will switch from the default to either HEADING_TYPE_HEADING or HEADING_TYPE_COG, but did not have a way to switch back to "default" this adds the code to implement HEADING_TYPE_DEFAULT which will switch the ArduPilot internal plane.guided_state.target_heading_type back to GUIDED_HEADING_NONE, which is the default value with it's own behavior.

@timtuxworth
Copy link
Contributor Author

Follow up to the MAVLink PR ArduPilot/mavlink#372 which adds the implementation. How does this look @peterbarker , @IamPete1 ?

// MAV_RESULT_DENIED means Command is invalid (is supported but has invalid parameters).
return MAV_RESULT_DENIED;
}

plane.g2.guidedHeading.reset_I();

plane.guided_state.target_heading = new_target_heading;
plane.guided_state.target_heading_accel_limit = MAX(packet.param3, 0.05f);
plane.guided_state.target_heading_accel_limit = MAX(is_zero(packet.param3)? 10.0f : packet.param3 , 10.0f); // the, previous limit of 0.05 was 0.29 degrees, not very useful
Copy link
Member

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

@timtuxworth timtuxworth Nov 7, 2024

Choose a reason for hiding this comment

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

As per the comment @IamPete // the, previous limit of 0.05 was 0.29 degrees, not very useful
It was throttling the rate at which heading would change to very, very tiny increments that prevented the follow from being able to track the target plane.

Copy link
Member

Choose a reason for hiding this comment

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

It's a max not a min, it's saying the lowest it can be is 0.05 but it can be larger.

if ( int(packet.param1) == HEADING_TYPE_COURSE_OVER_GROUND) { // compare as nearest int
switch(HEADING_TYPE(packet.param1)) {
case HEADING_TYPE_COURSE_OVER_GROUND:
// course over ground
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's safe to remove these comments, it's obvious from the case what this is for.

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

Successfully merging this pull request may close these issues.

3 participants