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

Separate pitch, yaw and roll gimbal enabling/locking #1622

Merged
merged 2 commits into from
May 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion doc/source/structures/vessels/gimbal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@ Many engines in KSP have thrust vectoring gimbals which are handled by their own
* - :attr:`LOCK`
- :ref:`Boolean <boolean>`
- Is the Gimbal locked in neutral position?


* - :attr:`PITCH`
- :ref:`Boolean <boolean>`
- Does the Gimbal respond to pitch controls?

* - :attr:`YAW`
- :ref:`Boolean <boolean>`
- Does the Gimbal respond to yaw controls?

* - :attr:`ROLL`
- :ref:`Boolean <boolean>`
- Does the Gimbal respond to roll controls?

* - :attr:`LIMIT`
- :ref:`scalar <scalar>` (%)
- Percentage of the maximum range the Gimbal is allowed to travel
Expand Down Expand Up @@ -61,6 +73,27 @@ Many engines in KSP have thrust vectoring gimbals which are handled by their own

Is this gimbal locked to neutral position and not responding to steering controls right now? When you set it to true it will snap the engine back to 0s for pitch, yaw and roll

.. attribute:: Gimbal:PITCH

:type: :ref:`Boolean <boolean>`
:access: Get/Set

Is the gimbal responding to pitch controls? Relevant only if the gimbal is not locked.

.. attribute:: Gimbal:YAW

:type: :ref:`Boolean <boolean>`
:access: Get/Set

Is the gimbal responding to yaw controls? Relevant only if the gimbal is not locked.

.. attribute:: Gimbal:ROLL

:type: :ref:`Boolean <boolean>`
:access: Get/Set

Is the gimbal responding to roll controls? Relevant only if the gimbal is not locked.

.. attribute:: Gimbal:LIMIT

:type: :ref:`scalar <scalar>` (%)
Expand Down
12 changes: 12 additions & 0 deletions src/kOS/Suffixed/PartModuleField/GimbalFields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ private void InitializeGimbalSuffixes()
{
gimbal.gimbalLock = value;
}, "Is the Gimbal free to travel?"));
AddSuffix("PITCH", new SetSuffix<BooleanValue>(() => gimbal.enablePitch, value =>
{
gimbal.enablePitch = value;
}, "Does the Gimbal respond to pitch controls?"));
AddSuffix("YAW", new SetSuffix<BooleanValue>(() => gimbal.enableYaw, value =>
{
gimbal.enableYaw = value;
}, "Does the Gimbal respond to yaw controls?"));
AddSuffix("ROLL", new SetSuffix<BooleanValue>(() => gimbal.enableRoll, value =>
{
gimbal.enableRoll = value;
}, "Does the Gimbal respond to roll controls?"));
Copy link
Member

Choose a reason for hiding this comment

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

The indentation above looks really wonky. The braces shouldn't be at the same level as the "A" in "AddSuffix" because they're a continuation of the AddSuffix call. They should be indented further in.

AddSuffix("LIMIT", new ClampSetSuffix<ScalarValue>(() => gimbal.gimbalLimiter,
value => gimbal.gimbalLimiter = value,
0f, 100f, 1f,
Expand Down