Grab object in Simulink 3D to adjust conditions

4 次查看(过去 30 天)
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.

回答(3 个)

Sumit Tandon
Sumit Tandon 2012-7-30
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 2012-8-14
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 2012-8-14
Have a look also at the "vrmaglev" example.

类别

Help CenterFile Exchange 中查找有关 Simulation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by