00001 """autogenerated by genmsg_py from JoyFeedback.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class JoyFeedback(roslib.message.Message):
00007 _md5sum = "f4dcd73460360d98f36e55ee7f2e46f1"
00008 _type = "sensor_msgs/JoyFeedback"
00009 _has_header = False
00010 _full_text = """# Declare of the type of feedback
00011 uint8 TYPE_LED = 0
00012 uint8 TYPE_RUMBLE = 1
00013 uint8 TYPE_BUZZER = 2
00014
00015 uint8 type
00016
00017 # This will hold an id number for each type of each feedback.
00018 # Example, the first led would be id=0, the second would be id=1
00019 uint8 id
00020
00021 # Intensity of the feedback, from 0.0 to 1.0, inclusive. If device is
00022 # actually binary, driver should treat 0<=x<0.5 as off, 0.5<=x<=1 as on.
00023 float32 intensity
00024
00025
00026 """
00027
00028 TYPE_LED = 0
00029 TYPE_RUMBLE = 1
00030 TYPE_BUZZER = 2
00031
00032 __slots__ = ['type','id','intensity']
00033 _slot_types = ['uint8','uint8','float32']
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 type,id,intensity
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(JoyFeedback, self).__init__(*args, **kwds)
00051
00052 if self.type is None:
00053 self.type = 0
00054 if self.id is None:
00055 self.id = 0
00056 if self.intensity is None:
00057 self.intensity = 0.
00058 else:
00059 self.type = 0
00060 self.id = 0
00061 self.intensity = 0.
00062
00063 def _get_types(self):
00064 """
00065 internal API method
00066 """
00067 return self._slot_types
00068
00069 def serialize(self, buff):
00070 """
00071 serialize message into buffer
00072 @param buff: buffer
00073 @type buff: StringIO
00074 """
00075 try:
00076 _x = self
00077 buff.write(_struct_2Bf.pack(_x.type, _x.id, _x.intensity))
00078 except struct.error as se: self._check_types(se)
00079 except TypeError as te: self._check_types(te)
00080
00081 def deserialize(self, str):
00082 """
00083 unpack serialized message in str into this message instance
00084 @param str: byte array of serialized message
00085 @type str: str
00086 """
00087 try:
00088 end = 0
00089 _x = self
00090 start = end
00091 end += 6
00092 (_x.type, _x.id, _x.intensity,) = _struct_2Bf.unpack(str[start:end])
00093 return self
00094 except struct.error as e:
00095 raise roslib.message.DeserializationError(e)
00096
00097
00098 def serialize_numpy(self, buff, numpy):
00099 """
00100 serialize message with numpy array types into buffer
00101 @param buff: buffer
00102 @type buff: StringIO
00103 @param numpy: numpy python module
00104 @type numpy module
00105 """
00106 try:
00107 _x = self
00108 buff.write(_struct_2Bf.pack(_x.type, _x.id, _x.intensity))
00109 except struct.error as se: self._check_types(se)
00110 except TypeError as te: self._check_types(te)
00111
00112 def deserialize_numpy(self, str, numpy):
00113 """
00114 unpack serialized message in str into this message instance using numpy for array types
00115 @param str: byte array of serialized message
00116 @type str: str
00117 @param numpy: numpy python module
00118 @type numpy: module
00119 """
00120 try:
00121 end = 0
00122 _x = self
00123 start = end
00124 end += 6
00125 (_x.type, _x.id, _x.intensity,) = _struct_2Bf.unpack(str[start:end])
00126 return self
00127 except struct.error as e:
00128 raise roslib.message.DeserializationError(e)
00129
00130 _struct_I = roslib.message.struct_I
00131 _struct_2Bf = struct.Struct("<2Bf")