_sendupdate.py
Go to the documentation of this file.
00001 """autogenerated by genpy from sr_robot_msgs/sendupdate.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 sr_robot_msgs.msg
00008 
00009 class sendupdate(genpy.Message):
00010   _md5sum = "43a45fe046127fe123dc7e38e3ffdc36"
00011   _type = "sr_robot_msgs/sendupdate"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """int8 sendupdate_length
00014 joint[] sendupdate_list
00015 
00016 
00017 ================================================================================
00018 MSG: sr_robot_msgs/joint
00019 string  joint_name
00020 float64 joint_position
00021 float64 joint_target
00022 float64 joint_torque
00023 float64 joint_temperature
00024 float64 joint_current
00025 string  error_flag
00026 
00027 """
00028   __slots__ = ['sendupdate_length','sendupdate_list']
00029   _slot_types = ['int8','sr_robot_msgs/joint[]']
00030 
00031   def __init__(self, *args, **kwds):
00032     """
00033     Constructor. Any message fields that are implicitly/explicitly
00034     set to None will be assigned a default value. The recommend
00035     use is keyword arguments as this is more robust to future message
00036     changes.  You cannot mix in-order arguments and keyword arguments.
00037 
00038     The available fields are:
00039        sendupdate_length,sendupdate_list
00040 
00041     :param args: complete set of field values, in .msg order
00042     :param kwds: use keyword arguments corresponding to message field names
00043     to set specific fields.
00044     """
00045     if args or kwds:
00046       super(sendupdate, self).__init__(*args, **kwds)
00047       #message fields cannot be None, assign default values for those that are
00048       if self.sendupdate_length is None:
00049         self.sendupdate_length = 0
00050       if self.sendupdate_list is None:
00051         self.sendupdate_list = []
00052     else:
00053       self.sendupdate_length = 0
00054       self.sendupdate_list = []
00055 
00056   def _get_types(self):
00057     """
00058     internal API method
00059     """
00060     return self._slot_types
00061 
00062   def serialize(self, buff):
00063     """
00064     serialize message into buffer
00065     :param buff: buffer, ``StringIO``
00066     """
00067     try:
00068       buff.write(_struct_b.pack(self.sendupdate_length))
00069       length = len(self.sendupdate_list)
00070       buff.write(_struct_I.pack(length))
00071       for val1 in self.sendupdate_list:
00072         _x = val1.joint_name
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 = val1
00079         buff.write(_struct_5d.pack(_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current))
00080         _x = val1.error_flag
00081         length = len(_x)
00082         if python3 or type(_x) == unicode:
00083           _x = _x.encode('utf-8')
00084           length = len(_x)
00085         buff.write(struct.pack('<I%ss'%length, length, _x))
00086     except struct.error as se: self._check_types(se)
00087     except TypeError as te: self._check_types(te)
00088 
00089   def deserialize(self, str):
00090     """
00091     unpack serialized message in str into this message instance
00092     :param str: byte array of serialized message, ``str``
00093     """
00094     try:
00095       if self.sendupdate_list is None:
00096         self.sendupdate_list = None
00097       end = 0
00098       start = end
00099       end += 1
00100       (self.sendupdate_length,) = _struct_b.unpack(str[start:end])
00101       start = end
00102       end += 4
00103       (length,) = _struct_I.unpack(str[start:end])
00104       self.sendupdate_list = []
00105       for i in range(0, length):
00106         val1 = sr_robot_msgs.msg.joint()
00107         start = end
00108         end += 4
00109         (length,) = _struct_I.unpack(str[start:end])
00110         start = end
00111         end += length
00112         if python3:
00113           val1.joint_name = str[start:end].decode('utf-8')
00114         else:
00115           val1.joint_name = str[start:end]
00116         _x = val1
00117         start = end
00118         end += 40
00119         (_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current,) = _struct_5d.unpack(str[start:end])
00120         start = end
00121         end += 4
00122         (length,) = _struct_I.unpack(str[start:end])
00123         start = end
00124         end += length
00125         if python3:
00126           val1.error_flag = str[start:end].decode('utf-8')
00127         else:
00128           val1.error_flag = str[start:end]
00129         self.sendupdate_list.append(val1)
00130       return self
00131     except struct.error as e:
00132       raise genpy.DeserializationError(e) #most likely buffer underfill
00133 
00134 
00135   def serialize_numpy(self, buff, numpy):
00136     """
00137     serialize message with numpy array types into buffer
00138     :param buff: buffer, ``StringIO``
00139     :param numpy: numpy python module
00140     """
00141     try:
00142       buff.write(_struct_b.pack(self.sendupdate_length))
00143       length = len(self.sendupdate_list)
00144       buff.write(_struct_I.pack(length))
00145       for val1 in self.sendupdate_list:
00146         _x = val1.joint_name
00147         length = len(_x)
00148         if python3 or type(_x) == unicode:
00149           _x = _x.encode('utf-8')
00150           length = len(_x)
00151         buff.write(struct.pack('<I%ss'%length, length, _x))
00152         _x = val1
00153         buff.write(_struct_5d.pack(_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current))
00154         _x = val1.error_flag
00155         length = len(_x)
00156         if python3 or type(_x) == unicode:
00157           _x = _x.encode('utf-8')
00158           length = len(_x)
00159         buff.write(struct.pack('<I%ss'%length, length, _x))
00160     except struct.error as se: self._check_types(se)
00161     except TypeError as te: self._check_types(te)
00162 
00163   def deserialize_numpy(self, str, numpy):
00164     """
00165     unpack serialized message in str into this message instance using numpy for array types
00166     :param str: byte array of serialized message, ``str``
00167     :param numpy: numpy python module
00168     """
00169     try:
00170       if self.sendupdate_list is None:
00171         self.sendupdate_list = None
00172       end = 0
00173       start = end
00174       end += 1
00175       (self.sendupdate_length,) = _struct_b.unpack(str[start:end])
00176       start = end
00177       end += 4
00178       (length,) = _struct_I.unpack(str[start:end])
00179       self.sendupdate_list = []
00180       for i in range(0, length):
00181         val1 = sr_robot_msgs.msg.joint()
00182         start = end
00183         end += 4
00184         (length,) = _struct_I.unpack(str[start:end])
00185         start = end
00186         end += length
00187         if python3:
00188           val1.joint_name = str[start:end].decode('utf-8')
00189         else:
00190           val1.joint_name = str[start:end]
00191         _x = val1
00192         start = end
00193         end += 40
00194         (_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current,) = _struct_5d.unpack(str[start:end])
00195         start = end
00196         end += 4
00197         (length,) = _struct_I.unpack(str[start:end])
00198         start = end
00199         end += length
00200         if python3:
00201           val1.error_flag = str[start:end].decode('utf-8')
00202         else:
00203           val1.error_flag = str[start:end]
00204         self.sendupdate_list.append(val1)
00205       return self
00206     except struct.error as e:
00207       raise genpy.DeserializationError(e) #most likely buffer underfill
00208 
00209 _struct_I = genpy.struct_I
00210 _struct_5d = struct.Struct("<5d")
00211 _struct_b = struct.Struct("<b")


sr_robot_msgs
Author(s): Ugo Cupcic/ugo@shadowrobot.com
autogenerated on Fri Jan 3 2014 12:01:40