Infernal Robotics¶
- Download: http://kerbal.curseforge.com/ksp-mods/220267
- Alternative download: https://kerbalstuff.com/mod/8/Magic_Smoke_Industries_Infernal_Robotics
- Forum thread, including full instructions: http://forum.kerbalspaceprogram.com/threads/116064
Infernal Robotics introduces robotics parts to the game, letting you create moving or spinning contraptions that just aren’t possible under stock KSP. .. figure:: http://i.imgur.com/O94LBvF.png
Starting version 0.20 of the Infernal Robotics, mod creators introduced API to for easier access to robotic features.
Access structure IRAddon via ADDONS:IR.
-
structure
IRAddon¶ Suffix Type Description AVAILABLEbool(readonly) Returns True if mod Infernal Robotics is installed, available to KOS and applicable to current craft. GROUPSList (readonly) Lists all Servo Groups for current focused vessel ALLSERVOSList (readonly) Lists all Servos for current focused vessel
-
IRAddon:
AVAILABLE¶ Type: bool Access: Get only Returns True if mod Infernal Robotics is installed, available to KOS and applicable to current craft. Example of use:
if ADDONS:IR:AVAILABLE { //some IR dependent code }
-
IRAddon:
GROUPS¶ Type: List of IRControlGroupobjectsAccess: Get only Lists all Servo Groups for current focused vessel. Example of use:
for g in ADDONS:IR:GROUPS { Print g:NAME + " contains " + g:SERVOS:LENGTH + " servos". }
-
IRAddon:
ALLSERVOS¶ Type: List of IRServoobjectsAccess: Get only Lists all Servos for current focused vessel. Example of use:
for s in ADDONS:IR:ALLSERVOS { print "Name: " + s:NAME + ", position: " + s:POSITION. }
-
structure
IRControlGroup¶ Suffix Type Description NAMEstring Name of the Control Group SPEEDfloat Speed multiplier set in the IR UI EXPANDEDbool True if Group is expanded in IR UI FORWARDKEYstring Key assigned to forward movement REVERSEKEYstring Key assigned to reverse movement SERVOSList (readonly) List of servos in the group MOVERIGHT()void Commands servos in the group to move in positive direction MOVELEFT()void Commands servos in the group to move in negative direction MOVECENTER()void Commands servos in the group to move to default position MOVENEXTPRESET()void Commands servos in the group to move to next preset MOVEPREVPRESET()void Commands servos in the group to move to previous preset STOP()void Commands servos in the group to stop
-
IRControlGroup:
NAME¶ Type: string Access: Get/Set Name of the Control Group (cannot be empty).
-
IRControlGroup:
SPEED¶ Type: float Access: Get/Set Speed multiplier as set in the IR user interface. Avoid setting it to 0.
-
IRControlGroup:
EXPANDED¶ Type: bool Access: Get/Set True if Group is expanded in IR UI
-
IRControlGroup:
FORWARDKEY¶ Type: string Access: Get/Set Key assigned to forward movement. Can be empty.
-
IRControlGroup:
REVERSEKEY¶ Type: string Access: Get/Set Key assigned to reverse movement. Can be empty.
-
IRControlGroup:
SERVOS¶ Type: List of IRServoobjectsAccess: Get only Lists Servos in the Group. Example of use:
for g in ADDONS:IR:GROUPS { Print g:NAME + " contains " + g:SERVOS:LENGTH + " servos:". for s in g:servos { print " " + s:NAME + ", position: " + s:POSITION. } }
-
IRControlGroup:
MOVERIGHT()¶ Returns: void Commands servos in the group to move in positive direction.
-
IRControlGroup:
MOVELEFT()¶ Returns: void Commands servos in the group to move in negative direction.
-
IRControlGroup:
MOVECENTER()¶ Returns: void Commands servos in the group to move to default position.
-
IRControlGroup:
MOVENEXTPRESET()¶ Returns: void Commands servos in the group to move to next preset
-
IRControlGroup:
MOVEPREVPRESET()¶ Returns: void Commands servos in the group to move to previous preset
-
IRControlGroup:
STOP()¶ Returns: void Commands servos in the group to stop
-
structure
IRServo¶ Suffix Type Description NAMEstring Name of the Servo UIDint Unique ID of the servo part (part.flightID). HIGHLIGHTbool (set-only) Set Hightlight status of the part. POSITIONfloat (readonly) Current position of the servo. MINCFGPOSITIONfloat (readonly) Minimum position for servo as defined by part creator in part.cfg MAXCFGPOSITIONfloat (readonly) Maximum position for servo as defined by part creator in part.cfg MINPOSITIONfloat Minimum position for servo, from tweakable. MAXPOSITIONfloat Maximum position for servo, from tweakable. CONFIGSPEEDfloat (readonly) Servo movement speed as defined by part creator in part.cfg SPEEDfloat Servo speed multiplier, from tweakable. CURRENTSPEEDfloat (readonly) Current Servo speed. ACCELERATIONfloat Servo acceleration multiplier, from tweakable. ISMOVINGbool (readonly) True if Servo is moving ISFREEMOVINGbool (readonly) True if Servo is uncontrollable (ex. docking washer) LOCKEDbool Servo’s locked status, set true to lock servo. INVERTEDbool Servo’s inverted status, set true to invert servo’s axis. PARTPartA reference to a Part containing servo module. MOVERIGHT()void Commands servo to move in positive direction MOVELEFT()void Commands servo to move in negative direction MOVECENTER()void Commands servo to move to default position MOVENEXTPRESET()void Commands servo to move to next preset MOVEPREVPRESET()void Commands servo to move to previous preset STOP()void Commands servo to stop MOVETO(position, speedMult)void Commands servo to move to position with speedMult multiplier
-
IRServo:
NAME¶ Type: string Access: Get/Set Name of the Control Group (cannot be empty).
-
IRServo:
UID¶ Type: int Access: Get Unique ID of the servo part (part.flightID).
-
IRServo:
HIGHLIGHT¶ Type: bool Access: Set Set Hightlight status of the part.
-
IRServo:
POSITION¶ Type: float Access: Get Current position of the servo.
-
IRServo:
MINCFGPOSITION¶ Type: float Access: Get Minimum position for servo as defined by part creator in part.cfg
-
IRServo:
MAXCFGPOSITION¶ Type: float Access: Get Maximum position for servo as defined by part creator in part.cfg
-
IRServo:
MINPOSITION¶ Type: float Access: Get/Set Minimum position for servo, from tweakable.
-
IRServo:
MAXPOSITION¶ Type: float Access: Get/Set Maximum position for servo, from tweakable.
-
IRServo:
CONFIGSPEED¶ Type: float Access: Get Servo movement speed as defined by part creator in part.cfg
-
IRServo:
SPEED¶ Type: float Access: Get/Set Servo speed multiplier, from tweakable.
-
IRServo:
CURRENTSPEED¶ Type: float Access: Get Current Servo speed.
-
IRServo:
ACCELERATION¶ Type: float Access: Get/Set Servo acceleration multiplier, from tweakable.
-
IRServo:
ISMOVING¶ Type: bool Access: Get True if Servo is moving
-
IRServo:
ISFREEMOVING¶ Type: bool Access: Get True if Servo is uncontrollable (ex. docking washer)
-
IRServo:
LOCKED¶ Type: bool Access: Get/Set Servo’s locked status, set true to lock servo.
-
IRServo:
INVERTED¶ Type: bool Access: Get/Set Servo’s inverted status, set true to invert servo’s axis.
-
IRServo:
PART¶ Type: PartAccess: Get Returns reference to the
Partcontaining servo module. Please note that Part:UID does not equal IRServo:UID.
-
IRServo:
MOVERIGHT()¶ Returns: void Commands servo to move in positive direction
-
IRServo:
MOVELEFT()¶ Returns: void Commands servo to move in negative direction
-
IRServo:
MOVECENTER()¶ Returns: void Commands servo to move to default position
-
IRServo:
MOVENEXTPRESET()¶ Returns: void Commands servo to move to next preset
-
IRServo:
MOVEPREVPRESET()¶ Returns: void Commands servo to move to previous preset
-
IRServo:
STOP()¶ Returns: void Commands servo to stop
-
IRServo:
MOVETO(position, speedMult)¶ Parameters: - position – (float) Position to move to
- speedMult – (float) Speed multiplier
Returns: void
Commands servo to move to position with speedMult multiplier.
Example code:
print "IR Iavailable: " + ADDONS:IR:AVAILABLE.
Print "Groups:".
for g in ADDONS:IR:GROUPS
{
Print g:NAME + " contains " + g:SERVOS:LENGTH + " servos:".
for s in g:servos
{
print " " + s:NAME + ", position: " + s:POSITION.
if (g:NAME = "Hinges" and s:POSITION = 0)
{
s:MOVETO(30, 2).
}
else if (g:NAME = "Hinges" and s:POSITION > 0)
{
s:MOVETO(0, 1).
}
}
}