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 AVAILABLE
bool(readonly) Returns True if mod Infernal Robotics is installed, available to KOS and applicable to current craft. GROUPS
List (readonly) Lists all Servo Groups for current focused vessel ALLSERVOS
List (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 IRControlGroup
objectsAccess: 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 IRServo
objectsAccess: 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 NAME
string Name of the Control Group SPEED
float Speed multiplier set in the IR UI EXPANDED
bool True if Group is expanded in IR UI FORWARDKEY
string Key assigned to forward movement REVERSEKEY
string Key assigned to reverse movement SERVOS
List (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 IRServo
objectsAccess: 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 NAME
string Name of the Servo UID
int Unique ID of the servo part (part.flightID). HIGHLIGHT
bool (set-only) Set Hightlight status of the part. POSITION
float (readonly) Current position of the servo. MINCFGPOSITION
float (readonly) Minimum position for servo as defined by part creator in part.cfg MAXCFGPOSITION
float (readonly) Maximum position for servo as defined by part creator in part.cfg MINPOSITION
float Minimum position for servo, from tweakable. MAXPOSITION
float Maximum position for servo, from tweakable. CONFIGSPEED
float (readonly) Servo movement speed as defined by part creator in part.cfg SPEED
float Servo speed multiplier, from tweakable. CURRENTSPEED
float (readonly) Current Servo speed. ACCELERATION
float Servo acceleration multiplier, from tweakable. ISMOVING
bool (readonly) True if Servo is moving ISFREEMOVING
bool (readonly) True if Servo is uncontrollable (ex. docking washer) LOCKED
bool Servo’s locked status, set true to lock servo. INVERTED
bool Servo’s inverted status, set true to invert servo’s axis. PART
Part
A 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: Part
Access: Get Returns reference to the
Part
containing 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).
}
}
}