Proxy class for a DocumentObjectGroupPython
RobTranslation instance.
More...
Public Member Functions | |
def | __init__ (self, fp) |
Initialization method for RobTranslationProxy. More... | |
def | onChanged (self, fp, prop) |
Method called after DocumentObjectGroupPython RobTranslation 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_joint_sequence (self, joint_sequence) |
Method used to change a RobTranslation 's joint variable sequence. More... | |
def | is_translation_property (self, prop) |
Method to check that a property describes a translation. More... | |
def | is_ValidTranslation (self, timestamps=[], ds=[], translation=None) |
Method to check if a translation is valid. More... | |
def | find_timestamp_indices_and_weights (self, fp) |
Method to find weighted timestamps indices corresponding to a given time . More... | |
def | __getstate__ (self) |
Necessary method to avoid errors when trying to save unserializable objects. More... | |
def | __setstate__ (self, state) |
Necessary method to avoid errors when trying to restore unserializable objects. More... | |
Public Attributes | |
updated | |
fp | |
A DocumentObjectGroupPython associated with the proxy. More... | |
Static Public Attributes | |
bool | updated = False |
A bool - True if a property was changed by a class and not user. More... | |
Proxy class for a DocumentObjectGroupPython
RobTranslation instance.
A RobTranslationProxy instance adds properties to a DocumentObjectGroupPython
RobTranslation instance and responds to their changes. It provides a RobotPanel
to be able to see an object in a displacement range.
To connect a Proxy
object to a DocumentObjectGroupPython
RobTranslation do:
Definition at line 71 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.__init__ | ( | self, | |
fp | |||
) |
Initialization method for RobTranslationProxy.
A class instance is created and made a Proxy
for a generic DocumentObjectGroupPython
RobTranslation object. During initialization number of properties are specified and preset.
fp | A DocumentObjectGroupPython RobTranslation object to be extended. |
Definition at line 91 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.__getstate__ | ( | self | ) |
Necessary method to avoid errors when trying to save unserializable objects.
This method is used by JSON to serialize unserializable objects during autosave. Without this an Error would rise when JSON would try to do that itself.
We need this for unserializable fp
attribute, but we don't serialize it, because it's enough to reset it when object is restored.
Definition at line 546 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.__setstate__ | ( | self, | |
state | |||
) |
Necessary method to avoid errors when trying to restore unserializable objects.
This method is used during a document restoration. We need this for unserializable fp
attribute, but we do not restore it, because it's enough to reset them from saved parameters.
Definition at line 559 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.change_joint_sequence | ( | self, | |
joint_sequence | |||
) |
Method used to change a RobTranslation
's joint variable sequence.
A joint_sequence
dictionary containing a translation is tested for validity and then assigned to a RobTranslation
DocumentObjectGroupPython
.
fp | A DocumentObjectGroupPython RobTranslation object. |
joint_sequence | A dictionary describing a RobTranslation. |
Definition at line 411 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.execute | ( | self, | |
fp | |||
) |
Method called when recomputing a DocumentObjectGroupPython
.
New placement is computed, if a RobotPanel is active or it is not active, but rotation is valid. The current pose in a parent coordinate frame is computed using DH parameters. At last ObjectPlacement
and Placement
are updated accordingly.
fp | A DocumentObjectGroupPython RobTranslation object. |
Definition at line 161 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.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 RobTranslation object. |
Timestamps
. Definition at line 503 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.is_translation_property | ( | self, | |
prop | |||
) |
Method to check that a property describes a translation.
It's checked whether prop
is Timestamps
or dSequence
.
prop | A str name of a changed property. |
Definition at line 430 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.is_ValidTranslation | ( | self, | |
timestamps = [] , |
|||
ds = [] , |
|||
translation = None |
|||
) |
Method to check if a translation is valid.
This method needs either a translation
dictionary argument or all the other lists of floats. A valid translation 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 displacement cannot exceed joint limits.
timestamps | A list of floats marking timestamps. |
ds | A list of floats signifying translation diplacements along Z axis. |
translation | A dict containing all lists above. |
Definition at line 450 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.onChanged | ( | self, | |
fp, | |||
prop | |||
) |
Method called after DocumentObjectGroupPython
RobTranslation was changed.
A translation is checked for its validity. If the Placement
property is changed, then ParentFramePlacement
property of a RobTranslation
children is set to equal the new Placement
. If the ParentFramePlacement
is changed, then the Placement
property is changed.
fp | A DocumentObjectGroupPython RobTranslation object. |
prop | A str name of a changed property. |
Definition at line 108 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.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 RobTranslation object. |
Definition at line 205 of file RobTranslation.py.
def RobTranslation.RobTranslationProxy.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 RobTranslation object. |
Definition at line 219 of file RobTranslation.py.
RobTranslation.RobTranslationProxy.fp |
A DocumentObjectGroupPython
associated with the proxy.
Definition at line 386 of file RobTranslation.py.
|
static |
A bool - True if a property was changed by a class and not user.
Definition at line 79 of file RobTranslation.py.