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