quarc_visualization_skeleton_walking_demo.mdl
Open this model

QUARC Visualization Skeleton Walking

This is an example of using real kinematic data to drive the included skeleton resource to help visualize human kinematic data. The source data was captured from NDI Optotrak cameras and then processed to apply spline patches to marker data that became obsured from the cameras. The resulting marker data is stored in the quarc_visualization_skeleton_walking.mat file with time in the first row followed by x, y, z triplets of position data for each marker. The markers map to the shoulder, hip, knee, ankle, and toe for both the left and right sides of the subject.

Using the processed marker data, the embedded Matlab block calculates a series of transformations and orientation vectors which are used to drive a modified version of the human_male.xml scene file included in the resources\scene_files folder. The arms have been statically placed in a crossed-arm position to represent what was actually done, and the first disc of the spine does not inherit orientation thus keeping the torso in an upright position regardless of the orientation of the lower limbs. Although the torso could be animated by adjusting the angle of every vertabrae to create a flexible spine, this was done to simplify the model.

The lower limbs are animated using a series of calculations to determine the angle between vectors from which transformation matrices or orientation vectors were calculated. Note that this was done using simplifications based on the subject walking in a straight line. It is not a general purpose mapping technique as-is. While it is certainly possible to fully articulate a human model using joint rotations as demonstrated here, the human body is not made of idealized ball-and-socket and pin joints which can result in motion artifacts in the animation that does not represent actual motion. A better visualization approach is use the animation data to drive the transformation of each bone independently (or at least with selective use of children) which would allow for the compression and non-ideal joint rotations of real human motion. The downside of this approach is that much more work is required to calculate all the transformations required, but the resulting animation will be relatively free of motion artifacts.

QUARC Visualization Skeleton Walking Demo Simulink model

Demonstration

To start the model, click the Run button on the toolbar, select Run from the Simulation menu of the diagram, or press Ctrl+T while the diagram is the active window. Using the A, S, D, and W keys on your keyboard, you can move around the scene. Click-drag your mouse on the visualization window to rotate your view.

Note that the visualization may take a while to load since this is a very detailed model. By the defaults set for this model, the viewer will not close when the model stops, so you can just click Start on you model again and the viewer should automatically connect and you will see the entire animation. Alternatively, use external mode.

If you would like to run the model in external mode, then select External from the Simulation/Mode menu of the diagram, or select External from the simulation mode combo box on the toolbar.

Close the QUARC 3D Viewer.

Then select Build from the QUARC menu of the diagram, or press Ctrl+B while the diagram is the active window. A great deal of output will appear in the Diagnostic Viewer about the progress of the build. If you cannot see the Diagnostic Viewer, you can open it by selecting View/Diagnostic Viewer from the menu of the diagram, or clicking on the View Diagnostics hyperlink at the bottom of the diagram. If you have MATLAB R2013b or earlier then the output will appear in the MATLAB Command Window.

When the build is complete, click on the Connect to Target button or select Connect to Target from the Simulation menu of the diagram to connect to the model. This will load the code on the target and automatically open the visualization window on the host.

Finally, start the model by clicking on the Run button or selecting Run from the Simulation menu of the diagram. The Start item of the QUARC menu may also be used to both connect and start the model in one operation.

Click on the Stop button or select Stop from the Simulation menu of the diagram to stop the model. The Stop item of the QUARC menu may also be used. Note that according to the defaults set in this model, the viewer will not close when the model stops.

QUARC Visualization Skeleton Walking Demo Viewer Window

By modifying the Camera Position constant to an integer between 0 and 3 inclusive, you can change the camera to different views.

Running the example on a different target

To run the example on a different target, refer to the instructions on the Running QUARC Examples on Remote Targets page.