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