Proxy class for a DocumentObjectGroupPython
RobRotation instance.
More...
Public Member Functions | |
def | printt (self) |
def | __init__ (self, fp) |
Initialization method for RobRotationProxy. More... | |
def | onChanged (self, fp, prop) |
Method called after DocumentObjectGroupPython RobRotation 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 RobRotation 's joint variable sequence. More... | |
def | is_rotation_property (self, prop) |
Method to check that a property describes a rotation. More... | |
def | is_ValidRotation (self, timestamps=[], thetas=[], rotation=None) |
Method to check if a rotation 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
RobRotation instance.
A RobRotationProxy instance adds properties to a DocumentObjectGroupPython
RobRotation instance and responds to their changes. It provides a RobotPanel
to be able to see an object in a rotation range.
To connect this Proxy
object to a DocumentObjectGroupPython
RobRotation do:
Definition at line 71 of file RobRotation.py.
def RobRotation.RobRotationProxy.__init__ | ( | self, | |
fp | |||
) |
Initialization method for RobRotationProxy.
A class instance is created and made a Proxy
for a generic DocumentObjectGroupPython
RobRotation object. During initialization number of properties are specified and preset.
fp | A DocumentObjectGroupPython RobRotation object to be extended. |
Definition at line 94 of file RobRotation.py.
def RobRotation.RobRotationProxy.__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 556 of file RobRotation.py.
def RobRotation.RobRotationProxy.__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 569 of file RobRotation.py.
def RobRotation.RobRotationProxy.change_joint_sequence | ( | self, | |
joint_sequence | |||
) |
Method used to change a RobRotation
's joint variable sequence.
A joint_sequence
dictionary containing a rotation is tested for validity and then assigned to a RobRotation
DocumentObjectGroupPython
.
joint_sequence | A dictionary describing a rotation. |
Definition at line 420 of file RobRotation.py.
def RobRotation.RobRotationProxy.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 RobRotation object. |
Definition at line 167 of file RobRotation.py.
def RobRotation.RobRotationProxy.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 RobRotation object. |
Timestamps
. Definition at line 513 of file RobRotation.py.
def RobRotation.RobRotationProxy.is_rotation_property | ( | self, | |
prop | |||
) |
Method to check that a property describes a rotation.
It's checked whether prop
is Timestamps
or thetaSequence
.
prop | A str name of a changed property. |
Definition at line 439 of file RobRotation.py.
def RobRotation.RobRotationProxy.is_ValidRotation | ( | self, | |
timestamps = [] , |
|||
thetas = [] , |
|||
rotation = None |
|||
) |
Method to check if a rotation is valid.
This method needs either a rotation
dictionary argument or all the other lists of floats. A valid rotation 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 angle cannot exceed joint limits.
timestamps | A list of floats marking timestamps. |
thetas | A list of floats signifying rotation angles about Z axis. |
rotation | A dict containing all lists above. |
Definition at line 459 of file RobRotation.py.
def RobRotation.RobRotationProxy.onChanged | ( | self, | |
fp, | |||
prop | |||
) |
Method called after DocumentObjectGroupPython
RobRotation was changed.
A rotation is checked for its validity. If the Placement
property is changed, then ParentFramePlacement
property of a RobRotation
children is set to equal the new Placement
. If the ParentFramePlacement
is changed, then the Placement
property is changed.
fp | A DocumentObjectGroupPython RobRotation object. |
prop | A str name of a changed property. |
Definition at line 111 of file RobRotation.py.
def RobRotation.RobRotationProxy.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 RobRotation object. |
Definition at line 212 of file RobRotation.py.
def RobRotation.RobRotationProxy.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 RobRotation object. |
Definition at line 226 of file RobRotation.py.
RobRotation.RobRotationProxy.fp |
A DocumentObjectGroupPython
associated with the proxy.
Definition at line 396 of file RobRotation.py.
|
static |
A bool - True if a property was changed by a class and not user.
Definition at line 79 of file RobRotation.py.