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

AP_Motors: Heli_Dual: refactor swash plate mixing #25405

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

IamPete1
Copy link
Member

@IamPete1 IamPete1 commented Oct 30, 2023

This re-factors the dual heli swash plate mixing. The motors example was updated to allow setting of the H_DUAL_MODE in the heli test. This allowed a full sweep comparison or each dual heli type.

Results:

Dual_Heli H3 Longitudinal:
        Inputs max change:
                Roll: 0.000000
                Pitch: 0.000000
                Yaw: 0.000000
                Thr: 0.000000
        Outputs max change:
                Mot1: 0.000000
                Mot2: 0.000000
                Mot3: 0.000000
                Mot4: 0.000000
                Mot5: 0.000000
                Mot6: 0.000000
                Mot7: 0.000000
                Mot8: 0.000000
        Limits max change:
                LimR: 0.000000
                LimP: 0.000000
                LimY: 0.000000
                LimThD: 0.000000
                LimThU: 0.000000


Dual_Heli H3 Transverse:
        Inputs max change:
                Roll: 0.000000
                Pitch: 0.000000
                Yaw: 0.000000
                Thr: 0.000000
        Outputs max change:
                Mot1: 0.000000
                Mot2: 0.000000
                Mot3: 0.000000
                Mot4: 0.000000
                Mot5: 0.000000
                Mot6: 0.000000
                Mot7: 0.000000
                Mot8: 0.000000
        Limits max change:
                LimR: 0.000000
                LimP: 0.000000
                LimY: 0.000000
                LimThD: 0.000000
                LimThU: 0.000000


Dual_Heli H3 Intermeshing_or_Coaxial:
        Inputs max change:
                Roll: 0.000000
                Pitch: 0.000000
                Yaw: 0.000000
                Thr: 0.000000
        Outputs max change:
                Mot1: 0.000000
                Mot2: 0.000000
                Mot3: 0.000000
                Mot4: 0.000000
                Mot5: 0.000000
                Mot6: 0.000000
                Mot7: 0.000000
                Mot8: 0.000000
        Limits max change:
                LimR: 0.000000
                LimP: 0.000000
                LimY: 0.000000
                LimThD: 0.000000
                LimThU: 0.000000

Copy link
Contributor

@MattKear MattKear left a comment

Choose a reason for hiding this comment

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

This reads a lot better IMHO, way easier to follow.
I have left a few minor comments which you can take or leave.

libraries/AP_Motors/AP_MotorsHeli_Dual.cpp Outdated Show resolved Hide resolved
libraries/AP_Motors/AP_MotorsHeli_Dual.cpp Outdated Show resolved Hide resolved
libraries/AP_Motors/AP_MotorsHeli_Dual.cpp Outdated Show resolved Hide resolved
}

// look away now, more dodgy param access.
AP_Int8 *dual_mode = (AP_Int8*)motors + AP_MotorsHeli_Dual::var_info[1].offset;
Copy link
Contributor

Choose a reason for hiding this comment

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

How much work would it be to add a proper param accessor in AP_Motors_test? Just thinking to make it easier to add other configs in the future?

Copy link
Member Author

@IamPete1 IamPete1 Nov 1, 2023

Choose a reason for hiding this comment

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

There are two ways,

1: instantiate AP_Param fully and add a base param table so we can get at the params by name.
2: add setters and getters to motors.

1 is slightly better because its contained in the example whereas 2 would need changes in motors that are only used by this example.

We could do it in the future, it should not be a huge job.

Copy link
Contributor

@bnsgeyer bnsgeyer left a comment

Choose a reason for hiding this comment

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

@IamPete1 Thanks for cleaning this up. I am not super picky about this type of stuff and I appreciate you and @Gone4Dirt spending the time cleaning up the code.

I will add that one feature that will need to be added in the future for Tandem heli's is the ability to set a trim longitudinal cyclic input. That way the cyclic pitch can be used to overcome drag and maintain speed without having high trim pitch attitudes. I've had some partners asking about that. But that requires more than just changing the motors class

@CraigElder CraigElder changed the title AP_Motors: Heli_Dual: refactor sawahplate mixing AP_Motors: Heli_Dual: refactor swash plate mixing Nov 13, 2023
@tridge tridge merged commit 5524244 into ArduPilot:master Nov 13, 2023
86 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants