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

Allow 3d Model overrides #1440

Merged
merged 4 commits into from
Feb 13, 2023

Conversation

Williangalvani
Copy link
Member

@Williangalvani Williangalvani commented Feb 4, 2023

Screenshot 2023-02-04 at 02 49 08

as a bonus commit, this fixed #1455

@Williangalvani Williangalvani changed the title Model overrides Allow 3d Model overrides Feb 4, 2023
@Williangalvani Williangalvani force-pushed the model_overrides branch 2 times, most recently from 1753e45 to 1c9a057 Compare February 4, 2023 05:50
@Williangalvani
Copy link
Member Author

onte interesting issue here. we cant make 404 fail quietly. so even if it works as intended, there's a bunch of red lines in the terminal. I tries using the HEAD request to check if things exist, but it also 404s. so maybe we could add something in nginx to make it fail in a nicer way.

@Williangalvani Williangalvani force-pushed the model_overrides branch 5 times, most recently from 5bb214d to 5853437 Compare February 9, 2023 15:57
@Williangalvani
Copy link
Member Author

for testing a custom model, set frame to VECTORED_6DOF and unzip this package at /usr/blueos/userdata:
userdata.zip

@Williangalvani
Copy link
Member Author

you should see something like this
Screenshot 2023-02-09 at 13 11 52

