This example illustrates the use of global coordinates in Simulink® 3D Animation™ models. Global coordinates can be used in the model in many ways for object tracking and manipulation, simple collision detection, simulation of haptic effects, etc.
Global coordinates of objects in virtual world are available through the VR Source block. For each Transform in the scene, the tree view in the Parameters dialog of the VR Source block displays also the
Extensions branch. There you can select
rotation_abs fields. While the fields without the
_abs suffix input into Simulink® model object's local coordinates (relative to their parent objects in model hierarchy), fields with this suffix contain object's global coordinates.
The VRML model represents a nuclear hot chamber manipulator. The manipulator task is to move the load from one gray cylindrical platform to another. The trajectory for the manipulator end-effector is predefined using Signal Editor. Each part of manipulator arm is independently actuated using decomposed trajectory components, with help of VR Expander blocks (see the
VR Transformations subsystem).
VR Source block on the left captures global coordinates of all objects important for load manipulation - manipulator grip reference point (center of the clamp), destination reference point and initial position of the load. While load and destination coordinates could be easily read in global coordinate space anyway, manipulator grip position results from complex movement of manipulator arm parts that form hierarchical structure. Computing of global coordinates for such objects affected by hierarchical relations in the scene is in general very difficult, Simulink 3D Animation provides an easy way how to read them into Simulink model.
Once global coordinates of all important objects are known, it is easy to implement a simple manipulator control logic. The first blue proximity sensor detects when the manipulator arrives at the initial load position. Sensor output changes to
true, which results in the following:
The cyan Load Control subsystem is enabled. From now, the position and rotation of the manipulator grip are written back to the virtual world into respective fields of the load object, using an additional VR Sink block. The load starts to follow the grip reference point.
Manipulator clamp is engaged (fingers close).
End-effector trajectory, created by the VR Tracer block, changes from green to red.
Once the load arrives at the destination, second blue proximity sensor is activated, which reverts all three states above - load position becomes independent from the grip, manipulator clamp is released and the grip trajectory to the idle position is drawn in green.
Both sensors feed the S-R type Flip-Flop block that implements the desired set-reset logic.