Radix Converter "Roticon U32"
bug has been noticed, update soon
Roticon U32
Base-N converter
Requires 1.9. Read the instructions before use.
Overview
A proof-of-concept system for using cockpit rotation (PitchAngle
, Heading
, RollAngle
) as data storage. By applying suitable coefficients to each factor, many integer values are achievable. Combined with custom displays, the raw value can be visually converted into other numerical forms.
In this machine, rotations around each axis are converted into their corresponding values, and then added up to form the complete output. The user rotates the cockpit block using suitable control inputs to modify PitchAngle
, Heading
, and RollAngle
.
The machine allows the conversion of numbers between the binary, hexadecimal, decimal, and octal radixes (forms). The conversion range is 0 to slightly above 2^32, meaning that it is useful for 32-bit unsigned integers.
While some reference towards LED Digital Instrument by @phd614871 was carried out, the coding method of the displays used is different and original, because the code was not understandable (lmao).
User Manual
Controls
Pitch - Rotate Around Pitch Axis
Yaw - Rotate Around Yaw Axis
Roll - Rotate Around Roll Axis
Throttle - Adjust Throttle Factor
AG1 - 32nd Bit (adds 2147483648)
Display Parts (refer to the labelled diagram)
- Limit Indicator: Lights up when the numeric output (excluding AG1) exceeds 2147483647. Values may not be displayed correctly when AG1 is active while this light is on.
- 2^32 Indicator: Lights up when the 32nd bit (AG1) is active. ("Ext" means range extension)
- Throttle Display: Shows the amount of Throttle input.
- Range Adjusted Displays: Shows the variable adjusted to the positive-only range used by the machine.
- Oscillation Indicators: Blinks for every change in rotation around its respective axis by 0.1 degrees, useful to see whether a rotation unit is still moving after brakes are applied. Whether it is on or off does not matter.
- Raw Value Indicators: Displays the rotation (divided by 180). Used for testing and debugging, not useful for the user.
- Axis Brake Indicators: Lights up when the brakes on each respective rotation unit are active.
- Output Displays: Shows numerical output visually in four radixes.
General Instructions
[Spawn location does not matter, as long as it is solid ground.]
1. Turn on AG1 if the desired value is 2147483648 (bin 10000000000000000000000000000000, hex 80000000, oct 40000000000) or higher.
2. Set Pitch, Yaw, and Roll angle inputs to zero.
3. Adjust Throttle until the displayed number is below the desired value, such that an increase of 1 would cause the displayed number to go over the desired value.
4. Repeat (2) with Pitch, Yaw, and Roll, in that exact order.
5. Read off the conversion.
Warnings
- Not for mathematical and scientific uses, including but not limited to programming, computer engineering, and homework. Always verify the value with a scientific calculator or actual conversion software.
- May contain precision errors due to the emulation of integers with floating-point numbers.
Tips
- It is easier to see the displays at night.
- Small inputs are the key to fine adjustments.
- Always wait for rotation units to stop oscillating before continuing to use them.
- You may remove unused displays to increase framerate.
- Display parts may be useful in an aircraft, but code may need to be modified. (Always credit when uploading an aircraft with subassemblies)
- You can experiment with other applications of cockpit rotation as data storage.
Concept
Rotation Control System
The variables PitchAngle
, Heading
, and RollAngle
change according to the cockpit's rotation. They can be adjusted in a controlled manner using small jet engines to rotate the cockpit around their respective axes. The axes are colored according to Unity's conventions.
The cockpit would continue rotating even after the engine(s) used are shut off, due to rotational inertia. To counter this for easier control, brakes are installed for each axis, stopping rotation when the respective user input is 0. The input of the brakes' pistons is:
clamp01(round(1-abs(INPUT*SENSITIVITY)))
where
- INPUT
is the user input control, Pitch
, Yaw
, or Roll
;
- SENSITIVITY
(default=5) affects the amount of input required to retract the pistons (deadzone), higher SENSITIVITY
means a smaller deadzone;
- The output is 1 when abs(INPUT)
>0.5/abs(SENSITIVITY)
.
The order of rotation selected is based on Unity's rotation order: when viewed as rotations around local axes, the order is Y, local X, local Z. This order is particularly useful as the rotation around one local axis only affects its corresponding cockpit rotation variable.
Display Units
The built-in variables, activation groups and the Throttle input in SimplePlanes have the following possible output ranges:
Activate1
=-1 OR 1
0 <= Throttle
<= 1
-90 <= PitchAngle
<= 90
-180 <= Heading
<= 180
-180 <= RollAngle
<= 180
(Note: Tests appear to show that Throttle
is not confined to steps of 0.01, i.e. Throttle*100
is not always an integer, but for safety and ease of use, the range and steps of Throttle
is limited as seen below.)
Using floor() and a basic operation, each raw input value is converted into positive integers, which are more useful in the context of the machine, and then multiplied by a coefficient. Variables with smaller ranges are arranged later, so that more digit places in each output use fewer factors.
clamp01(Activate1)*2147483648
(functions as 32nd bit)
floor(Throttle*100)*23328000
(23328000=180*360*360)
floor(PitchAngle+90)*129600
(129600=360*360)
floor(Heading+180)*360
floor(RollAngle+180)
The four ranged values and 32nd bit value are added up to form the final value, and can be used in the displays.
Each segment of a seven-segment display contains an input, which is in the form
(a1-floor(repeat(n,b^s)/b^(s-1))) * (a2-floor(repeat(n,b^s)/b^(s-1))) * ...
where
- a1,a2,...
corresponds to a digit that does not use the specific beacon light;
- n
is the numerical sum as calculated above;
- b
is the numerical base of the display (8, 10, or 16);
- s
is the digit place of the display from the right;
- The output is 0 if any of the input's segments is 0, causing the light to turn off. This happens when floor(repeat(n,b^s)/b^(s-1))
is equal to any of a
.
The Binary output display uses a similar function for each light:
repeat(floor((n)/2^(s-1)),2)
where
- n
is the numerical sum as calculated above;
- s
is the bit number from the right.
However, including all factors of the output number in the output display will lead to large loss of significance errors, causing rightmost values to be far from correct. As such, larger factors can be excluded if they do not affect a particular digit. For example, 23328000 does not affect the rightmost three digits of the Decimal output. However, even numbers at the 3rd/4th position from the right may still require the calculation of the larger factors. To reduce CPU cost and prevent floating-point precision errors, larger digit places of larger factors are not calculated in smaller digit places of the displays.
An alternative formula using the distributive property of modulo/repeat()
could be used, but combined with many successive floor()
functions, it occasionally throws incorrect/unreadable outputs, and was more CPU-intensive, so it was not used.
Specifications
General Characteristics
- Predecessor !conv3-pre1
- Successors 1 airplane(s)
- Created On Android
- Wingspan 49.2ft (15.0m)
- Length 29.8ft (9.1m)
- Height 45.1ft (13.8m)
- Empty Weight 10,579lbs (4,798kg)
- Loaded Weight 11,111lbs (5,040kg)
Performance
- Power/Weight Ratio 3.033
- Wing Loading 439,839.3lbs/ft2 (2,147,483.6kg/m2)
- Wing Area 0.0ft2 (0.0m2)
- Drag Points 184
Parts
- Number of Parts 603
- Control Surfaces 0
- Performance Cost 2,317
@AstleyIndustries i see, i didn'r think of that.
@goboygo1
If you have zeroOnDeactivate="true" the mech will return to standing position when not walking (AG is off).
Alternatively you can multiply the whole input by something like ceil(Pitch) or my axis brake code.
The mech can return to the walking cycle after stopping, but of course it might not do it very smoothly
@AstleyIndustries if you use time you can't really stop more than once...
@goboygo1 use
Time()
m8, mechs kinda have to turn when moving between places@WarHawk95 don't use this for binary, i found an issue i forgot to fix
Updated version soon
This is pretty impressive! I also thought of using the cockpit for data storage although I was thinking of a timer for a mech walking cycle.
Man... I think you just saved my school year. Thank you.