Graphics.NewbieCubeSimPlayback - lordmundi/wikidoctest GitHub Wiki
« Spin With Trick | NewbieIndex | Drive Cube With Live Sim Data »
Use Doug to visualize the sim's logged data.
- Enable Doug's simdata plugin
- Create a map from Trick variable names to Doug node names
- Tell Doug where the Trick log data is
- Run it
| | || | DISPLAY { CUBE { plugins { simdata dsp_simdata } } }
DOUG
{
GUI
{
simdata "${GUI_HOME}/simdatadlg.tcl"
}
} |
| % cd ${USERDATA}
% vi user.cfg
In the same way we've done this so many times before, add the chunks of code above to the appropriate place in the user.cfg |
| cube.api | || | Trick 7:
CUBE qbert.newbiecube.pyr[0] pitch d write 1.0
CUBE qbert.newbiecube.pyr[1] yaw d write 1.0
CUBE qbert.newbiecube.pyr[2] roll d write 1.0
Trick 10:
CUBE xyzpyr.cube.pyr[0] pitch d write 1.0
CUBE xyzpyr.cube.pyr[1] yaw d write 1.0
CUBE xyzpyr.cube.pyr[2] roll d write 1.0 |
| # This maps sim logged data % cd ${USERDATA}/sim_data % vi cube.api ; # Add code above Note> Square brackets (workaround for a bug) Note> 'd' is for "degrees", sim is in radians, plugin converts on the fly Note> For general api file syntax: See Api Reference |
In the previous section, a sim was created, and data was logged.
% cd ${USERDATA}/sim_data
Now make a link to that log file so we can get to it easier!
% ln -s ${TRICK_USER_HOME}/SIM_cube/RUN_test/log_cube.trk
% cd ${DOUG_HOME}
% ./run_graphics
* Options → Sim-data Dlg
* Choose API File→ Browse and find the one we just made above
* Choose Data source → Recorded → Browse and find log_cube.trk
* Click play or drag slider bar to see cube move through the sim's logged data
This Simdata Dialog thing is probably the coolest thing you've ever seen right? Well it's about to get a little bit cooler.
Remember that sim we made in the last section? Go ahead and temporarily modify the input file:
% vi ${TRICK_USER_HOME}/sims/SIM_cube/RUN_test/input
% Comment out the stop = <time> line if you have it, we want this sim to run indefinitely!
Run the sim, like we did in the last section.
% ./S_main* RUN_test/input
Now on your Simdata Dlg window, change the data source to live data and select the sim under your hostname. If you don't know what your hostname is, do this in a terminal:
% echo $HOST
Amazing! We are now displaying simulation data in real time as the sim feeds it to us. If you pause, the sim keeps going, and a buffer starts to fill in EDGE. It's kind of like hitting pause on live TV with a DVR. If you drag the slider bar to the far right, you're back to live TV!
Is that a record button you see? Why yes it is. You can actually record the data coming out of a live sim that can be used later in EDGE, without needing the sim at all! It will create a (.dov) file. Go ahead and play around, it's pretty cool stuff. For more info, check this out.
« Spin With Trick | NewbieIndex | Drive Cube With Live Sim Data »