00001 """autogenerated by genmsg_py from sendupdate.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import sr_robot_msgs.msg
00006
00007 class sendupdate(roslib.message.Message):
00008 _md5sum = "78ecf46ea823fec446125c0ac5bfee40"
00009 _type = "sr_robot_msgs/sendupdate"
00010 _has_header = False
00011 _full_text = """int8 sendupdate_length
00012 joint[] sendupdate_list
00013
00014
00015 ================================================================================
00016 MSG: sr_robot_msgs/joint
00017 string joint_name
00018 float32 joint_position
00019 float32 joint_target
00020 float32 joint_torque
00021 float32 joint_temperature
00022 float32 joint_current
00023 string error_flag
00024
00025 """
00026 __slots__ = ['sendupdate_length','sendupdate_list']
00027 _slot_types = ['int8','sr_robot_msgs/joint[]']
00028
00029 def __init__(self, *args, **kwds):
00030 """
00031 Constructor. Any message fields that are implicitly/explicitly
00032 set to None will be assigned a default value. The recommend
00033 use is keyword arguments as this is more robust to future message
00034 changes. You cannot mix in-order arguments and keyword arguments.
00035
00036 The available fields are:
00037 sendupdate_length,sendupdate_list
00038
00039 @param args: complete set of field values, in .msg order
00040 @param kwds: use keyword arguments corresponding to message field names
00041 to set specific fields.
00042 """
00043 if args or kwds:
00044 super(sendupdate, self).__init__(*args, **kwds)
00045
00046 if self.sendupdate_length is None:
00047 self.sendupdate_length = 0
00048 if self.sendupdate_list is None:
00049 self.sendupdate_list = []
00050 else:
00051 self.sendupdate_length = 0
00052 self.sendupdate_list = []
00053
00054 def _get_types(self):
00055 """
00056 internal API method
00057 """
00058 return self._slot_types
00059
00060 def serialize(self, buff):
00061 """
00062 serialize message into buffer
00063 @param buff: buffer
00064 @type buff: StringIO
00065 """
00066 try:
00067 buff.write(_struct_b.pack(self.sendupdate_length))
00068 length = len(self.sendupdate_list)
00069 buff.write(_struct_I.pack(length))
00070 for val1 in self.sendupdate_list:
00071 _x = val1.joint_name
00072 length = len(_x)
00073 buff.write(struct.pack('<I%ss'%length, length, _x))
00074 _x = val1
00075 buff.write(_struct_5f.pack(_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current))
00076 _x = val1.error_flag
00077 length = len(_x)
00078 buff.write(struct.pack('<I%ss'%length, length, _x))
00079 except struct.error, se: self._check_types(se)
00080 except TypeError, te: self._check_types(te)
00081
00082 def deserialize(self, str):
00083 """
00084 unpack serialized message in str into this message instance
00085 @param str: byte array of serialized message
00086 @type str: str
00087 """
00088 try:
00089 end = 0
00090 start = end
00091 end += 1
00092 (self.sendupdate_length,) = _struct_b.unpack(str[start:end])
00093 start = end
00094 end += 4
00095 (length,) = _struct_I.unpack(str[start:end])
00096 self.sendupdate_list = []
00097 for i in xrange(0, length):
00098 val1 = sr_robot_msgs.msg.joint()
00099 start = end
00100 end += 4
00101 (length,) = _struct_I.unpack(str[start:end])
00102 start = end
00103 end += length
00104 val1.joint_name = str[start:end]
00105 _x = val1
00106 start = end
00107 end += 20
00108 (_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current,) = _struct_5f.unpack(str[start:end])
00109 start = end
00110 end += 4
00111 (length,) = _struct_I.unpack(str[start:end])
00112 start = end
00113 end += length
00114 val1.error_flag = str[start:end]
00115 self.sendupdate_list.append(val1)
00116 return self
00117 except struct.error, e:
00118 raise roslib.message.DeserializationError(e)
00119
00120
00121 def serialize_numpy(self, buff, numpy):
00122 """
00123 serialize message with numpy array types into buffer
00124 @param buff: buffer
00125 @type buff: StringIO
00126 @param numpy: numpy python module
00127 @type numpy module
00128 """
00129 try:
00130 buff.write(_struct_b.pack(self.sendupdate_length))
00131 length = len(self.sendupdate_list)
00132 buff.write(_struct_I.pack(length))
00133 for val1 in self.sendupdate_list:
00134 _x = val1.joint_name
00135 length = len(_x)
00136 buff.write(struct.pack('<I%ss'%length, length, _x))
00137 _x = val1
00138 buff.write(_struct_5f.pack(_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current))
00139 _x = val1.error_flag
00140 length = len(_x)
00141 buff.write(struct.pack('<I%ss'%length, length, _x))
00142 except struct.error, se: self._check_types(se)
00143 except TypeError, te: self._check_types(te)
00144
00145 def deserialize_numpy(self, str, numpy):
00146 """
00147 unpack serialized message in str into this message instance using numpy for array types
00148 @param str: byte array of serialized message
00149 @type str: str
00150 @param numpy: numpy python module
00151 @type numpy: module
00152 """
00153 try:
00154 end = 0
00155 start = end
00156 end += 1
00157 (self.sendupdate_length,) = _struct_b.unpack(str[start:end])
00158 start = end
00159 end += 4
00160 (length,) = _struct_I.unpack(str[start:end])
00161 self.sendupdate_list = []
00162 for i in xrange(0, length):
00163 val1 = sr_robot_msgs.msg.joint()
00164 start = end
00165 end += 4
00166 (length,) = _struct_I.unpack(str[start:end])
00167 start = end
00168 end += length
00169 val1.joint_name = str[start:end]
00170 _x = val1
00171 start = end
00172 end += 20
00173 (_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current,) = _struct_5f.unpack(str[start:end])
00174 start = end
00175 end += 4
00176 (length,) = _struct_I.unpack(str[start:end])
00177 start = end
00178 end += length
00179 val1.error_flag = str[start:end]
00180 self.sendupdate_list.append(val1)
00181 return self
00182 except struct.error, e:
00183 raise roslib.message.DeserializationError(e)
00184
00185 _struct_I = roslib.message.struct_I
00186 _struct_5f = struct.Struct("<5f")
00187 _struct_b = struct.Struct("<b")