@Williangalvani Williangalvani marked this pull request as ready for review February 9, 2023 16:46
@Williangalvani Williangalvani requested review from patrickelectric and ES-Alexander and removed request for patrickelectric February 9, 2023 16:46
core/frontend/src/types/autopilot/parameter-rover-enums.ts Outdated Show resolved Hide resolved
Comment on lines 15 to 150
export enum SERVO_FUNCTION {
// TODO: double-check
DISABLED = 0,
RCPASSTHRU = 1,
FLAP = 2,
FLAP_AUTO = 3,
AILERON = 4,
MOUNT_PAN = 6,
MOUNT_TILT = 7,
MOUNT_ROLL = 8,
MOUNT_OPEN = 9,
CAMERA_TRIGGER = 10,
RELEASE = 11,
MOUNT2_PAN = 12,
MOUNT2_TILT = 13,
MOUNT2_ROLL = 14,
MOUNT2_OPEN = 15,
DIFFERENTIALSPOILER1 = 16,
DIFFERENTIALSPOILER2 = 17,
AILERONWITHINPUT = 18,
ELEVATOR = 19,
ELEVATORWITHINPUT = 20,
RUDDER = 21,
FLAPERON1 = 24,
FLAPERON2 = 25,
GROUNDSTEERING = 26,
PARACHUTE = 27,
EPM = 28,
LANDINGGEAR = 29,
ENGINERUNENABLE = 30,
HELIRSC = 31,
HELITAILRSC = 32,
MOTOR1 = 33,
MOTOR2 = 34,
MOTOR3 = 35,
MOTOR4 = 36,
MOTOR5 = 37,
MOTOR6 = 38,
MOTOR7 = 39,
MOTOR8 = 40,
MOTORTILT = 41,
RCIN1 = 51,
RCIN2 = 52,
RCIN3 = 53,
RCIN4 = 54,
RCIN5 = 55,
RCIN6 = 56,
RCIN7 = 57,
RCIN8 = 58,
RCIN9 = 59,
RCIN10 = 60,
RCIN11 = 61,
RCIN12 = 62,
RCIN13 = 63,
RCIN14 = 64,
RCIN15 = 65,
RCIN16 = 66,
IGNITION = 67,
CHOKE = 68,
STARTER = 69,
THROTTLE = 70,
TRACKERYAW = 71,
TRACKERPITCH = 72,
THROTTLELEFT = 73,
THROTTLERIGHT = 74,
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export enum SERVO_FUNCTION {
// TODO: double-check
DISABLED = 0,
RCPASSTHRU = 1,
FLAP = 2,
FLAP_AUTO = 3,
AILERON = 4,
MOUNT_PAN = 6,
MOUNT_TILT = 7,
MOUNT_ROLL = 8,
MOUNT_OPEN = 9,
CAMERA_TRIGGER = 10,
RELEASE = 11,
MOUNT2_PAN = 12,
MOUNT2_TILT = 13,
MOUNT2_ROLL = 14,
MOUNT2_OPEN = 15,
DIFFERENTIALSPOILER1 = 16,
DIFFERENTIALSPOILER2 = 17,
AILERONWITHINPUT = 18,
ELEVATOR = 19,
ELEVATORWITHINPUT = 20,
RUDDER = 21,
FLAPERON1 = 24,
FLAPERON2 = 25,
GROUNDSTEERING = 26,
PARACHUTE = 27,
EPM = 28,
LANDINGGEAR = 29,
ENGINERUNENABLE = 30,
HELIRSC = 31,
HELITAILRSC = 32,
MOTOR1 = 33,
MOTOR2 = 34,
MOTOR3 = 35,
MOTOR4 = 36,
MOTOR5 = 37,
MOTOR6 = 38,
MOTOR7 = 39,
MOTOR8 = 40,
MOTORTILT = 41,
RCIN1 = 51,
RCIN2 = 52,
RCIN3 = 53,
RCIN4 = 54,
RCIN5 = 55,
RCIN6 = 56,
RCIN7 = 57,
RCIN8 = 58,
RCIN9 = 59,
RCIN10 = 60,
RCIN11 = 61,
RCIN12 = 62,
RCIN13 = 63,
RCIN14 = 64,
RCIN15 = 65,
RCIN16 = 66,
IGNITION = 67,
CHOKE = 68,
STARTER = 69,
THROTTLE = 70,
TRACKERYAW = 71,
TRACKERPITCH = 72,
THROTTLELEFT = 73,
THROTTLERIGHT = 74,
}
export enum SERVO_FUNCTION {
GPIO = -1,
DISABLED = 0,
RCPASSTHRU = 1,
FLAP = 2,
FLAPAUTO = 3,
AILERON = 4,
MOUNT1YAW = 6,
MOUNT1PITCH = 7,
MOUNT1ROLL = 8,
MOUNT1RETRACT = 9,
CAMERATRIGGER = 10,
MOUNT2YAW = 12,
MOUNT2PITCH = 13,
MOUNT2ROLL = 14,
MOUNT2RETRACT = 15,
DIFFERENTIALSPOILERLEFT1 = 16,
DIFFERENTIALSPOILERRIGHT1 = 17,
ELEVATOR = 19,
RUDDER = 21,
SPRAYERPUMP = 22,
SPRAYERSPINNER = 23,
FLAPERONLEFT = 24,
FLAPERONRIGHT = 25,
GROUNDSTEERING = 26,
PARACHUTE = 27,
GRIPPER = 28,
LANDINGGEAR = 29,
ENGINERUNENABLE = 30,
HELIRSC = 31,
HELITAILRSC = 32,
MOTOR1 = 33,
MOTOR2 = 34,
MOTOR3 = 35,
MOTOR4 = 36,
MOTOR5 = 37,
MOTOR6 = 38,
MOTOR7 = 39,
MOTOR8 = 40,
TILTMOTORSFRONT = 41,
TILTMOTORSREAR = 45,
TILTMOTORREARLEFT = 46,
TILTMOTORREARRIGHT = 47,
RCIN1 = 51,
RCIN2 = 52,
RCIN3 = 53,
RCIN4 = 54,
RCIN5 = 55,
RCIN6 = 56,
RCIN7 = 57,
RCIN8 = 58,
RCIN9 = 59,
RCIN10 = 60,
RCIN11 = 61,
RCIN12 = 62,
RCIN13 = 63,
RCIN14 = 64,
RCIN15 = 65,
RCIN16 = 66,
IGNITION = 67,
STARTER = 69,
THROTTLE = 70,
TRACKERYAW = 71,
TRACKERPITCH = 72,
THROTTLELEFT = 73,
THROTTLERIGHT = 74,
TILTMOTORFRONTLEFT = 75,
TILTMOTORFRONTRIGHT = 76,
ELEVONLEFT = 77,
ELEVONRIGHT = 78,
VTAILLEFT = 79,
VTAILRIGHT = 80,
BOOSTTHROTTLE = 81,
MOTOR9 = 82,
MOTOR10 = 83,
MOTOR11 = 84,
MOTOR12 = 85,
DIFFERENTIALSPOILERLEFT2 = 86,
DIFFERENTIALSPOILERRIGHT2 = 87,
WINCH = 88,
MAINSAIL = 89,
CAMERAISO = 90,
CAMERAAPERTURE = 91,
CAMERAFOCUS = 92,
CAMERASHUTTERSPEED = 93,
SCRIPT1 = 94,
SCRIPT2 = 95,
SCRIPT3 = 96,
SCRIPT4 = 97,
SCRIPT5 = 98,
SCRIPT6 = 99,
SCRIPT7 = 100,
SCRIPT8 = 101,
SCRIPT9 = 102,
SCRIPT10 = 103,
SCRIPT11 = 104,
SCRIPT12 = 105,
SCRIPT13 = 106,
SCRIPT14 = 107,
SCRIPT15 = 108,
SCRIPT16 = 109,
NEOPIXEL1 = 120,
NEOPIXEL2 = 121,
NEOPIXEL3 = 122,
NEOPIXEL4 = 123,
RATEROLL = 124,
RATEPITCH = 125,
RATETHRUST = 126,
RATEYAW = 127,
WINGSAILELEVATOR = 128,
PROFILED1 = 129,
PROFILED2 = 130,
PROFILED3 = 131,
PROFILEDCLOCK = 132,
WINCHCLUTCH = 133,
SERVONMIN = 134,
SERVONTRIM = 135,
SERVONMAX = 136,
SAILMASTROTATION = 137,
ALARM = 138,
ALARMINVERTED = 139,
RCIN1SCALED = 140,
RCIN2SCALED = 141,
RCIN3SCALED = 142,
RCIN4SCALED = 143,
RCIN5SCALED = 144,
RCIN6SCALED = 145,
RCIN7SCALED = 146,
RCIN8SCALED = 147,
RCIN9SCALED = 148,
RCIN10SCALED = 149,
RCIN11SCALED = 150,
RCIN12SCALED = 151,
RCIN13SCALED = 152,
RCIN14SCALED = 153,
RCIN15SCALED = 154,
RCIN16SCALED = 155,
}

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

@Williangalvani it appears that the full table was not updated

Copy link
Member Author

Choose a reason for hiding this comment

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

I hadn't realizes you added the new stuff. nice. updated.

Comment on lines 311 to 341
hideIrrelevantParts(): void {
if (!this.gripper_is_present) {
this.setAlphas(0.0, 'gripper')
}
if (!this.lights1_are_present) {
this.setAlphas(0.0, 'lights 1')
}
if (!this.lights2_are_present) {
this.setAlphas(0.0, 'lights 2')
}
if (!this.ping1D_is_present) {
this.setAlphas(0.0, 'ping1d')
}
if (!this.ping360_is_present) {
this.setAlphas(0.0, 'ping360')
}
},
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible for us to handle this via the json ?

Copy link
Member Author

Choose a reason for hiding this comment

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

i cant think of way to do this..

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we enforce the name needing to be the bit before the is_present? The names are already close to that being the case, and then the json could just list the properties of interest, and the .vue file could just check something like

if (!this.{name}_is_present) {
    this.setAlphas(0.0, name)
}

In Python that would be something like

if not getattr(self, f'{name}_is_present', None):
    self.set_alphas(0.0, name)

Not sure what the typescript equivalent of getattr is.

Of course the X_is_present functions still need to be defined somewhere, but that structure would at least allow selecting predefined functions 🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we cant really rely on names, as the code gets minified

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you make a dictionary mapping names to functions, and if the name is in the dictionary you call the function?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, but I don't see the point right now. if planes dont support the gripper, for example, they can just omit it from the 3d model.

Copy link
Member Author

Choose a reason for hiding this comment

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

though we should probably improve the gripper detection

Copy link
Collaborator

@ES-Alexander ES-Alexander left a comment

Choose a reason for hiding this comment

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

Looks ok to me, but I haven't extensively reviewed the code - I just want the feature :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-needed Change needs to be documented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vehicle setup: Enclosure is opaque when first loaded [chrome only]
3 participants