User Tools

Site Tools


animation:collision_diagram

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
animation:collision_diagram [2015/12/05 17:10]
freek [How to create and use a collision diagram]
animation:collision_diagram [2015/12/05 17:18] (current)
freek
Line 1: Line 1:
 +====== Kollisions Diagramm ======
 +
 +{{:​story:​b170:​bn_800.png?​600|collision diagram}}
 +
 +Das Kollisionsdiagramm ist eine 2D Darstellung der Konfiguration eines Systems mit zwei Freiheitsgraden,​ bei dem es zu Kollisionen kommen kann.
 +
 +
 +{{youtube>​large:​OFidm_wOn0c}}
 +
 +
 +====== How to create and use a collision diagram ======
 +
 +==Overview==
 +
 +  - create the models
 +  - compute the collsion data
 +  - generate the map/​collision diagram
 +  - add animation tools to the model
 +  - animate
 +
 +==Create the models==
 +Create the part as usual.
 +Simplifiy the model: omit all details which are not essential for collision ​
 +Use Part to get a simple copy of the model
 +
 +Maybe that create a mesh will give faster results - further tests  are required.
 +
 +==Compute the collision data==
 +
 +The data generator scripts runs over all possibilities. For two roations with step with 1° these are 130 000 calculations. There are faster algorithms, but programming one hour is harder than having 4 breaks. ​
 +
 +A lot of ideas to get this task faster can be found here: http://​gamma.cs.unc.edu/​
 +
 +==Generate the map/​collision diagram==
 +todo
 +==Add animation tools to the model==
 +
 +Open the file with the simplified models.
 +
 +<​code>​
 +import Keyboard, Placer
 +</​code>​
 +Keyboard will be used to go interactiv through the animation space.
 +Placer will animate the two parts depending on the move of the keyboard.
 +
 +<​code>​
 +# visualization point
 +V=App.ActiveDocument.addObject("​Part::​Vertex","​Keybord Control Point"​)
 +V.ViewObject.PointSize=8
 +V.ViewObject.PointColor=(1.0,​.0,​.0)
 +V.Placement.Base.z=40
 +</​code>​
 +We use a red square of size 8 points for visualization of the configuration.
 +It shows the way of our "​ship"​ between the "​collision islands" ​
 +in the open "​ocean"​ or in a "​lake"​ or in a "​river"​.
 +
 +<​code>​
 +# green/left
 +s=App.ActiveDocument.Pad001001
 +# blue/​right ​
 +b=App.ActiveDocument.Pad001002
 +</​code>​
 +some variables for the animated parts
 +
 +
 +<​code>​
 +# ACTOR #
 +
 +p=Placer.createPlacer("​linker Rotor",​s)
 +p.src=V
 +p.x="​-37"​
 +p.y="​5"​
 +p.arc="​sy"​
 +p.RotCenter=FreeCAD.Vector(0,​0,​0)
 +</​code>​
 +The first placer maps the y-Value (sy) of the Visualization point V (src)
 +to the rotation angle (arc) of the green part. The location of the part is always (-37|5).
 +
 +<​code>​
 +p2=Placer.createPlacer("​Rechter Rotator",​b)
 +p2.src=V
 +p2.x="​0"​
 +p2.y="​0"​
 +p2.arc="​sx"​
 +p2.RotCenter=FreeCAD.Vector(0,​0,​0)
 +</​code>​
 +The second placer maps the x-Value (sx) of the Visualization point V (src)
 +to the rotation angle (arc) of the blue part. 
 +The location of the part is always (0|0).
 +
 +
 +<​code>​
 +# SENSOR #
 +
 +kb=Keyboard.createKeyboard("​Keybord",​V)
 +</​code>​
 +This creates the Sensor and connects it to the Visualization point V.
 +
 +The complete script is on the end of the post.
 +
 +
 +
 +
 +==Animate==
 +
 +Using the [[Animation:​Keyboard|keyboard sensor]] all critical szenarios can be inspected. See the example video.
 +I'ts possible to draw an animation path through the map and run it with the [[Animation:​Pather]],​ see the [[https://​www.youtube.com/​watch?​v=hpE_C-F9UWA|video of a shaky machine]] The path can note the influence of further forces to the parts (gravitation will always push the objects down).
 +
 +
 +==Example files==
 +
 +  *{{:​story:​b170:​m01_einraster.fcstd|model step 1}}
 +  *{{:​story:​b170:​schalter_all.txt|computed collision data}}
 +  *{{:​story:​b170:​gen_anim.py|script to set up the animation tools}}
 +  *{{:​story:​b170:​m01_einraster_complete.fcstd|model with collision diagram and animation}}
 +
 +
 +
 +
  
animation/collision_diagram.txt · Last modified: 2015/12/05 17:18 by freek