$search
00001 """autogenerated by genmsg_py from Bumper.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class Bumper(roslib.message.Message): 00008 _md5sum = "7feed261fab09e5d0ce6318f9f9ed4b9" 00009 _type = "reem_msgs/Bumper" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """#ROS header 00012 Header header 00013 00014 #Whether the bumper is being pressed 00015 bool is_pressed 00016 00017 ================================================================================ 00018 MSG: std_msgs/Header 00019 # Standard metadata for higher-level stamped data types. 00020 # This is generally used to communicate timestamped data 00021 # in a particular coordinate frame. 00022 # 00023 # sequence ID: consecutively increasing ID 00024 uint32 seq 00025 #Two-integer timestamp that is expressed as: 00026 # * stamp.secs: seconds (stamp_secs) since epoch 00027 # * stamp.nsecs: nanoseconds since stamp_secs 00028 # time-handling sugar is provided by the client library 00029 time stamp 00030 #Frame this data is associated with 00031 # 0: no frame 00032 # 1: global frame 00033 string frame_id 00034 00035 """ 00036 __slots__ = ['header','is_pressed'] 00037 _slot_types = ['Header','bool'] 00038 00039 def __init__(self, *args, **kwds): 00040 """ 00041 Constructor. Any message fields that are implicitly/explicitly 00042 set to None will be assigned a default value. The recommend 00043 use is keyword arguments as this is more robust to future message 00044 changes. You cannot mix in-order arguments and keyword arguments. 00045 00046 The available fields are: 00047 header,is_pressed 00048 00049 @param args: complete set of field values, in .msg order 00050 @param kwds: use keyword arguments corresponding to message field names 00051 to set specific fields. 00052 """ 00053 if args or kwds: 00054 super(Bumper, self).__init__(*args, **kwds) 00055 #message fields cannot be None, assign default values for those that are 00056 if self.header is None: 00057 self.header = std_msgs.msg._Header.Header() 00058 if self.is_pressed is None: 00059 self.is_pressed = False 00060 else: 00061 self.header = std_msgs.msg._Header.Header() 00062 self.is_pressed = False 00063 00064 def _get_types(self): 00065 """ 00066 internal API method 00067 """ 00068 return self._slot_types 00069 00070 def serialize(self, buff): 00071 """ 00072 serialize message into buffer 00073 @param buff: buffer 00074 @type buff: StringIO 00075 """ 00076 try: 00077 _x = self 00078 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00079 _x = self.header.frame_id 00080 length = len(_x) 00081 buff.write(struct.pack('<I%ss'%length, length, _x)) 00082 buff.write(_struct_B.pack(self.is_pressed)) 00083 except struct.error as se: self._check_types(se) 00084 except TypeError as te: self._check_types(te) 00085 00086 def deserialize(self, str): 00087 """ 00088 unpack serialized message in str into this message instance 00089 @param str: byte array of serialized message 00090 @type str: str 00091 """ 00092 try: 00093 if self.header is None: 00094 self.header = std_msgs.msg._Header.Header() 00095 end = 0 00096 _x = self 00097 start = end 00098 end += 12 00099 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00100 start = end 00101 end += 4 00102 (length,) = _struct_I.unpack(str[start:end]) 00103 start = end 00104 end += length 00105 self.header.frame_id = str[start:end] 00106 start = end 00107 end += 1 00108 (self.is_pressed,) = _struct_B.unpack(str[start:end]) 00109 self.is_pressed = bool(self.is_pressed) 00110 return self 00111 except struct.error as e: 00112 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00113 00114 00115 def serialize_numpy(self, buff, numpy): 00116 """ 00117 serialize message with numpy array types into buffer 00118 @param buff: buffer 00119 @type buff: StringIO 00120 @param numpy: numpy python module 00121 @type numpy module 00122 """ 00123 try: 00124 _x = self 00125 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00126 _x = self.header.frame_id 00127 length = len(_x) 00128 buff.write(struct.pack('<I%ss'%length, length, _x)) 00129 buff.write(_struct_B.pack(self.is_pressed)) 00130 except struct.error as se: self._check_types(se) 00131 except TypeError as te: self._check_types(te) 00132 00133 def deserialize_numpy(self, str, numpy): 00134 """ 00135 unpack serialized message in str into this message instance using numpy for array types 00136 @param str: byte array of serialized message 00137 @type str: str 00138 @param numpy: numpy python module 00139 @type numpy: module 00140 """ 00141 try: 00142 if self.header is None: 00143 self.header = std_msgs.msg._Header.Header() 00144 end = 0 00145 _x = self 00146 start = end 00147 end += 12 00148 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00149 start = end 00150 end += 4 00151 (length,) = _struct_I.unpack(str[start:end]) 00152 start = end 00153 end += length 00154 self.header.frame_id = str[start:end] 00155 start = end 00156 end += 1 00157 (self.is_pressed,) = _struct_B.unpack(str[start:end]) 00158 self.is_pressed = bool(self.is_pressed) 00159 return self 00160 except struct.error as e: 00161 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00162 00163 _struct_I = roslib.message.struct_I 00164 _struct_3I = struct.Struct("<3I") 00165 _struct_B = struct.Struct("<B")