Jump to content

[0.90] [DEV] Plane Mode - Swap Yaw/Roll in Flight


zengei

Recommended Posts

  • 2 weeks later...

Hello Zengei,

Your mod is a lifesaver as my stick does not allow swapping axes in the profiler (despite having three shift modes :/).

Unfortunately, I found a bug: if no control input is given either on roll or yaw in plane mode, the trims are not applied, either. The pitch indicator doesn't move either, although pitch input is in fact applied to the craft.

I think the offending piece of code is in turning the autopilot on and off explicitly. If fly with the SAS off, but by setting FlightGlobals.ActiveVessel.Autopilot.Enabled = true I guess it's forced on anyway?

I wonder if it is necessary to turn the autopilot on and off (and mess with SAS) in the first place? As the swapping occurs in OnPreAutopilotUpdate, it appears to me that the yaw and roll can simply be swapped and then it's up to the SAS code to figure out what to do with that (if anything)?

Hope it will be possible to squash this bug. :)

Regards,

Reblet

Link to comment
Share on other sites

Your mod is a lifesaver as my stick does not allow swapping axes in the profiler (despite having three shift modes :/).

Glad you find it useful.

Unfortunately, I found a bug: if no control input is given either on roll or yaw in plane mode, the trims are not applied, either. The pitch indicator doesn't move either, although pitch input is in fact applied to the craft.

Drats, this has been out there suspiciously long without a bug report. :)

I think the offending piece of code is in turning the autopilot on and off explicitly. If fly with the SAS off, but by setting FlightGlobals.ActiveVessel.Autopilot.Enabled = true I guess it's forced on anyway?

I wonder if it is necessary to turn the autopilot on and off (and mess with SAS) in the first place? As the swapping occurs in OnPreAutopilotUpdate, it appears to me that the yaw and roll can simply be swapped and then it's up to the SAS code to figure out what to do with that (if anything)?

This was in the original Aeroplane Mode code and I was suspicious of it too, but not turning them off explicitly causes the autopilot/SAS to flip out. You would think doing it in OnPreAutopilotUpdate would be rather transparent, but unfortunately it's not. I'll look into it and see if there's a better way. Thanks.

Link to comment
Share on other sites

Rablet,

I've pushed some changes that should fix your issues. I've completely revamped how the switching is done now. It's simultaneously both more robust and fragile. More robust because it's effectively doing what a player what do if they changed their controls manually so it should be completely transparent to the SAS, autopilot, and other mods. More fragile because in order to do that I had to perform shenanigans that may break between KSP versions. The tradeoff is well worth it though.

You can download a dev version here (dev version is still marked v0.3.0, but it's the updated code, I swear). If it's not completely broken, I'll push this as v0.4.0.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...