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