VisualizationFrame¶
- class pydy.viz.VisualizationFrame(*args)[source]¶
A VisualizationFrame represents an object that you want to visualize. It allows you to easily associate a reference frame and a point with a shape.
A VisualizationFrame can be attached to only one Shape Object. It can be nested, i.e we can add/remove multiple visualization frames to one visualization frame. On adding the parent frame to the Scene object, all the children of the parent visualization frame are also added, and hence can be visualized and animated.
A VisualizationFrame needs to have a ReferenceFrame, and a Point for it to form transformation matrices for visualization and animations.
The ReferenceFrame and Point are required to be provided during initialization. They can be supplied in the form of any one of these:
1)reference_frame, point argument. 2)a RigidBody argument 3)reference_frame, particle argument.
In addition to these arguments, A shape argument is also required.
- evaluate_transformation_matrix(dynamic_values, constant_values)[source]¶
Returns the numerical transformation matrices for each time step.
- Parameters
- dynamic_valuesarray_like, shape(m,) or shape(n, m)
The m state values for each n time step.
- constant_valuesarray_like, shape(p,)
The p constant parameter values of the system.
- Returns
- transform_matrixnumpy.array, shape(n, 16)
A 4 x 4 transformation matrix for each time step.
- generate_numeric_transform_function(dynamic_variables, constant_variables)[source]¶
Returns a function which can compute the numerical values of the transformation matrix given the numerical dynamic variables (i.e. functions of time or states) and the numerical system constants.
- Parameters
- dynamic_variableslist of sympy.Functions(time)
All of the dynamic symbols used in defining the orientation and position of this visualization frame.
- constant_variableslist of sympy.Symbols
All of the constants used in defining the orientation and position of this visualization frame.
- Returns
- numeric_transformlist of functions
A list of functions which return the numerical transformation for each element in the transformation matrix.
- generate_scene_dict(constant_map={})[source]¶
This method generates information for a static visualization in the initial conditions, in the form of dictionary. This contains shape information from Shape.generate_dict() followed by an init_orientation Key.
Before calling this method, all the transformation matrix generation methods should be called, or it will give an error.
- Parameters
- constant_mapdictionary
Constant map is required when Shape contains sympy expressions.This dictionary maps sympy expressions/symbols to numerical values(floats)
- Returns
- A dictionary built with a call to Shape.generate_dict.
- Additional keys included in the dict are following:
- init_orientation: Specifies the initial orientation
of the VisualizationFrame.
- reference_frame_name: Name(str) of the reference_frame
attached to this VisualizationFrame.
- simulation_id: an arbitrary integer to map scene description
with the simulation data.
- generate_simulation_dict()[source]¶
Generates the simulation information for this visualization frame. It maps the simulation data information to the scene information via a unique id.
Before calling this method, all the transformation matrix generation methods should be called, or it will give an error.
- Returns
- A dictionary containing list of 4x4 matrices mapped to
- the unique id as the key.
- generate_transformation_matrix(reference_frame, point)[source]¶
Generates a symbolic transformation matrix, with respect to the provided reference frame and point.
- Parameters
- reference_frameReferenceFrame
A reference_frame with respect to which transformation matrix is generated.
- pointPoint
A point with respect to which transformation matrix is generated.
- Returns
- A 4 x 4 SymPy matrix, containing symbolic expressions describing the
- transformation as a function of time.
- property name¶
Name of the VisualizationFrame.
- property origin¶
Origin of the VisualizationFrame, with respect to which all translational transformations take place.
- property reference_frame¶
reference_frame of the VisualizationFrame, with respect to which all rotational/orientational transformations take place.
- property shape¶
shape in the VisualizationFrame. A shape attached to the visualization frame. NOTE: Only one shape can be attached to a visualization frame.