_JointPositions.py
Go to the documentation of this file.
00001 """autogenerated by genpy from brics_actuator/JointPositions.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import brics_actuator.msg
00008 import genpy
00009 
00010 class JointPositions(genpy.Message):
00011   _md5sum = "2b7638f5c85f5257bef140a00cd0eec3"
00012   _type = "brics_actuator/JointPositions"
00013   _has_header = False #flag to mark the presence of a Header object
00014   _full_text = """Poison poisonStamp
00015 JointValue[] positions
00016 
00017 ================================================================================
00018 MSG: brics_actuator/Poison
00019 string originator               # node id
00020 string description              # encoding still an issue
00021 float32 qos                     # reliability of the channel
00022                                 # 0..1 where 1 means healthy
00023 
00024 ================================================================================
00025 MSG: brics_actuator/JointValue
00026 time timeStamp          #time of the data 
00027 string joint_uri
00028 string unit             #if empy expects si units, you can use boost::unit
00029 float64 value
00030 
00031 """
00032   __slots__ = ['poisonStamp','positions']
00033   _slot_types = ['brics_actuator/Poison','brics_actuator/JointValue[]']
00034 
00035   def __init__(self, *args, **kwds):
00036     """
00037     Constructor. Any message fields that are implicitly/explicitly
00038     set to None will be assigned a default value. The recommend
00039     use is keyword arguments as this is more robust to future message
00040     changes.  You cannot mix in-order arguments and keyword arguments.
00041 
00042     The available fields are:
00043        poisonStamp,positions
00044 
00045     :param args: complete set of field values, in .msg order
00046     :param kwds: use keyword arguments corresponding to message field names
00047     to set specific fields.
00048     """
00049     if args or kwds:
00050       super(JointPositions, self).__init__(*args, **kwds)
00051       #message fields cannot be None, assign default values for those that are
00052       if self.poisonStamp is None:
00053         self.poisonStamp = brics_actuator.msg.Poison()
00054       if self.positions is None:
00055         self.positions = []
00056     else:
00057       self.poisonStamp = brics_actuator.msg.Poison()
00058       self.positions = []
00059 
00060   def _get_types(self):
00061     """
00062     internal API method
00063     """
00064     return self._slot_types
00065 
00066   def serialize(self, buff):
00067     """
00068     serialize message into buffer
00069     :param buff: buffer, ``StringIO``
00070     """
00071     try:
00072       _x = self.poisonStamp.originator
00073       length = len(_x)
00074       if python3 or type(_x) == unicode:
00075         _x = _x.encode('utf-8')
00076         length = len(_x)
00077       buff.write(struct.pack('<I%ss'%length, length, _x))
00078       _x = self.poisonStamp.description
00079       length = len(_x)
00080       if python3 or type(_x) == unicode:
00081         _x = _x.encode('utf-8')
00082         length = len(_x)
00083       buff.write(struct.pack('<I%ss'%length, length, _x))
00084       buff.write(_struct_f.pack(self.poisonStamp.qos))
00085       length = len(self.positions)
00086       buff.write(_struct_I.pack(length))
00087       for val1 in self.positions:
00088         _v1 = val1.timeStamp
00089         _x = _v1
00090         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00091         _x = val1.joint_uri
00092         length = len(_x)
00093         if python3 or type(_x) == unicode:
00094           _x = _x.encode('utf-8')
00095           length = len(_x)
00096         buff.write(struct.pack('<I%ss'%length, length, _x))
00097         _x = val1.unit
00098         length = len(_x)
00099         if python3 or type(_x) == unicode:
00100           _x = _x.encode('utf-8')
00101           length = len(_x)
00102         buff.write(struct.pack('<I%ss'%length, length, _x))
00103         buff.write(_struct_d.pack(val1.value))
00104     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00105     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00106 
00107   def deserialize(self, str):
00108     """
00109     unpack serialized message in str into this message instance
00110     :param str: byte array of serialized message, ``str``
00111     """
00112     try:
00113       if self.poisonStamp is None:
00114         self.poisonStamp = brics_actuator.msg.Poison()
00115       if self.positions is None:
00116         self.positions = None
00117       end = 0
00118       start = end
00119       end += 4
00120       (length,) = _struct_I.unpack(str[start:end])
00121       start = end
00122       end += length
00123       if python3:
00124         self.poisonStamp.originator = str[start:end].decode('utf-8')
00125       else:
00126         self.poisonStamp.originator = str[start:end]
00127       start = end
00128       end += 4
00129       (length,) = _struct_I.unpack(str[start:end])
00130       start = end
00131       end += length
00132       if python3:
00133         self.poisonStamp.description = str[start:end].decode('utf-8')
00134       else:
00135         self.poisonStamp.description = str[start:end]
00136       start = end
00137       end += 4
00138       (self.poisonStamp.qos,) = _struct_f.unpack(str[start:end])
00139       start = end
00140       end += 4
00141       (length,) = _struct_I.unpack(str[start:end])
00142       self.positions = []
00143       for i in range(0, length):
00144         val1 = brics_actuator.msg.JointValue()
00145         _v2 = val1.timeStamp
00146         _x = _v2
00147         start = end
00148         end += 8
00149         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00150         start = end
00151         end += 4
00152         (length,) = _struct_I.unpack(str[start:end])
00153         start = end
00154         end += length
00155         if python3:
00156           val1.joint_uri = str[start:end].decode('utf-8')
00157         else:
00158           val1.joint_uri = str[start:end]
00159         start = end
00160         end += 4
00161         (length,) = _struct_I.unpack(str[start:end])
00162         start = end
00163         end += length
00164         if python3:
00165           val1.unit = str[start:end].decode('utf-8')
00166         else:
00167           val1.unit = str[start:end]
00168         start = end
00169         end += 8
00170         (val1.value,) = _struct_d.unpack(str[start:end])
00171         self.positions.append(val1)
00172       return self
00173     except struct.error as e:
00174       raise genpy.DeserializationError(e) #most likely buffer underfill
00175 
00176 
00177   def serialize_numpy(self, buff, numpy):
00178     """
00179     serialize message with numpy array types into buffer
00180     :param buff: buffer, ``StringIO``
00181     :param numpy: numpy python module
00182     """
00183     try:
00184       _x = self.poisonStamp.originator
00185       length = len(_x)
00186       if python3 or type(_x) == unicode:
00187         _x = _x.encode('utf-8')
00188         length = len(_x)
00189       buff.write(struct.pack('<I%ss'%length, length, _x))
00190       _x = self.poisonStamp.description
00191       length = len(_x)
00192       if python3 or type(_x) == unicode:
00193         _x = _x.encode('utf-8')
00194         length = len(_x)
00195       buff.write(struct.pack('<I%ss'%length, length, _x))
00196       buff.write(_struct_f.pack(self.poisonStamp.qos))
00197       length = len(self.positions)
00198       buff.write(_struct_I.pack(length))
00199       for val1 in self.positions:
00200         _v3 = val1.timeStamp
00201         _x = _v3
00202         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00203         _x = val1.joint_uri
00204         length = len(_x)
00205         if python3 or type(_x) == unicode:
00206           _x = _x.encode('utf-8')
00207           length = len(_x)
00208         buff.write(struct.pack('<I%ss'%length, length, _x))
00209         _x = val1.unit
00210         length = len(_x)
00211         if python3 or type(_x) == unicode:
00212           _x = _x.encode('utf-8')
00213           length = len(_x)
00214         buff.write(struct.pack('<I%ss'%length, length, _x))
00215         buff.write(_struct_d.pack(val1.value))
00216     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00217     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00218 
00219   def deserialize_numpy(self, str, numpy):
00220     """
00221     unpack serialized message in str into this message instance using numpy for array types
00222     :param str: byte array of serialized message, ``str``
00223     :param numpy: numpy python module
00224     """
00225     try:
00226       if self.poisonStamp is None:
00227         self.poisonStamp = brics_actuator.msg.Poison()
00228       if self.positions is None:
00229         self.positions = None
00230       end = 0
00231       start = end
00232       end += 4
00233       (length,) = _struct_I.unpack(str[start:end])
00234       start = end
00235       end += length
00236       if python3:
00237         self.poisonStamp.originator = str[start:end].decode('utf-8')
00238       else:
00239         self.poisonStamp.originator = str[start:end]
00240       start = end
00241       end += 4
00242       (length,) = _struct_I.unpack(str[start:end])
00243       start = end
00244       end += length
00245       if python3:
00246         self.poisonStamp.description = str[start:end].decode('utf-8')
00247       else:
00248         self.poisonStamp.description = str[start:end]
00249       start = end
00250       end += 4
00251       (self.poisonStamp.qos,) = _struct_f.unpack(str[start:end])
00252       start = end
00253       end += 4
00254       (length,) = _struct_I.unpack(str[start:end])
00255       self.positions = []
00256       for i in range(0, length):
00257         val1 = brics_actuator.msg.JointValue()
00258         _v4 = val1.timeStamp
00259         _x = _v4
00260         start = end
00261         end += 8
00262         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00263         start = end
00264         end += 4
00265         (length,) = _struct_I.unpack(str[start:end])
00266         start = end
00267         end += length
00268         if python3:
00269           val1.joint_uri = str[start:end].decode('utf-8')
00270         else:
00271           val1.joint_uri = str[start:end]
00272         start = end
00273         end += 4
00274         (length,) = _struct_I.unpack(str[start:end])
00275         start = end
00276         end += length
00277         if python3:
00278           val1.unit = str[start:end].decode('utf-8')
00279         else:
00280           val1.unit = str[start:end]
00281         start = end
00282         end += 8
00283         (val1.value,) = _struct_d.unpack(str[start:end])
00284         self.positions.append(val1)
00285       return self
00286     except struct.error as e:
00287       raise genpy.DeserializationError(e) #most likely buffer underfill
00288 
00289 _struct_I = genpy.struct_I
00290 _struct_d = struct.Struct("<d")
00291 _struct_2I = struct.Struct("<2I")
00292 _struct_f = struct.Struct("<f")


brics_actuator
Author(s): Alexander Bubeck
autogenerated on Sun Oct 5 2014 22:58:19