_JointValue.py
Go to the documentation of this file.
00001 """autogenerated by genpy from brics_actuator/JointValue.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 genpy
00008 
00009 class JointValue(genpy.Message):
00010   _md5sum = "c8dad5a006889ad7de711a684999f0c6"
00011   _type = "brics_actuator/JointValue"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """time timeStamp                #time of the data 
00014 string joint_uri
00015 string unit             #if empy expects si units, you can use boost::unit
00016 float64 value
00017 
00018 """
00019   __slots__ = ['timeStamp','joint_uri','unit','value']
00020   _slot_types = ['time','string','string','float64']
00021 
00022   def __init__(self, *args, **kwds):
00023     """
00024     Constructor. Any message fields that are implicitly/explicitly
00025     set to None will be assigned a default value. The recommend
00026     use is keyword arguments as this is more robust to future message
00027     changes.  You cannot mix in-order arguments and keyword arguments.
00028 
00029     The available fields are:
00030        timeStamp,joint_uri,unit,value
00031 
00032     :param args: complete set of field values, in .msg order
00033     :param kwds: use keyword arguments corresponding to message field names
00034     to set specific fields.
00035     """
00036     if args or kwds:
00037       super(JointValue, self).__init__(*args, **kwds)
00038       #message fields cannot be None, assign default values for those that are
00039       if self.timeStamp is None:
00040         self.timeStamp = genpy.Time()
00041       if self.joint_uri is None:
00042         self.joint_uri = ''
00043       if self.unit is None:
00044         self.unit = ''
00045       if self.value is None:
00046         self.value = 0.
00047     else:
00048       self.timeStamp = genpy.Time()
00049       self.joint_uri = ''
00050       self.unit = ''
00051       self.value = 0.
00052 
00053   def _get_types(self):
00054     """
00055     internal API method
00056     """
00057     return self._slot_types
00058 
00059   def serialize(self, buff):
00060     """
00061     serialize message into buffer
00062     :param buff: buffer, ``StringIO``
00063     """
00064     try:
00065       _x = self
00066       buff.write(_struct_2I.pack(_x.timeStamp.secs, _x.timeStamp.nsecs))
00067       _x = self.joint_uri
00068       length = len(_x)
00069       if python3 or type(_x) == unicode:
00070         _x = _x.encode('utf-8')
00071         length = len(_x)
00072       buff.write(struct.pack('<I%ss'%length, length, _x))
00073       _x = self.unit
00074       length = len(_x)
00075       if python3 or type(_x) == unicode:
00076         _x = _x.encode('utf-8')
00077         length = len(_x)
00078       buff.write(struct.pack('<I%ss'%length, length, _x))
00079       buff.write(_struct_d.pack(self.value))
00080     except struct.error as se: self._check_types(se)
00081     except TypeError as te: self._check_types(te)
00082 
00083   def deserialize(self, str):
00084     """
00085     unpack serialized message in str into this message instance
00086     :param str: byte array of serialized message, ``str``
00087     """
00088     try:
00089       if self.timeStamp is None:
00090         self.timeStamp = genpy.Time()
00091       end = 0
00092       _x = self
00093       start = end
00094       end += 8
00095       (_x.timeStamp.secs, _x.timeStamp.nsecs,) = _struct_2I.unpack(str[start:end])
00096       start = end
00097       end += 4
00098       (length,) = _struct_I.unpack(str[start:end])
00099       start = end
00100       end += length
00101       if python3:
00102         self.joint_uri = str[start:end].decode('utf-8')
00103       else:
00104         self.joint_uri = str[start:end]
00105       start = end
00106       end += 4
00107       (length,) = _struct_I.unpack(str[start:end])
00108       start = end
00109       end += length
00110       if python3:
00111         self.unit = str[start:end].decode('utf-8')
00112       else:
00113         self.unit = str[start:end]
00114       start = end
00115       end += 8
00116       (self.value,) = _struct_d.unpack(str[start:end])
00117       self.timeStamp.canon()
00118       return self
00119     except struct.error as e:
00120       raise genpy.DeserializationError(e) #most likely buffer underfill
00121 
00122 
00123   def serialize_numpy(self, buff, numpy):
00124     """
00125     serialize message with numpy array types into buffer
00126     :param buff: buffer, ``StringIO``
00127     :param numpy: numpy python module
00128     """
00129     try:
00130       _x = self
00131       buff.write(_struct_2I.pack(_x.timeStamp.secs, _x.timeStamp.nsecs))
00132       _x = self.joint_uri
00133       length = len(_x)
00134       if python3 or type(_x) == unicode:
00135         _x = _x.encode('utf-8')
00136         length = len(_x)
00137       buff.write(struct.pack('<I%ss'%length, length, _x))
00138       _x = self.unit
00139       length = len(_x)
00140       if python3 or type(_x) == unicode:
00141         _x = _x.encode('utf-8')
00142         length = len(_x)
00143       buff.write(struct.pack('<I%ss'%length, length, _x))
00144       buff.write(_struct_d.pack(self.value))
00145     except struct.error as se: self._check_types(se)
00146     except TypeError as te: self._check_types(te)
00147 
00148   def deserialize_numpy(self, str, numpy):
00149     """
00150     unpack serialized message in str into this message instance using numpy for array types
00151     :param str: byte array of serialized message, ``str``
00152     :param numpy: numpy python module
00153     """
00154     try:
00155       if self.timeStamp is None:
00156         self.timeStamp = genpy.Time()
00157       end = 0
00158       _x = self
00159       start = end
00160       end += 8
00161       (_x.timeStamp.secs, _x.timeStamp.nsecs,) = _struct_2I.unpack(str[start:end])
00162       start = end
00163       end += 4
00164       (length,) = _struct_I.unpack(str[start:end])
00165       start = end
00166       end += length
00167       if python3:
00168         self.joint_uri = str[start:end].decode('utf-8')
00169       else:
00170         self.joint_uri = str[start:end]
00171       start = end
00172       end += 4
00173       (length,) = _struct_I.unpack(str[start:end])
00174       start = end
00175       end += length
00176       if python3:
00177         self.unit = str[start:end].decode('utf-8')
00178       else:
00179         self.unit = str[start:end]
00180       start = end
00181       end += 8
00182       (self.value,) = _struct_d.unpack(str[start:end])
00183       self.timeStamp.canon()
00184       return self
00185     except struct.error as e:
00186       raise genpy.DeserializationError(e) #most likely buffer underfill
00187 
00188 _struct_I = genpy.struct_I
00189 _struct_2I = struct.Struct("<2I")
00190 _struct_d = struct.Struct("<d")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


brics_actuator
Author(s): Alexander Bubeck
autogenerated on Fri Mar 1 2013 17:46:23