This document describes how to get realistic stress data (axial and angular) for various 3D constructs simulated in Mechastick.
The stress for each stick should be visualized using Hue in the HSV color space – you have to develop your own (external) program that loads this kind of data and displays colored "sticks". Stress values are from zero to (theoretically) infinity.
- Download Framsticks GUI for Windows
- Run Framsticks.exe
- Load some genotypes from
other.gen - Double click "Creatures" and turn off (uncheck) Death
- Run the simulation and stop it after a while
- Click the x= button on the toolbar (shows all parameters) or press ^P
- Go to "User scripts"
- Click "Dump creatures", this will produce a simple file with all the data you need as well as explanatory comments. Ignore velocity data (vx, vy, vz). Note that x and y axes constitute the horizontal plane, while z is vertical.
- Find the minimal and maximal stress value and map them linearly to blue and violet (or you can use a fixed scale of 0→blue, then green, yellow, red, >=1→violet). You could also increase color intensity non-linearly to have colors=(violet..white) for stress=(1..∞).
- Once you get the visualization (of axial stress) working, play with complex constructs: throw balls against each other, test the tower, use the manipulator arm (controlled by mouse) to exert forces...
- Ensure that your program reads and displays multiple objects, not just one object.
- Modify your program to periodically read the
dump.txtfile (e.g. twice a second). Select the "Dump creatures" experiment definition and while the simulation is running, you will get a real-time visualization of stress! (Since the file is written periodically, you need to detect read errors and just retry when a read error/exception occurs. Or open the file in exclusive non-sharing read, or simply read-write mode). See similar applications at [1], [2]. - You can get additional, interesting shapes by clicking the "Make regular shapes" button.
- You can also build your own construct – use the simple f9 genetic format, or the more general f0 genetic format.
- Looking for additional information? check out the tutorial.
- When you click the "Dump creatures" button, the
scripts/dumpCreatures.scriptis executed – you might want to see or modify this script.
Sample output for the picture above:
# parts are points, joints are sticks. # format for parts: x y z vx vy vz # format for joints: part1index(0-based) part2index(0-based) stress_axial stress_angular # creature_number number_of_parts number_of_joints 0 29 33 14.4143 14.435 -0.138187 -5.1985e-05 8.34782e-05 -0.000636402 14.4169 18.4341 -0.0582172 -8.25894e-06 3.72263e-05 -0.00013441 18.4078 14.4393 -0.210557 -0.000122876 0.000145061 -0.00107781 18.4128 18.4376 -0.124602 -6.23939e-05 6.93761e-05 -0.00056526 15.3718 13.2737 6.33448 0.00744798 -0.00871094 -0.0107484 15.4011 17.2277 6.84619 0.00795648 -0.00983025 -0.00765233 19.3649 13.2932 5.78699 0.00740841 -0.00844168 -0.0133515 19.3979 17.2428 6.41529 0.00789498 -0.00971733 -0.00998127 14.4156 16.4332 -0.0358506 -6.10617e-06 1.04206e-05 -0.000120125 16.415 14.4341 -0.0648753 -1.65135e-05 3.33471e-05 -0.000275007 16.4156 18.4341 -0.0419375 -8.55237e-06 1.66962e-05 -0.000136064 18.415 16.4338 -0.0558095 -1.16942e-05 1.66761e-05 -0.00026329 15.3863 15.2553 6.53531 0.00769961 -0.00922401 -0.00946258 17.362 13.2887 5.99149 0.00733345 -0.00844047 -0.0124542 17.3935 17.2415 6.5595 0.00785048 -0.00977565 -0.00935136 19.3798 15.2739 6.04101 0.00767202 -0.00903313 -0.0117253 14.4901 14.2693 1.40279 0.000308349 -0.000372693 -0.00289149 14.5252 18.2259 1.58706 0.000760551 -0.00154549 -0.00209835 18.5906 14.2855 1.19936 0.000975171 6.69901e-05 -0.00363501 18.6082 18.2529 1.42358 0.00118862 -0.00144586 -0.00286882 14.7122 13.9728 2.98728 0.00206972 -0.0023922 -0.00550843 14.763 17.9286 3.27964 0.0027442 -0.00410616 -0.00422485 18.8327 13.998 2.65798 0.00287241 -0.00171198 -0.006685 18.8602 17.9641 3.02175 0.00316446 -0.00406054 -0.00543778 15.0275 13.6177 4.6233 0.00472243 -0.00550814 -0.00832845 15.0742 17.5838 5.02731 0.00537621 -0.00707961 -0.00621745 19.0997 13.6439 4.18005 0.0051852 -0.00495993 -0.010118 19.1328 17.6128 4.68067 0.00554851 -0.00704445 -0.00795271 20.0019 12.6394 6.55637 0.00825227 -0.00942396 -0.0150288 0 16 0.447544 0.234671 16 20 0.376841 0.128238 20 24 0.303127 0.0346921 24 4 0.226601 0.0875737 1 17 0.338272 0.185496 17 21 0.26865 0.100395 21 25 0.196961 0.0175557 25 5 0.123466 0.0480752 2 18 0.568433 0.168835 18 22 0.495041 0.0784793 22 26 0.416615 0.0118648 26 6 0.334349 0.072432 3 19 0.427785 0.136934 19 23 0.357321 0.0696878 23 27 0.283787 0.0209832 27 7 0.207372 0.041949 0 8 0.072943 0.0763444 8 1 0.125645 0.123072 0 9 0.157013 0.0722712 9 2 0.00730989 0.0828311 1 10 0.118215 0.0279462 10 3 0.044911 0.0964441 2 11 0.0342176 0.107282 11 3 0.153595 0.132892 4 12 0.0789368 0.0430878 12 5 0.00729465 0.0430802 4 13 0.0335861 0.0674322 13 6 0.0570924 0.0407638 5 14 0.0155945 0.0713579 14 7 0.0716268 0.0494689 6 15 0.065483 0.0465453 15 7 0.0190317 0.0217011 28 6 0.0434372 0.0340015
Sample visual output:
