00001 """autogenerated by genmsg_py from command.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import sr_robot_msgs.msg
00006
00007 class command(roslib.message.Message):
00008 _md5sum = "fb5780bd888e4fbc42b3012bc46be2fa"
00009 _type = "sr_robot_msgs/command"
00010 _has_header = False
00011 _full_text = """# sendupdate is 1
00012 # contrlr is 2
00013 int8 command_type
00014
00015 sendupdate sendupdate_command
00016 contrlr contrlr_command
00017
00018 ================================================================================
00019 MSG: sr_robot_msgs/sendupdate
00020 int8 sendupdate_length
00021 joint[] sendupdate_list
00022
00023
00024 ================================================================================
00025 MSG: sr_robot_msgs/joint
00026 string joint_name
00027 float32 joint_position
00028 float32 joint_target
00029 float32 joint_torque
00030 float32 joint_temperature
00031 float32 joint_current
00032 string error_flag
00033
00034 ================================================================================
00035 MSG: sr_robot_msgs/contrlr
00036 # the contrlr name (e.g. smart_motor_ff2)
00037 string contrlr_name
00038
00039 # specify here a list of parameter_name:value
00040 # e.g. p:10 sets the p value of the controller to 10
00041 # the possible parameters are:
00042 #int16 p
00043 #int16 i
00044 #int16 d
00045 #int16 imax
00046 #int16 target
00047 #int16 sensor
00048 #int16 valve
00049 #int16 deadband
00050 #int16 offset
00051 #int16 shift
00052 #int16 max
00053 #
00054 ## parameters for the motors
00055 #int16 motor_maxforce
00056 #int16 motor_safeforce
00057 #int16 force_p
00058 #int16 force_i
00059 #int16 force_d
00060 #int16 force_imax
00061 #int16 force_out_shift
00062 #int16 force_deadband
00063 #int16 force_offset
00064 #int16 sensor_imax
00065 #int16 sensor_deadband
00066 #int16 sensor_offset
00067 #int16 max_temperature
00068 #int16 max_current
00069
00070 string[] list_of_parameters
00071
00072 # the size of the list_of_parameters you are sending
00073 uint8 length_of_list
00074
00075
00076
00077 """
00078 __slots__ = ['command_type','sendupdate_command','contrlr_command']
00079 _slot_types = ['int8','sr_robot_msgs/sendupdate','sr_robot_msgs/contrlr']
00080
00081 def __init__(self, *args, **kwds):
00082 """
00083 Constructor. Any message fields that are implicitly/explicitly
00084 set to None will be assigned a default value. The recommend
00085 use is keyword arguments as this is more robust to future message
00086 changes. You cannot mix in-order arguments and keyword arguments.
00087
00088 The available fields are:
00089 command_type,sendupdate_command,contrlr_command
00090
00091 @param args: complete set of field values, in .msg order
00092 @param kwds: use keyword arguments corresponding to message field names
00093 to set specific fields.
00094 """
00095 if args or kwds:
00096 super(command, self).__init__(*args, **kwds)
00097
00098 if self.command_type is None:
00099 self.command_type = 0
00100 if self.sendupdate_command is None:
00101 self.sendupdate_command = sr_robot_msgs.msg.sendupdate()
00102 if self.contrlr_command is None:
00103 self.contrlr_command = sr_robot_msgs.msg.contrlr()
00104 else:
00105 self.command_type = 0
00106 self.sendupdate_command = sr_robot_msgs.msg.sendupdate()
00107 self.contrlr_command = sr_robot_msgs.msg.contrlr()
00108
00109 def _get_types(self):
00110 """
00111 internal API method
00112 """
00113 return self._slot_types
00114
00115 def serialize(self, buff):
00116 """
00117 serialize message into buffer
00118 @param buff: buffer
00119 @type buff: StringIO
00120 """
00121 try:
00122 _x = self
00123 buff.write(_struct_2b.pack(_x.command_type, _x.sendupdate_command.sendupdate_length))
00124 length = len(self.sendupdate_command.sendupdate_list)
00125 buff.write(_struct_I.pack(length))
00126 for val1 in self.sendupdate_command.sendupdate_list:
00127 _x = val1.joint_name
00128 length = len(_x)
00129 buff.write(struct.pack('<I%ss'%length, length, _x))
00130 _x = val1
00131 buff.write(_struct_5f.pack(_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current))
00132 _x = val1.error_flag
00133 length = len(_x)
00134 buff.write(struct.pack('<I%ss'%length, length, _x))
00135 _x = self.contrlr_command.contrlr_name
00136 length = len(_x)
00137 buff.write(struct.pack('<I%ss'%length, length, _x))
00138 length = len(self.contrlr_command.list_of_parameters)
00139 buff.write(_struct_I.pack(length))
00140 for val1 in self.contrlr_command.list_of_parameters:
00141 length = len(val1)
00142 buff.write(struct.pack('<I%ss'%length, length, val1))
00143 buff.write(_struct_B.pack(self.contrlr_command.length_of_list))
00144 except struct.error, se: self._check_types(se)
00145 except TypeError, te: self._check_types(te)
00146
00147 def deserialize(self, str):
00148 """
00149 unpack serialized message in str into this message instance
00150 @param str: byte array of serialized message
00151 @type str: str
00152 """
00153 try:
00154 if self.sendupdate_command is None:
00155 self.sendupdate_command = sr_robot_msgs.msg.sendupdate()
00156 if self.contrlr_command is None:
00157 self.contrlr_command = sr_robot_msgs.msg.contrlr()
00158 end = 0
00159 _x = self
00160 start = end
00161 end += 2
00162 (_x.command_type, _x.sendupdate_command.sendupdate_length,) = _struct_2b.unpack(str[start:end])
00163 start = end
00164 end += 4
00165 (length,) = _struct_I.unpack(str[start:end])
00166 self.sendupdate_command.sendupdate_list = []
00167 for i in xrange(0, length):
00168 val1 = sr_robot_msgs.msg.joint()
00169 start = end
00170 end += 4
00171 (length,) = _struct_I.unpack(str[start:end])
00172 start = end
00173 end += length
00174 val1.joint_name = str[start:end]
00175 _x = val1
00176 start = end
00177 end += 20
00178 (_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current,) = _struct_5f.unpack(str[start:end])
00179 start = end
00180 end += 4
00181 (length,) = _struct_I.unpack(str[start:end])
00182 start = end
00183 end += length
00184 val1.error_flag = str[start:end]
00185 self.sendupdate_command.sendupdate_list.append(val1)
00186 start = end
00187 end += 4
00188 (length,) = _struct_I.unpack(str[start:end])
00189 start = end
00190 end += length
00191 self.contrlr_command.contrlr_name = str[start:end]
00192 start = end
00193 end += 4
00194 (length,) = _struct_I.unpack(str[start:end])
00195 self.contrlr_command.list_of_parameters = []
00196 for i in xrange(0, length):
00197 start = end
00198 end += 4
00199 (length,) = _struct_I.unpack(str[start:end])
00200 start = end
00201 end += length
00202 val1 = str[start:end]
00203 self.contrlr_command.list_of_parameters.append(val1)
00204 start = end
00205 end += 1
00206 (self.contrlr_command.length_of_list,) = _struct_B.unpack(str[start:end])
00207 return self
00208 except struct.error, e:
00209 raise roslib.message.DeserializationError(e)
00210
00211
00212 def serialize_numpy(self, buff, numpy):
00213 """
00214 serialize message with numpy array types into buffer
00215 @param buff: buffer
00216 @type buff: StringIO
00217 @param numpy: numpy python module
00218 @type numpy module
00219 """
00220 try:
00221 _x = self
00222 buff.write(_struct_2b.pack(_x.command_type, _x.sendupdate_command.sendupdate_length))
00223 length = len(self.sendupdate_command.sendupdate_list)
00224 buff.write(_struct_I.pack(length))
00225 for val1 in self.sendupdate_command.sendupdate_list:
00226 _x = val1.joint_name
00227 length = len(_x)
00228 buff.write(struct.pack('<I%ss'%length, length, _x))
00229 _x = val1
00230 buff.write(_struct_5f.pack(_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current))
00231 _x = val1.error_flag
00232 length = len(_x)
00233 buff.write(struct.pack('<I%ss'%length, length, _x))
00234 _x = self.contrlr_command.contrlr_name
00235 length = len(_x)
00236 buff.write(struct.pack('<I%ss'%length, length, _x))
00237 length = len(self.contrlr_command.list_of_parameters)
00238 buff.write(_struct_I.pack(length))
00239 for val1 in self.contrlr_command.list_of_parameters:
00240 length = len(val1)
00241 buff.write(struct.pack('<I%ss'%length, length, val1))
00242 buff.write(_struct_B.pack(self.contrlr_command.length_of_list))
00243 except struct.error, se: self._check_types(se)
00244 except TypeError, te: self._check_types(te)
00245
00246 def deserialize_numpy(self, str, numpy):
00247 """
00248 unpack serialized message in str into this message instance using numpy for array types
00249 @param str: byte array of serialized message
00250 @type str: str
00251 @param numpy: numpy python module
00252 @type numpy: module
00253 """
00254 try:
00255 if self.sendupdate_command is None:
00256 self.sendupdate_command = sr_robot_msgs.msg.sendupdate()
00257 if self.contrlr_command is None:
00258 self.contrlr_command = sr_robot_msgs.msg.contrlr()
00259 end = 0
00260 _x = self
00261 start = end
00262 end += 2
00263 (_x.command_type, _x.sendupdate_command.sendupdate_length,) = _struct_2b.unpack(str[start:end])
00264 start = end
00265 end += 4
00266 (length,) = _struct_I.unpack(str[start:end])
00267 self.sendupdate_command.sendupdate_list = []
00268 for i in xrange(0, length):
00269 val1 = sr_robot_msgs.msg.joint()
00270 start = end
00271 end += 4
00272 (length,) = _struct_I.unpack(str[start:end])
00273 start = end
00274 end += length
00275 val1.joint_name = str[start:end]
00276 _x = val1
00277 start = end
00278 end += 20
00279 (_x.joint_position, _x.joint_target, _x.joint_torque, _x.joint_temperature, _x.joint_current,) = _struct_5f.unpack(str[start:end])
00280 start = end
00281 end += 4
00282 (length,) = _struct_I.unpack(str[start:end])
00283 start = end
00284 end += length
00285 val1.error_flag = str[start:end]
00286 self.sendupdate_command.sendupdate_list.append(val1)
00287 start = end
00288 end += 4
00289 (length,) = _struct_I.unpack(str[start:end])
00290 start = end
00291 end += length
00292 self.contrlr_command.contrlr_name = str[start:end]
00293 start = end
00294 end += 4
00295 (length,) = _struct_I.unpack(str[start:end])
00296 self.contrlr_command.list_of_parameters = []
00297 for i in xrange(0, length):
00298 start = end
00299 end += 4
00300 (length,) = _struct_I.unpack(str[start:end])
00301 start = end
00302 end += length
00303 val1 = str[start:end]
00304 self.contrlr_command.list_of_parameters.append(val1)
00305 start = end
00306 end += 1
00307 (self.contrlr_command.length_of_list,) = _struct_B.unpack(str[start:end])
00308 return self
00309 except struct.error, e:
00310 raise roslib.message.DeserializationError(e)
00311
00312 _struct_I = roslib.message.struct_I
00313 _struct_B = struct.Struct("<B")
00314 _struct_5f = struct.Struct("<5f")
00315 _struct_2b = struct.Struct("<2b")