Proxy class for a DocumentObjectGroupPython
Trajectory instance.
More...
Public Member Functions | |
def | __init__ (self, fp) |
Initialization method for TrajectoryProxy. More... | |
def | onChanged (self, fp, prop) |
Method called after DocumentObjectGroupPython Trajectory was changed. More... | |
def | execute (self, fp) |
Method called when recomputing a DocumentObjectGroupPython . More... | |
def | onDocumentRestored (self, fp) |
Method called when document is restored to make sure everything is as it was. More... | |
def | setProperties (self, fp) |
Method to set properties during initialization or document restoration. More... | |
def | change_trajectory (self, fp, traj) |
Method used to change a Trajectory 's trajectory. More... | |
def | is_trajectory_property (self, prop) |
Method to check that a property describes a trajectory. More... | |
def | is_ValidTrajectory (self, timestamps=[], translation_x=[], translation_y=[], translation_z=[], rotation_point_x=[], rotation_point_y=[], rotation_point_z=[], rotation_axis_x=[], rotation_axis_y=[], rotation_axis_z=[], rotation_angle=[], trajectory=None) |
Method to check if a trajectory is valid. More... | |
def | find_timestamp_indices_and_weights (self, fp) |
Method to find weighted timestamps indices corresponding to a given time . More... | |
Public Attributes | |
pose | |
A dict describing a pose - position, rotation axis, point and angle. More... | |
Proxy class for a DocumentObjectGroupPython
Trajectory instance.
A TrajectoryProxy instance adds properties to a DocumentObjectGroupPython
Trajectory instance and responds to their changes. It provides a TrajectoryPanel
to be able to see an object progress through a trajectory.
To connect this Proxy
object to a DocumentObjectGroupPython
Trajectory do:
Definition at line 244 of file Trajectory.py.
def Trajectory.TrajectoryProxy.__init__ | ( | self, | |
fp | |||
) |
Initialization method for TrajectoryProxy.
A class instance is created and made a Proxy
for a generic DocumentObjectGroupPython
Trajectory object. During initialization number of properties are specified and preset.
fp | A DocumentObjectGroupPython Trajectory object to be extended. |
Definition at line 259 of file Trajectory.py.
def Trajectory.TrajectoryProxy.change_trajectory | ( | self, | |
fp, | |||
traj | |||
) |
Method used to change a Trajectory
's trajectory.
A traj
dictionary containing a trajectory is tested for validity and then assigned to a Trajectory
DocumentObjectGroupPython
.
fp | A DocumentObjectGroupPython Trajectory object. |
traj | A dictionary describing a trajectory. |
Definition at line 631 of file Trajectory.py.
def Trajectory.TrajectoryProxy.execute | ( | self, | |
fp | |||
) |
Method called when recomputing a DocumentObjectGroupPython
.
If a trajectory is valid, then current pose
in a parent coordinate frame is computed, ObjectPlacement
and Placement
are updated accordingly.
fp | A DocumentObjectGroupPython Trajectory object. |
Definition at line 316 of file Trajectory.py.
def Trajectory.TrajectoryProxy.find_timestamp_indices_and_weights | ( | self, | |
fp | |||
) |
Method to find weighted timestamps
indices corresponding to a given time
.
If a time
is smaller than the first timestamp, the returned indices are [0,0] with weights [1,0] as that's the closest value. Similarly, if the time
is greater than the last timestamp, the returned indices are [-1,-1] pointing to the last element of a timestamps
list with weights [1,0]. If the time
value is between the first and last timestamp, the indices belong to the closest higher and lower time. At the same time, if interpolation is off, the weights are 0 and 1, where one is given to the index closest to the time
. Otherwise, the weights, whose sum equals to 1, are computed to show inverse relative distance i.e. an index with a greater weight is the closer.
fp | A DocumentObjectGroupPython Trajectory object. |
Timestamps
. Definition at line 777 of file Trajectory.py.
def Trajectory.TrajectoryProxy.is_trajectory_property | ( | self, | |
prop | |||
) |
Method to check that a property describes a trajectory.
It's checked whether prop
is Timestamps
, TranslationX
, TranslationY
, TranslationZ
, RotationPointX
, RotationPointY
, RotationPointZ
, RotationAxisX
, RotationAxisY
, RotationAxisZ
or RotationAngle
.
prop | A str name of a changed property. |
Definition at line 661 of file Trajectory.py.
def Trajectory.TrajectoryProxy.is_ValidTrajectory | ( | self, | |
timestamps = [] , |
|||
translation_x = [] , |
|||
translation_y = [] , |
|||
translation_z = [] , |
|||
rotation_point_x = [] , |
|||
rotation_point_y = [] , |
|||
rotation_point_z = [] , |
|||
rotation_axis_x = [] , |
|||
rotation_axis_y = [] , |
|||
rotation_axis_z = [] , |
|||
rotation_angle = [] , |
|||
trajectory = None |
|||
) |
Method to check if a trajectory is valid.
This method needs either a trajectory
dictionary argument or all the other lists of floats. A valid trajectory needs to have all the necessary lists. All the lists must have same length. A timestamps
list must consist of a sequence of strictly increasing floats. A rotation axis must have always length equal to 1.
timestamps | A list of floats marking timestamps. |
translation_x | A list of floats signifying translations in X direction. |
translation_y | A list of floats signifying translations in Y direction. |
translation_z | A list of floats signifying translations in Z direction. |
rotation_point_x | A list of floats signifying rotation point X coordinates. |
rotation_point_y | A list of floats signifying rotation point Y coordinates. |
rotation_point_z | A list of floats signifying rotation point Z coordinates. |
rotation_axis_x | A list of floats signifying rotation axis X elements. |
rotation_axis_y | A list of floats signifying rotation axis Y elements. |
rotation_axis_z | A list of floats signifying rotation axis Z elements. |
rotation_angle | A list of floats signifying rotation angles. |
trajectory | A dict containing all lists above. |
Definition at line 693 of file Trajectory.py.
def Trajectory.TrajectoryProxy.onChanged | ( | self, | |
fp, | |||
prop | |||
) |
Method called after DocumentObjectGroupPython
Trajectory was changed.
A trajectory is checked for its validity. If the Placement
property is changed, then ParentFramePlacement
property of a Trajectory
children is set to equal the new Placement
. If the ParentFramePlacement
is changed, then the Placement
property is changed.
fp | A DocumentObjectGroupPython Trajectory object. |
prop | A str name of a changed property. |
Definition at line 276 of file Trajectory.py.
def Trajectory.TrajectoryProxy.onDocumentRestored | ( | self, | |
fp | |||
) |
Method called when document is restored to make sure everything is as it was.
Reinitialization it creates properties and sets them to default, if they were not restored automatically. Properties of connected ViewObject
are also recreated and reset if necessary.
fp | A restored DocumentObjectGroupPython Trajectory object. |
Definition at line 371 of file Trajectory.py.
def Trajectory.TrajectoryProxy.setProperties | ( | self, | |
fp | |||
) |
Method to set properties during initialization or document restoration.
The properties are set if they are not already present and an AnimateDocumentObserver
is recreated.
fp | A restored or barebone DocumentObjectGroupPython Trajectory object. |
Definition at line 385 of file Trajectory.py.
Trajectory.TrajectoryProxy.pose |
A dict describing a pose - position, rotation axis, point and angle.
Definition at line 386 of file Trajectory.py.