Skip to content

Plane: quadplane: improve mav_type reporting for GCS#21596

Open
tajisoft wants to merge 1 commit intoArduPilot:masterfrom
tajisoft:patch-plane-report-vtol-mavtype
Open

Plane: quadplane: improve mav_type reporting for GCS#21596
tajisoft wants to merge 1 commit intoArduPilot:masterfrom
tajisoft:patch-plane-report-vtol-mavtype

Conversation

@tajisoft
Copy link
Contributor

I am using QGC. When connected to QuadPlane, it is recognized as Fixed-Wing. This happens setting Q_MAV_TYPE to the default 0. You can work around this by setting it to something other than 0.
I know this issue has been discussed in #7137 but it doesn't seem to be fixed. 0 is auto so I would expect it to report correctly. I don't know if my suggestion is good, but I'll make a PR. Please give me your comments and advice.

@tajisoft
Copy link
Contributor Author

tajisoft commented Sep 2, 2022

@IamPete1 @peterbarker Thank you for your wonderful support! I pushed a fix. Solved the problem I was facing with my quadplane being misidentified as fixed wing. No further changes are required for this issue at this time. Thank you again.

@IamPete1
Copy link
Member

IamPete1 commented Sep 2, 2022

Looks like this is confusing MAVProxy.

Exception caught: No mode map for (mav_type=20 mav_autopilot=3)

@tajisoft
Copy link
Contributor Author

tajisoft commented Sep 2, 2022

@IamPete1 It seems so. I think I need to add MAV_TYPE handling to pymavlink and MAVProxy. Adding VTOL is expensive, so I would like to modify MAV_TYPE_VTOL_* to be treated as FIXED_WING as before. What do you think?

@tajisoft tajisoft force-pushed the patch-plane-report-vtol-mavtype branch 2 times, most recently from 70571be to 0368353 Compare June 2, 2023 07:50
@tajisoft
Copy link
Contributor Author

tajisoft commented Jun 2, 2023

Fixed pymavlink and MAVProxy. Verified that the following commands display correctly on the simulator.
ArduPilot/pymavlink#823
ArduPilot/MAVProxy#1187

./Tools/autotest/sim_vehicle.py -v Plane --frame quadplane --map --console

@tajisoft
Copy link
Contributor Author

tajisoft commented Jun 2, 2023

I found this confusing Mission Planner. I am looking into it.

@tajisoft
Copy link
Contributor Author

tajisoft commented Jun 2, 2023

I found this confusing Mission Planner. I am looking into it.

I was mistaken. The mode was displayed correctly in Mission Planner.

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

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

I can see TILTROTOR being a thing here.

I don't think we should generally be changing MAV_TYPE mid-flight, however.

Upstream now has MAV_TYPE_VTOL_FIXEDROTOR which would be relevant for many of our motors-frames.

@tajisoft did you want to pursue this?

@peterbarker peterbarker force-pushed the patch-plane-report-vtol-mavtype branch from 0368353 to 9f955db Compare June 5, 2025 02:31
@peterbarker
Copy link
Contributor

peterbarker commented Jun 5, 2025

I have adjusted this PR to only magically change our vehicle type to a known-good subset of the types. So VTOL_QUADROTOR and VTOL_TILTROTOR.

MAVProxy is going to do odd things on other frames, so continuing to use FIXEDWING is the safer solution here until more elaborate GCS changes are made.

Tested in SITL.

Comment on lines +4000 to 4002
if (!available()) {
return MAV_TYPE_FIXED_WING;
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this quadplane check needs to before the mav_type param check. Otherwise I could enable quadplane, set a mav type and disable quadplane again and still have Q_MAV_TYPE taking affect.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @IamPete1. I was tajisoft before and I'm RtoS now.
So you're pointing out that this order is better? I certainly agree.

    if (!available()) {
        return MAV_TYPE_FIXED_WING;
    }

    if (mav_type.get() != 0) {
        return MAV_TYPE(mav_type.get());
    }

Copy link
Member

Choose a reason for hiding this comment

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

Correct.

@IamPete1
Copy link
Member

IamPete1 commented Jun 9, 2025

Need to double check mission planner and QGC still detect the correct vehicle type after this change.

}
switch (motors->get_frame_mav_type()) {
case MAV_TYPE_QUADROTOR:
return MAV_TYPE_VTOL_QUADROTOR;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

So I have to fix it like this:

    switch (motors->get_frame_mav_type()) {
        case MAV_TYPE_QUADROTOR:
            return MAV_TYPE_VTOL_TAILSITTER_QUADROTOR;
        default:
            break;
    }

Copy link
Member

Choose a reason for hiding this comment

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

You would need to check tailsitter is enabled. Something like:

if (tailsitter.enabled() && (motors->get_frame_mav_type() == MAV_TYPE_QUADROTOR)) {
    return MAV_TYPE_VTOL_QUADROTOR; // This is MAV_TYPE_VTOL_TAILSITTER_QUADROTOR upstream
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants