$search
00001 """autogenerated by genmsg_py from FromMotorDataType.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class FromMotorDataType(roslib.message.Message): 00007 _md5sum = "8524586e34fbd7cb1c08c5f5f1ca0e57" 00008 _type = "sr_robot_msgs/FromMotorDataType" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """int16 data 00011 """ 00012 __slots__ = ['data'] 00013 _slot_types = ['int16'] 00014 00015 def __init__(self, *args, **kwds): 00016 """ 00017 Constructor. Any message fields that are implicitly/explicitly 00018 set to None will be assigned a default value. The recommend 00019 use is keyword arguments as this is more robust to future message 00020 changes. You cannot mix in-order arguments and keyword arguments. 00021 00022 The available fields are: 00023 data 00024 00025 @param args: complete set of field values, in .msg order 00026 @param kwds: use keyword arguments corresponding to message field names 00027 to set specific fields. 00028 """ 00029 if args or kwds: 00030 super(FromMotorDataType, self).__init__(*args, **kwds) 00031 #message fields cannot be None, assign default values for those that are 00032 if self.data is None: 00033 self.data = 0 00034 else: 00035 self.data = 0 00036 00037 def _get_types(self): 00038 """ 00039 internal API method 00040 """ 00041 return self._slot_types 00042 00043 def serialize(self, buff): 00044 """ 00045 serialize message into buffer 00046 @param buff: buffer 00047 @type buff: StringIO 00048 """ 00049 try: 00050 buff.write(_struct_h.pack(self.data)) 00051 except struct.error as se: self._check_types(se) 00052 except TypeError as te: self._check_types(te) 00053 00054 def deserialize(self, str): 00055 """ 00056 unpack serialized message in str into this message instance 00057 @param str: byte array of serialized message 00058 @type str: str 00059 """ 00060 try: 00061 end = 0 00062 start = end 00063 end += 2 00064 (self.data,) = _struct_h.unpack(str[start:end]) 00065 return self 00066 except struct.error as e: 00067 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00068 00069 00070 def serialize_numpy(self, buff, numpy): 00071 """ 00072 serialize message with numpy array types into buffer 00073 @param buff: buffer 00074 @type buff: StringIO 00075 @param numpy: numpy python module 00076 @type numpy module 00077 """ 00078 try: 00079 buff.write(_struct_h.pack(self.data)) 00080 except struct.error as se: self._check_types(se) 00081 except TypeError as te: self._check_types(te) 00082 00083 def deserialize_numpy(self, str, numpy): 00084 """ 00085 unpack serialized message in str into this message instance using numpy for array types 00086 @param str: byte array of serialized message 00087 @type str: str 00088 @param numpy: numpy python module 00089 @type numpy: module 00090 """ 00091 try: 00092 end = 0 00093 start = end 00094 end += 2 00095 (self.data,) = _struct_h.unpack(str[start:end]) 00096 return self 00097 except struct.error as e: 00098 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00099 00100 _struct_I = roslib.message.struct_I 00101 _struct_h = struct.Struct("<h")