|
| 1 | +Vectored Truster Array Control Interface (The Missing guide) |
| 2 | +----- |
| 3 | + |
| 4 | +``` |
| 5 | + \ \\ Rin Yu Research Group |
| 6 | + /\ / 凜羽研究小組 |
| 7 | +``` |
| 8 | +Rin Yu Research is a small firm that makes experimental propulsion systems. |
| 9 | +The name is Chinese, and the spec writing division (for better (cheaper!) or worse) is vague and not completely comprehensable. |
| 10 | +Thus, the grammar of the spec is bad on purpose (but should be consistently bad). |
| 11 | + |
| 12 | +| Item | Value | Comment |
| 13 | +| -------------: | ---------- | ---------------- |
| 14 | +| Vendor code | 0xC2200311 | Rin Yu Research |
| 15 | +| Device ID | 0xF7F7EE03 | VTACI |
| 16 | +| Device type | 0xF7F7 | Trust Control Card |
| 17 | +| Version | 0x0400 | Version 4.0 |
| 18 | + |
| 19 | +The VTACI device is classified as "non-standard", does not support any standard API. |
| 20 | +The device can read and write directly to memory, and can be reset with `SET A,-1`; `HWI n`. |
| 21 | + |
| 22 | +The company uses semver, in a 4.4.8 bit format, effectively actaully making this version 0.4.00 |
| 23 | +but they don't want people to think it's an alpha product for marketing reasons. |
| 24 | + |
| 25 | +- The device has 3 different interrupt functions that will shutdown all the thrusters: |
| 26 | + - A=0 an explicit safety shutdown/panic, retains any group configuration. |
| 27 | + - A=3 C=0 (Set mode: disable) the mode configuration, mode 0 is the boot up default and will disable all thrust. |
| 28 | + - A=-1 (aka 0xffff) API compatible reset, returns to mode 0, and also deletes any group configuration. |
| 29 | + |
| 30 | +### Coordinates and Calibration |
| 31 | + |
| 32 | +The device follows the notion of "calibration". This semi magic process takes some time |
| 33 | +proportional to the number of thrusters connected to it, and basically just records the |
| 34 | +location and orientation of all the thrusters connected to the device. |
| 35 | +Power cycling, resetting, software crashing, etc. will not invalidate this information, |
| 36 | +however, adding new thrusters or when using a new instance of the device will require it. |
| 37 | + |
| 38 | +All thrusters connected to the VTACI controller have a unique index, this can change only |
| 39 | +during a calibration request, but generally should remain the same between calibrations. |
| 40 | +All indexes should not change if no thrusters were added or removed. |
| 41 | + |
| 42 | +The location and orientation are based on the local coordinates of the space craft, |
| 43 | +and assume a right handed, Z up coordinate space. These values are signed |
| 44 | +16 bit integers that are measured in millimeters. |
| 45 | + |
| 46 | +The spec requires that all thrusters be connected no farther than **32 meters** from |
| 47 | +the VTACI device's center, where the VTACI sensor/controller is assumed to be a physical |
| 48 | +device attached to an interface card in a DCPU system with a (propriatary) cable. |
| 49 | +This numeric limit comes from the signed 16 bit range of -32768 to 32767. |
| 50 | +This isn't actually straight line distance, but as no single XYZ coordinate can exceed this range, |
| 51 | +it actually forms an axis aligned cube centered on the device that all thrusters must be within. |
| 52 | +Connecting a thruster outside of this cube to the device will cause the device to enter the error state. |
| 53 | +Note however, that a thruster within the cube, but more than 32m from the device is still considered valid. |
| 54 | + |
| 55 | +During the "calibration", the device will test if all the thrusters are within the cube as a pass/fail, |
| 56 | +then it will test if the thruster is within a similar cube that is instead centered on the space craft's |
| 57 | +local center of mass. Any thruster that is within the center of mass cube, has it's location saved as an |
| 58 | +offset from the center of mass, it is also flagged as being "center of mass" relative. Any thruster that is |
| 59 | +not in the center of mass cube, but still valid, has it's location offset saved relative to the center of |
| 60 | +the physical VTACI device, and is flagged as being "VTACI" relative. |
| 61 | + |
| 62 | +If *any* thruster is flagged as being "VTACI" relative, and any attempt is made to enter "force+moment" mode, |
| 63 | +then this will cause the device to soft crash (error 0xffff). The mode change obviously fails. |
| 64 | + |
| 65 | +The device will get the normalized vector representing the direction the thruster will exhaust. |
| 66 | +This vector is relative to the local coordinate space of the *space craft*, in the same RH Z-up coords. |
| 67 | +If a thruster is mounted perpendicular on the right side of a cube space craft, this will be X=1,Y=0,Z=0. |
| 68 | + |
| 69 | +The device also supports optional gimbles on thrusters, the orientation is based on a centered gimble. |
| 70 | +The location for thrusters on gimbles, is assumed to be the pivet point of the gimble. |
| 71 | +The device does not collect the rotation of gimbles, making them troublesome for software to take advantage |
| 72 | +of when using a VTACI to control them. Gimble support at all is considered a "bonus feature" on the device. |
| 73 | + |
| 74 | +Neither the position or orientation change during normal operation (setting gimbles or thrust levels), |
| 75 | +all of this information is collected when calibration is requested and should be saved in the device's state. |
| 76 | + |
| 77 | +### Accessing Calibration Data |
| 78 | + |
| 79 | +Interrupt commands A=4 and A=5 are used to write the internal information about the |
| 80 | +thruster(s) and gimble(s) respecively, to the DCPU's RAM for a program to evaluate (or choke on) |
| 81 | + |
| 82 | +For thruster information (A=4), an array of 5 word records is written starting at a memory pointer (register B) |
| 83 | +Each record represents a single thruster, and consists of: |
| 84 | + - the 3D signed 16 bit integer location vector. |
| 85 | + - the 3D de-normalized orientation vector (encoded) |
| 86 | + - A flag representing if the location vector is offset from the center of mass (0) or VTACI (1) local space. |
| 87 | + - The maximum rated thrust output of the thruster (in a vacuum) represented as a magnitude and exponent. |
| 88 | + |
| 89 | + The range of trust is 1 micro newton all the way to 4.095 giga newtons (quite a lot!) |
| 90 | + with at least 3 significat digits. |
| 91 | + |
| 92 | +the de-normalized orientation is calculated by taking each normallized vector component, multiplying by 8, adding 8, |
| 93 | +then clamping within a 4 bit range. The three resulting XYZ components are then combined with the location flag, |
| 94 | +and the resulting word is saved to the RAM location. |
| 95 | + |
| 96 | +### Memory Refresh |
| 97 | + |
| 98 | +In both "group control mode" and "moment+force mode" the device continuously reads it's assigned segment of |
| 99 | +memory and then updates all thrusters at once. The refresh time is proportional to the number of words |
| 100 | +that would have to be read when starting at the base address, continuing to the highest offset. |
| 101 | +The minimum is 2 words in group control mode, and is always 6 words in force mode. |
| 102 | +The maximum number of words that would be read is the max of: |
| 103 | + - the highest thruster group offset |
| 104 | + - or, the highest gimble group offset plus one. |
| 105 | + |
| 106 | +The update rate should probably be 15 milliseconds plus about 0.02 milliseconds per word for group mode. |
| 107 | +For moment+force mode, about 20 milliseconds plus 0.10 milliseconds per thruster for an update cycle. |
| 108 | +Obviously, idle mode (mode 0) should not automatically access RAM at all. |
| 109 | + |
| 110 | +Every thruster has an assigned offset, this defaults to zero at reset. In group mode, an array from |
| 111 | +memory starting at the set base address is read, all thrusters use their offset to get a setting |
| 112 | +from the array, so thrusters with the same offset read the same location and get the same setting. |
| 113 | + |
| 114 | +### "Force" and "Moment" control mode |
| 115 | + |
| 116 | +Force and Moment control - sounds likes a fancy term with some complex algorithm backing it, right? well, no. |
| 117 | +The cheap integer processors used in the VTACI make actual estimation of any real unit of force or moment |
| 118 | +far to computationally expensive to be practical. |
| 119 | + |
| 120 | +### The Algorithm |
| 121 | + |
| 122 | +The "Force" and "Moment" are computed seperately, the resulting thruster levels are then added together. |
| 123 | + |
| 124 | +*side note here, this is completely untested and could very well be wrong* |
| 125 | + |
| 126 | +Both modes use an orientation comparison function, this compares a normal to the orientation and |
| 127 | +applies a falloff based on the angle. The applied falloff is based on the dot product of the |
| 128 | +input normal and the orientation normal. The result is scaled so 1.0 is 100% and 0.4 is 0% thrust. |
| 129 | +`Scaled = (x - 0.4) * 1.667` |
| 130 | + |
| 131 | +The Force vector is handled in two seperate stages. In the first stage, the 3D signed integer vector |
| 132 | +input is negated and normalized (if not zero), this is compared against thruster orientation (above) |
| 133 | +for falloff. The magnitude of the force vector is clamped to 32767 equalling 100% thruster output. |
| 134 | +In the second stage, each component is evaluated seperately, applying to a single axis, the normal |
| 135 | +effectively being that axis. The axis normals are (again) evaluated for falloff and applied to |
| 136 | +thrusters. The resulting output thrust levels from these stages are added together. Actual "force" |
| 137 | +is completely ignored, having thrusters of different thrust ratings will make no difference in the |
| 138 | +applied output thrust levels. |
| 139 | + |
| 140 | +The "Moment" vector is also not quite as complex as it might imply. This vector, is first broken |
| 141 | +into the 3 seperate components, and each component is evaluated seperately. The sign of each |
| 142 | +component determines which 3D half planes will activate, the magnitude of the component is |
| 143 | +normallized to a base percent. Thruster orientations are compared against the normals of the fixed |
| 144 | +half planes and those that have a non-zero falloff are considered "active", using the orientation |
| 145 | +compare function, the "half planes" have a fixed normal so this can be precomputed and cached. |
| 146 | +Additionally a linear fall-off is applied over each axis, the center (0) being 0%, and the absolute |
| 147 | +axis coordinate of the farthest "active" thruster, is considered 100%. The normalized megnitude |
| 148 | +of the component is combined with the contribution and falloff scales. Each of the X, Y, and Z |
| 149 | +components perform these steps seperately, and the resulting final outputs are added together |
| 150 | +to get the total for the "moment" output. |
| 151 | + |
| 152 | +- The falloff ramps can be pre-computed during calibration and cached. |
| 153 | +- The orientation contribution for planes can be pre-computed and cached. |
| 154 | + |
| 155 | +### Notes From IRC |
| 156 | +``` |
| 157 | +setting Moment+Force mode when thrusters are not near the center of mass will crash the device (error 0xffff) |
| 158 | +n+0 thru n+2 are relative coordinates |
| 159 | +n+3 is the direction the thruster is mounted and the origin flags |
| 160 | +> 0xWZYX |
| 161 | +W is the origin flag (Center-of-Mass or VTACI) is only for n+0 through n+2 to tell them apart. |
| 162 | +ZYX is the direction the thruster is pointed, all calibration assumes centered gimble, and is always relative to the craft. |
| 163 | +only position has different origins. |
| 164 | +thrusters may or may not have gimbles. |
| 165 | +Q: if you turn the gimble does the n+3 (A=0x0004) change? |
| 166 | +A: no, thruster information is considered "calibration data" it does not change during operation. (except during calibration) |
| 167 | +Q: is the VTACI automatically updating thruster levels from memory all the time in group control mode? |
| 168 | +A: yes (subject to the refresh rate) - more groups/offsets = slower refresh/update rate. |
| 169 | +fuel levels have to be checked via seperate sensors. |
| 170 | +(recently updated) The device reports overheating, binary (ok/bad) thruster damage, and gimble malfuction. |
| 171 | +(TTT x 10 ^ ( -6 + E )) is the psudo floating point thrust rating, TTT and E are bit field values from the memory word. |
| 172 | +you can unmap the VTACI from RAM when it's not being used if you need more free RAM. |
| 173 | +X and Y gimble are relative the gimble base, so ... just hope it's installed the "right way up" |
| 174 | + (aka. gimbles on the VTACI are meant to be unpredicatable in software) |
| 175 | + you can't determine a gimble's orientation, the VTACI doesn't supply that information. |
| 176 | +The majority of thrusters are assumed to not have a gimble, as the VTACI's focus is more on RCS type systems. |
| 177 | +``` |
0 commit comments