zitron-git / KSPSerialIO

Kerbal Space Program Serial Port IO plugin
60 stars 44 forks source link

Added AutoPilot controlls. #13

Closed GeraKuznetsov closed 7 years ago

GeraKuznetsov commented 7 years ago

The 4 least significant bits of VesselData.AutoPilotVector contain the AutoPilot vector, (1=SAS 2=Prograde etc, 9=Maneuver). If the value is zero, SAS is off.

The arduino sends back ControlPacket.AutoPilotVector. The 4 least significant bit set the AutoPilot mode (1=SAS 2=Prograde etc, 9=Maneuver), if the value is zero, then no AutoPilot settings are changed.

zitron-git commented 7 years ago

Hey thanks! Just a couple of requests, can you please use "additionalcontrolbyte1" instead of adding a new one, it's there for exactly this. You can rename it to "AutoPilotVector" if you want, but I think "SASMode" is probably better. Also if you can document exactly which number is which mode that would be great!

GeraKuznetsov commented 7 years ago

Hmm, well i only use 4 bits in AutoPilotVector (other data can be fitted there), so in the end i don't think it should it should be called "AutoPilotVector" or "SASMode". I guess i can just call it "VesselData.AdditionalDataByte1" (when sending to arduino) and use "ControlPacket.AdditionalControlByte1" (when sending to KSP).

As for the Autopilot modes ;) 0 = SAS is off (if sending to arduino) / ignore (if sending to KSP) 1 = Normal Stability Assist 2 = Prograde 3 = RetroGrade 4 = Normal 5 = Antinormal 6 = Radial In 7 = Radial Out 8 = Target 9 = Anti-Target 10 = Maneuver node

Edit: To test, i changed HandShake.ino in KSPDemo13 to this: http://pastebin.com/9RcEqu7m I am confident that the original commit works flawlessly, and i hope i didn't mess up anything when in the second commit when i changed the names.

zitron-git commented 7 years ago

Hey sorry I forgot to update the repo to the latest version (18.4). I will manually add your code to the latest version this weekend, or you can do the pull request again.