00001 """autogenerated by genmsg_py from JointState.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006
00007 class JointState(roslib.message.Message):
00008 _md5sum = "2b8449320cde76616338e2539db27c32"
00009 _type = "dynamixel_msgs/JointState"
00010 _has_header = True
00011 _full_text = """Header header
00012 string name # joint name
00013 int32[] motor_ids # motor ids controlling this joint
00014 int32[] motor_temps # motor temperatures, same order as motor_ids
00015
00016 float64 goal_pos # commanded position (in radians)
00017 float64 current_pos # current joint position (in radians)
00018 float64 error # error between commanded and current positions (in radians)
00019 float64 velocity # current joint speed (in radians per second)
00020 float64 load # current load
00021 bool is_moving # is joint currently in motion
00022
00023
00024 ================================================================================
00025 MSG: std_msgs/Header
00026 # Standard metadata for higher-level stamped data types.
00027 # This is generally used to communicate timestamped data
00028 # in a particular coordinate frame.
00029 #
00030 # sequence ID: consecutively increasing ID
00031 uint32 seq
00032 #Two-integer timestamp that is expressed as:
00033 # * stamp.secs: seconds (stamp_secs) since epoch
00034 # * stamp.nsecs: nanoseconds since stamp_secs
00035 # time-handling sugar is provided by the client library
00036 time stamp
00037 #Frame this data is associated with
00038 # 0: no frame
00039 # 1: global frame
00040 string frame_id
00041
00042 """
00043 __slots__ = ['header','name','motor_ids','motor_temps','goal_pos','current_pos','error','velocity','load','is_moving']
00044 _slot_types = ['Header','string','int32[]','int32[]','float64','float64','float64','float64','float64','bool']
00045
00046 def __init__(self, *args, **kwds):
00047 """
00048 Constructor. Any message fields that are implicitly/explicitly
00049 set to None will be assigned a default value. The recommend
00050 use is keyword arguments as this is more robust to future message
00051 changes. You cannot mix in-order arguments and keyword arguments.
00052
00053 The available fields are:
00054 header,name,motor_ids,motor_temps,goal_pos,current_pos,error,velocity,load,is_moving
00055
00056 @param args: complete set of field values, in .msg order
00057 @param kwds: use keyword arguments corresponding to message field names
00058 to set specific fields.
00059 """
00060 if args or kwds:
00061 super(JointState, self).__init__(*args, **kwds)
00062
00063 if self.header is None:
00064 self.header = std_msgs.msg._Header.Header()
00065 if self.name is None:
00066 self.name = ''
00067 if self.motor_ids is None:
00068 self.motor_ids = []
00069 if self.motor_temps is None:
00070 self.motor_temps = []
00071 if self.goal_pos is None:
00072 self.goal_pos = 0.
00073 if self.current_pos is None:
00074 self.current_pos = 0.
00075 if self.error is None:
00076 self.error = 0.
00077 if self.velocity is None:
00078 self.velocity = 0.
00079 if self.load is None:
00080 self.load = 0.
00081 if self.is_moving is None:
00082 self.is_moving = False
00083 else:
00084 self.header = std_msgs.msg._Header.Header()
00085 self.name = ''
00086 self.motor_ids = []
00087 self.motor_temps = []
00088 self.goal_pos = 0.
00089 self.current_pos = 0.
00090 self.error = 0.
00091 self.velocity = 0.
00092 self.load = 0.
00093 self.is_moving = False
00094
00095 def _get_types(self):
00096 """
00097 internal API method
00098 """
00099 return self._slot_types
00100
00101 def serialize(self, buff):
00102 """
00103 serialize message into buffer
00104 @param buff: buffer
00105 @type buff: StringIO
00106 """
00107 try:
00108 _x = self
00109 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00110 _x = self.header.frame_id
00111 length = len(_x)
00112 buff.write(struct.pack('<I%ss'%length, length, _x))
00113 _x = self.name
00114 length = len(_x)
00115 buff.write(struct.pack('<I%ss'%length, length, _x))
00116 length = len(self.motor_ids)
00117 buff.write(_struct_I.pack(length))
00118 pattern = '<%si'%length
00119 buff.write(struct.pack(pattern, *self.motor_ids))
00120 length = len(self.motor_temps)
00121 buff.write(_struct_I.pack(length))
00122 pattern = '<%si'%length
00123 buff.write(struct.pack(pattern, *self.motor_temps))
00124 _x = self
00125 buff.write(_struct_5dB.pack(_x.goal_pos, _x.current_pos, _x.error, _x.velocity, _x.load, _x.is_moving))
00126 except struct.error, se: self._check_types(se)
00127 except TypeError, te: self._check_types(te)
00128
00129 def deserialize(self, str):
00130 """
00131 unpack serialized message in str into this message instance
00132 @param str: byte array of serialized message
00133 @type str: str
00134 """
00135 try:
00136 if self.header is None:
00137 self.header = std_msgs.msg._Header.Header()
00138 end = 0
00139 _x = self
00140 start = end
00141 end += 12
00142 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00143 start = end
00144 end += 4
00145 (length,) = _struct_I.unpack(str[start:end])
00146 start = end
00147 end += length
00148 self.header.frame_id = 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.name = str[start:end]
00155 start = end
00156 end += 4
00157 (length,) = _struct_I.unpack(str[start:end])
00158 pattern = '<%si'%length
00159 start = end
00160 end += struct.calcsize(pattern)
00161 self.motor_ids = struct.unpack(pattern, str[start:end])
00162 start = end
00163 end += 4
00164 (length,) = _struct_I.unpack(str[start:end])
00165 pattern = '<%si'%length
00166 start = end
00167 end += struct.calcsize(pattern)
00168 self.motor_temps = struct.unpack(pattern, str[start:end])
00169 _x = self
00170 start = end
00171 end += 41
00172 (_x.goal_pos, _x.current_pos, _x.error, _x.velocity, _x.load, _x.is_moving,) = _struct_5dB.unpack(str[start:end])
00173 self.is_moving = bool(self.is_moving)
00174 return self
00175 except struct.error, e:
00176 raise roslib.message.DeserializationError(e)
00177
00178
00179 def serialize_numpy(self, buff, numpy):
00180 """
00181 serialize message with numpy array types into buffer
00182 @param buff: buffer
00183 @type buff: StringIO
00184 @param numpy: numpy python module
00185 @type numpy module
00186 """
00187 try:
00188 _x = self
00189 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00190 _x = self.header.frame_id
00191 length = len(_x)
00192 buff.write(struct.pack('<I%ss'%length, length, _x))
00193 _x = self.name
00194 length = len(_x)
00195 buff.write(struct.pack('<I%ss'%length, length, _x))
00196 length = len(self.motor_ids)
00197 buff.write(_struct_I.pack(length))
00198 pattern = '<%si'%length
00199 buff.write(self.motor_ids.tostring())
00200 length = len(self.motor_temps)
00201 buff.write(_struct_I.pack(length))
00202 pattern = '<%si'%length
00203 buff.write(self.motor_temps.tostring())
00204 _x = self
00205 buff.write(_struct_5dB.pack(_x.goal_pos, _x.current_pos, _x.error, _x.velocity, _x.load, _x.is_moving))
00206 except struct.error, se: self._check_types(se)
00207 except TypeError, te: self._check_types(te)
00208
00209 def deserialize_numpy(self, str, numpy):
00210 """
00211 unpack serialized message in str into this message instance using numpy for array types
00212 @param str: byte array of serialized message
00213 @type str: str
00214 @param numpy: numpy python module
00215 @type numpy: module
00216 """
00217 try:
00218 if self.header is None:
00219 self.header = std_msgs.msg._Header.Header()
00220 end = 0
00221 _x = self
00222 start = end
00223 end += 12
00224 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00225 start = end
00226 end += 4
00227 (length,) = _struct_I.unpack(str[start:end])
00228 start = end
00229 end += length
00230 self.header.frame_id = str[start:end]
00231 start = end
00232 end += 4
00233 (length,) = _struct_I.unpack(str[start:end])
00234 start = end
00235 end += length
00236 self.name = str[start:end]
00237 start = end
00238 end += 4
00239 (length,) = _struct_I.unpack(str[start:end])
00240 pattern = '<%si'%length
00241 start = end
00242 end += struct.calcsize(pattern)
00243 self.motor_ids = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00244 start = end
00245 end += 4
00246 (length,) = _struct_I.unpack(str[start:end])
00247 pattern = '<%si'%length
00248 start = end
00249 end += struct.calcsize(pattern)
00250 self.motor_temps = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00251 _x = self
00252 start = end
00253 end += 41
00254 (_x.goal_pos, _x.current_pos, _x.error, _x.velocity, _x.load, _x.is_moving,) = _struct_5dB.unpack(str[start:end])
00255 self.is_moving = bool(self.is_moving)
00256 return self
00257 except struct.error, e:
00258 raise roslib.message.DeserializationError(e)
00259
00260 _struct_I = roslib.message.struct_I
00261 _struct_5dB = struct.Struct("<5dB")
00262 _struct_3I = struct.Struct("<3I")