Grab object in Simulink 3D to adjust conditions

1 visualizzazione (ultimi 30 giorni)
Brian Munguia
Brian Munguia il 30 Lug 2012
I have been attempting to make changes to the bouncing ball example for Simulink 3D. I want to be able to grab the ball in order to adjust the initial height (say on the range from 0 to 20) and have everything adjust accordingly. In my VRML file I have a planesensor called Grab and a transform called Ball, and I used the command "ROUTE Grab.translation_changed TO Ball.set_translation" to feed the user input to the ball's initial translation. However, whenever I move the ball then start the simulation, it returns to its original position of 20 (the translation I set in V-Realm Builder). Does anyone have any input as to how I can adjust the ball's initial position by grabbing it during or outside of simulation? I would prefer to know how to do it during (it is more applicable to my specific research application) but I would appreciate any information. Thank you.

Risposte (3)

Sumit Tandon
Sumit Tandon il 30 Lug 2012
In the documentation for Simulink 3D Animation, there is a demo called "Portal Crane with Control Panel". It has a control panel in the scene with you can set position of crane while the model is simulating.
It uses the VR Source block to bring data from virtual world to Simulink model. See http://www.mathworks.com/help/releases/R2012a/toolbox/sl3d/vrsource.html:
Hope this helps.

Jan Danek
Jan Danek il 14 Ago 2012
Hi Brian,
If you want to adjust the initial position outside of simulation, you can use this:
ROUTE Grab.translation_changed TO Ball.set_translation
, but then you have to save the virtual world to the file to reflect the change (File - Save in the Viewer). At the beginning of each simulation, the world gets reloaded from the file...
Jan

Jan Danek
Jan Danek il 14 Ago 2012
Have a look also at the "vrmaglev" example.

Categorie

Scopri di più su Simulation in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by