$search
00001 """autogenerated by genmsg_py from JoySwitch.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class JoySwitch(roslib.message.Message): 00007 _md5sum = "0b9e4d12a122fa671dc7b4bd8741705d" 00008 _type = "clearpath_base/JoySwitch" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """string robot_id 00011 uint8 attach 00012 string joystick 00013 00014 """ 00015 __slots__ = ['robot_id','attach','joystick'] 00016 _slot_types = ['string','uint8','string'] 00017 00018 def __init__(self, *args, **kwds): 00019 """ 00020 Constructor. Any message fields that are implicitly/explicitly 00021 set to None will be assigned a default value. The recommend 00022 use is keyword arguments as this is more robust to future message 00023 changes. You cannot mix in-order arguments and keyword arguments. 00024 00025 The available fields are: 00026 robot_id,attach,joystick 00027 00028 @param args: complete set of field values, in .msg order 00029 @param kwds: use keyword arguments corresponding to message field names 00030 to set specific fields. 00031 """ 00032 if args or kwds: 00033 super(JoySwitch, self).__init__(*args, **kwds) 00034 #message fields cannot be None, assign default values for those that are 00035 if self.robot_id is None: 00036 self.robot_id = '' 00037 if self.attach is None: 00038 self.attach = 0 00039 if self.joystick is None: 00040 self.joystick = '' 00041 else: 00042 self.robot_id = '' 00043 self.attach = 0 00044 self.joystick = '' 00045 00046 def _get_types(self): 00047 """ 00048 internal API method 00049 """ 00050 return self._slot_types 00051 00052 def serialize(self, buff): 00053 """ 00054 serialize message into buffer 00055 @param buff: buffer 00056 @type buff: StringIO 00057 """ 00058 try: 00059 _x = self.robot_id 00060 length = len(_x) 00061 buff.write(struct.pack('<I%ss'%length, length, _x)) 00062 buff.write(_struct_B.pack(self.attach)) 00063 _x = self.joystick 00064 length = len(_x) 00065 buff.write(struct.pack('<I%ss'%length, length, _x)) 00066 except struct.error as se: self._check_types(se) 00067 except TypeError as te: self._check_types(te) 00068 00069 def deserialize(self, str): 00070 """ 00071 unpack serialized message in str into this message instance 00072 @param str: byte array of serialized message 00073 @type str: str 00074 """ 00075 try: 00076 end = 0 00077 start = end 00078 end += 4 00079 (length,) = _struct_I.unpack(str[start:end]) 00080 start = end 00081 end += length 00082 self.robot_id = str[start:end] 00083 start = end 00084 end += 1 00085 (self.attach,) = _struct_B.unpack(str[start:end]) 00086 start = end 00087 end += 4 00088 (length,) = _struct_I.unpack(str[start:end]) 00089 start = end 00090 end += length 00091 self.joystick = str[start:end] 00092 return self 00093 except struct.error as e: 00094 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00095 00096 00097 def serialize_numpy(self, buff, numpy): 00098 """ 00099 serialize message with numpy array types into buffer 00100 @param buff: buffer 00101 @type buff: StringIO 00102 @param numpy: numpy python module 00103 @type numpy module 00104 """ 00105 try: 00106 _x = self.robot_id 00107 length = len(_x) 00108 buff.write(struct.pack('<I%ss'%length, length, _x)) 00109 buff.write(_struct_B.pack(self.attach)) 00110 _x = self.joystick 00111 length = len(_x) 00112 buff.write(struct.pack('<I%ss'%length, length, _x)) 00113 except struct.error as se: self._check_types(se) 00114 except TypeError as te: self._check_types(te) 00115 00116 def deserialize_numpy(self, str, numpy): 00117 """ 00118 unpack serialized message in str into this message instance using numpy for array types 00119 @param str: byte array of serialized message 00120 @type str: str 00121 @param numpy: numpy python module 00122 @type numpy: module 00123 """ 00124 try: 00125 end = 0 00126 start = end 00127 end += 4 00128 (length,) = _struct_I.unpack(str[start:end]) 00129 start = end 00130 end += length 00131 self.robot_id = str[start:end] 00132 start = end 00133 end += 1 00134 (self.attach,) = _struct_B.unpack(str[start:end]) 00135 start = end 00136 end += 4 00137 (length,) = _struct_I.unpack(str[start:end]) 00138 start = end 00139 end += length 00140 self.joystick = str[start:end] 00141 return self 00142 except struct.error as e: 00143 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00144 00145 _struct_I = roslib.message.struct_I 00146 _struct_B = struct.Struct("<B")