Skip to content

question on javascript programming #11725

Description

@CristianoUspace

Hi there, I'm familiarising with INAV 9.1.0. Looking at JavaProgramming, I'm wondering if I can use it to move elevons during transition for managing the asset change from TAIL SITTING to Horizontal Flight. Something like that:

where:

RC Channel 7 is used for mode selection (high is mixer control 2 - QUAD configuration, with IMU axis offset ON); mid is transition; low is fixed wing mixer control 1);
RC Channel 6 (is used in the servo mixer to move simultanously the two elevons up and down).

Ideally, when switching from TAIL to fixed wing, elevons should slightly pitch the nose down; when switching from FIXED wing should pitch the nose up. Would it work like that?

/// SMOOTH TRASITION FOR TAIL SITTER

if (inav.rc[6].low || inav.rc[6].high) {

	inav.gvar[0] = 0;

}

if (inav.gvar[1] = Null || inav.gvar[1] = 0) {
inav.gvar[1] = inav.rc[6];
}

if (inav.gvar[1] != inav.rc[6]) {

	if (inav.rc[6].mid && inav.gvar[1] > inav.rc[6]) { // from HIGH to MID - > transition TAIL to fixed wing
		inav.gvar[0] = 1;
	}

	if (inav.rc[6].mid && inav.gvar[1] < inav.rc[6]) { // from LOW to MID - > transition fixed wing to TAIL
		inav.gvar[0] = 2;
	}



	inav.gvar[1] = inav.rc[6];
	}

if (inav.gvar[0] == 1) {

		inav.rc[5] = 1750;
}

if (inav.gvar[0] == 2) {
inav.rc[5] = 1250;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions