_GetChompCollisionCost.py
Go to the documentation of this file.
00001 """autogenerated by genpy from chomp_motion_planner/GetChompCollisionCostRequest.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 arm_navigation_msgs.msg
00008 import geometry_msgs.msg
00009 import std_msgs.msg
00010 import genpy
00011 import sensor_msgs.msg
00012 
00013 class GetChompCollisionCostRequest(genpy.Message):
00014   _md5sum = "acabb6bac55143035edcf10159a5b130"
00015   _type = "chomp_motion_planner/GetChompCollisionCostRequest"
00016   _has_header = False #flag to mark the presence of a Header object
00017   _full_text = """
00018 string[] links
00019 
00020 
00021 
00022 arm_navigation_msgs/RobotState state
00023 
00024 
00025 ================================================================================
00026 MSG: arm_navigation_msgs/RobotState
00027 # This message contains information about the robot state, i.e. the positions of its joints and links
00028 sensor_msgs/JointState joint_state
00029 arm_navigation_msgs/MultiDOFJointState multi_dof_joint_state
00030 
00031 ================================================================================
00032 MSG: sensor_msgs/JointState
00033 # This is a message that holds data to describe the state of a set of torque controlled joints. 
00034 #
00035 # The state of each joint (revolute or prismatic) is defined by:
00036 #  * the position of the joint (rad or m),
00037 #  * the velocity of the joint (rad/s or m/s) and 
00038 #  * the effort that is applied in the joint (Nm or N).
00039 #
00040 # Each joint is uniquely identified by its name
00041 # The header specifies the time at which the joint states were recorded. All the joint states
00042 # in one message have to be recorded at the same time.
00043 #
00044 # This message consists of a multiple arrays, one for each part of the joint state. 
00045 # The goal is to make each of the fields optional. When e.g. your joints have no
00046 # effort associated with them, you can leave the effort array empty. 
00047 #
00048 # All arrays in this message should have the same size, or be empty.
00049 # This is the only way to uniquely associate the joint name with the correct
00050 # states.
00051 
00052 
00053 Header header
00054 
00055 string[] name
00056 float64[] position
00057 float64[] velocity
00058 float64[] effort
00059 
00060 ================================================================================
00061 MSG: std_msgs/Header
00062 # Standard metadata for higher-level stamped data types.
00063 # This is generally used to communicate timestamped data 
00064 # in a particular coordinate frame.
00065 # 
00066 # sequence ID: consecutively increasing ID 
00067 uint32 seq
00068 #Two-integer timestamp that is expressed as:
00069 # * stamp.secs: seconds (stamp_secs) since epoch
00070 # * stamp.nsecs: nanoseconds since stamp_secs
00071 # time-handling sugar is provided by the client library
00072 time stamp
00073 #Frame this data is associated with
00074 # 0: no frame
00075 # 1: global frame
00076 string frame_id
00077 
00078 ================================================================================
00079 MSG: arm_navigation_msgs/MultiDOFJointState
00080 #A representation of a multi-dof joint state
00081 time stamp
00082 string[] joint_names
00083 string[] frame_ids
00084 string[] child_frame_ids
00085 geometry_msgs/Pose[] poses
00086 
00087 ================================================================================
00088 MSG: geometry_msgs/Pose
00089 # A representation of pose in free space, composed of postion and orientation. 
00090 Point position
00091 Quaternion orientation
00092 
00093 ================================================================================
00094 MSG: geometry_msgs/Point
00095 # This contains the position of a point in free space
00096 float64 x
00097 float64 y
00098 float64 z
00099 
00100 ================================================================================
00101 MSG: geometry_msgs/Quaternion
00102 # This represents an orientation in free space in quaternion form.
00103 
00104 float64 x
00105 float64 y
00106 float64 z
00107 float64 w
00108 
00109 """
00110   __slots__ = ['links','state']
00111   _slot_types = ['string[]','arm_navigation_msgs/RobotState']
00112 
00113   def __init__(self, *args, **kwds):
00114     """
00115     Constructor. Any message fields that are implicitly/explicitly
00116     set to None will be assigned a default value. The recommend
00117     use is keyword arguments as this is more robust to future message
00118     changes.  You cannot mix in-order arguments and keyword arguments.
00119 
00120     The available fields are:
00121        links,state
00122 
00123     :param args: complete set of field values, in .msg order
00124     :param kwds: use keyword arguments corresponding to message field names
00125     to set specific fields.
00126     """
00127     if args or kwds:
00128       super(GetChompCollisionCostRequest, self).__init__(*args, **kwds)
00129       #message fields cannot be None, assign default values for those that are
00130       if self.links is None:
00131         self.links = []
00132       if self.state is None:
00133         self.state = arm_navigation_msgs.msg.RobotState()
00134     else:
00135       self.links = []
00136       self.state = arm_navigation_msgs.msg.RobotState()
00137 
00138   def _get_types(self):
00139     """
00140     internal API method
00141     """
00142     return self._slot_types
00143 
00144   def serialize(self, buff):
00145     """
00146     serialize message into buffer
00147     :param buff: buffer, ``StringIO``
00148     """
00149     try:
00150       length = len(self.links)
00151       buff.write(_struct_I.pack(length))
00152       for val1 in self.links:
00153         length = len(val1)
00154         if python3 or type(val1) == unicode:
00155           val1 = val1.encode('utf-8')
00156           length = len(val1)
00157         buff.write(struct.pack('<I%ss'%length, length, val1))
00158       _x = self
00159       buff.write(_struct_3I.pack(_x.state.joint_state.header.seq, _x.state.joint_state.header.stamp.secs, _x.state.joint_state.header.stamp.nsecs))
00160       _x = self.state.joint_state.header.frame_id
00161       length = len(_x)
00162       if python3 or type(_x) == unicode:
00163         _x = _x.encode('utf-8')
00164         length = len(_x)
00165       buff.write(struct.pack('<I%ss'%length, length, _x))
00166       length = len(self.state.joint_state.name)
00167       buff.write(_struct_I.pack(length))
00168       for val1 in self.state.joint_state.name:
00169         length = len(val1)
00170         if python3 or type(val1) == unicode:
00171           val1 = val1.encode('utf-8')
00172           length = len(val1)
00173         buff.write(struct.pack('<I%ss'%length, length, val1))
00174       length = len(self.state.joint_state.position)
00175       buff.write(_struct_I.pack(length))
00176       pattern = '<%sd'%length
00177       buff.write(struct.pack(pattern, *self.state.joint_state.position))
00178       length = len(self.state.joint_state.velocity)
00179       buff.write(_struct_I.pack(length))
00180       pattern = '<%sd'%length
00181       buff.write(struct.pack(pattern, *self.state.joint_state.velocity))
00182       length = len(self.state.joint_state.effort)
00183       buff.write(_struct_I.pack(length))
00184       pattern = '<%sd'%length
00185       buff.write(struct.pack(pattern, *self.state.joint_state.effort))
00186       _x = self
00187       buff.write(_struct_2I.pack(_x.state.multi_dof_joint_state.stamp.secs, _x.state.multi_dof_joint_state.stamp.nsecs))
00188       length = len(self.state.multi_dof_joint_state.joint_names)
00189       buff.write(_struct_I.pack(length))
00190       for val1 in self.state.multi_dof_joint_state.joint_names:
00191         length = len(val1)
00192         if python3 or type(val1) == unicode:
00193           val1 = val1.encode('utf-8')
00194           length = len(val1)
00195         buff.write(struct.pack('<I%ss'%length, length, val1))
00196       length = len(self.state.multi_dof_joint_state.frame_ids)
00197       buff.write(_struct_I.pack(length))
00198       for val1 in self.state.multi_dof_joint_state.frame_ids:
00199         length = len(val1)
00200         if python3 or type(val1) == unicode:
00201           val1 = val1.encode('utf-8')
00202           length = len(val1)
00203         buff.write(struct.pack('<I%ss'%length, length, val1))
00204       length = len(self.state.multi_dof_joint_state.child_frame_ids)
00205       buff.write(_struct_I.pack(length))
00206       for val1 in self.state.multi_dof_joint_state.child_frame_ids:
00207         length = len(val1)
00208         if python3 or type(val1) == unicode:
00209           val1 = val1.encode('utf-8')
00210           length = len(val1)
00211         buff.write(struct.pack('<I%ss'%length, length, val1))
00212       length = len(self.state.multi_dof_joint_state.poses)
00213       buff.write(_struct_I.pack(length))
00214       for val1 in self.state.multi_dof_joint_state.poses:
00215         _v1 = val1.position
00216         _x = _v1
00217         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00218         _v2 = val1.orientation
00219         _x = _v2
00220         buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00221     except struct.error as se: self._check_types(se)
00222     except TypeError as te: self._check_types(te)
00223 
00224   def deserialize(self, str):
00225     """
00226     unpack serialized message in str into this message instance
00227     :param str: byte array of serialized message, ``str``
00228     """
00229     try:
00230       if self.state is None:
00231         self.state = arm_navigation_msgs.msg.RobotState()
00232       end = 0
00233       start = end
00234       end += 4
00235       (length,) = _struct_I.unpack(str[start:end])
00236       self.links = []
00237       for i in range(0, length):
00238         start = end
00239         end += 4
00240         (length,) = _struct_I.unpack(str[start:end])
00241         start = end
00242         end += length
00243         if python3:
00244           val1 = str[start:end].decode('utf-8')
00245         else:
00246           val1 = str[start:end]
00247         self.links.append(val1)
00248       _x = self
00249       start = end
00250       end += 12
00251       (_x.state.joint_state.header.seq, _x.state.joint_state.header.stamp.secs, _x.state.joint_state.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00252       start = end
00253       end += 4
00254       (length,) = _struct_I.unpack(str[start:end])
00255       start = end
00256       end += length
00257       if python3:
00258         self.state.joint_state.header.frame_id = str[start:end].decode('utf-8')
00259       else:
00260         self.state.joint_state.header.frame_id = str[start:end]
00261       start = end
00262       end += 4
00263       (length,) = _struct_I.unpack(str[start:end])
00264       self.state.joint_state.name = []
00265       for i in range(0, length):
00266         start = end
00267         end += 4
00268         (length,) = _struct_I.unpack(str[start:end])
00269         start = end
00270         end += length
00271         if python3:
00272           val1 = str[start:end].decode('utf-8')
00273         else:
00274           val1 = str[start:end]
00275         self.state.joint_state.name.append(val1)
00276       start = end
00277       end += 4
00278       (length,) = _struct_I.unpack(str[start:end])
00279       pattern = '<%sd'%length
00280       start = end
00281       end += struct.calcsize(pattern)
00282       self.state.joint_state.position = struct.unpack(pattern, str[start:end])
00283       start = end
00284       end += 4
00285       (length,) = _struct_I.unpack(str[start:end])
00286       pattern = '<%sd'%length
00287       start = end
00288       end += struct.calcsize(pattern)
00289       self.state.joint_state.velocity = struct.unpack(pattern, str[start:end])
00290       start = end
00291       end += 4
00292       (length,) = _struct_I.unpack(str[start:end])
00293       pattern = '<%sd'%length
00294       start = end
00295       end += struct.calcsize(pattern)
00296       self.state.joint_state.effort = struct.unpack(pattern, str[start:end])
00297       _x = self
00298       start = end
00299       end += 8
00300       (_x.state.multi_dof_joint_state.stamp.secs, _x.state.multi_dof_joint_state.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00301       start = end
00302       end += 4
00303       (length,) = _struct_I.unpack(str[start:end])
00304       self.state.multi_dof_joint_state.joint_names = []
00305       for i in range(0, length):
00306         start = end
00307         end += 4
00308         (length,) = _struct_I.unpack(str[start:end])
00309         start = end
00310         end += length
00311         if python3:
00312           val1 = str[start:end].decode('utf-8')
00313         else:
00314           val1 = str[start:end]
00315         self.state.multi_dof_joint_state.joint_names.append(val1)
00316       start = end
00317       end += 4
00318       (length,) = _struct_I.unpack(str[start:end])
00319       self.state.multi_dof_joint_state.frame_ids = []
00320       for i in range(0, length):
00321         start = end
00322         end += 4
00323         (length,) = _struct_I.unpack(str[start:end])
00324         start = end
00325         end += length
00326         if python3:
00327           val1 = str[start:end].decode('utf-8')
00328         else:
00329           val1 = str[start:end]
00330         self.state.multi_dof_joint_state.frame_ids.append(val1)
00331       start = end
00332       end += 4
00333       (length,) = _struct_I.unpack(str[start:end])
00334       self.state.multi_dof_joint_state.child_frame_ids = []
00335       for i in range(0, length):
00336         start = end
00337         end += 4
00338         (length,) = _struct_I.unpack(str[start:end])
00339         start = end
00340         end += length
00341         if python3:
00342           val1 = str[start:end].decode('utf-8')
00343         else:
00344           val1 = str[start:end]
00345         self.state.multi_dof_joint_state.child_frame_ids.append(val1)
00346       start = end
00347       end += 4
00348       (length,) = _struct_I.unpack(str[start:end])
00349       self.state.multi_dof_joint_state.poses = []
00350       for i in range(0, length):
00351         val1 = geometry_msgs.msg.Pose()
00352         _v3 = val1.position
00353         _x = _v3
00354         start = end
00355         end += 24
00356         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00357         _v4 = val1.orientation
00358         _x = _v4
00359         start = end
00360         end += 32
00361         (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00362         self.state.multi_dof_joint_state.poses.append(val1)
00363       return self
00364     except struct.error as e:
00365       raise genpy.DeserializationError(e) #most likely buffer underfill
00366 
00367 
00368   def serialize_numpy(self, buff, numpy):
00369     """
00370     serialize message with numpy array types into buffer
00371     :param buff: buffer, ``StringIO``
00372     :param numpy: numpy python module
00373     """
00374     try:
00375       length = len(self.links)
00376       buff.write(_struct_I.pack(length))
00377       for val1 in self.links:
00378         length = len(val1)
00379         if python3 or type(val1) == unicode:
00380           val1 = val1.encode('utf-8')
00381           length = len(val1)
00382         buff.write(struct.pack('<I%ss'%length, length, val1))
00383       _x = self
00384       buff.write(_struct_3I.pack(_x.state.joint_state.header.seq, _x.state.joint_state.header.stamp.secs, _x.state.joint_state.header.stamp.nsecs))
00385       _x = self.state.joint_state.header.frame_id
00386       length = len(_x)
00387       if python3 or type(_x) == unicode:
00388         _x = _x.encode('utf-8')
00389         length = len(_x)
00390       buff.write(struct.pack('<I%ss'%length, length, _x))
00391       length = len(self.state.joint_state.name)
00392       buff.write(_struct_I.pack(length))
00393       for val1 in self.state.joint_state.name:
00394         length = len(val1)
00395         if python3 or type(val1) == unicode:
00396           val1 = val1.encode('utf-8')
00397           length = len(val1)
00398         buff.write(struct.pack('<I%ss'%length, length, val1))
00399       length = len(self.state.joint_state.position)
00400       buff.write(_struct_I.pack(length))
00401       pattern = '<%sd'%length
00402       buff.write(self.state.joint_state.position.tostring())
00403       length = len(self.state.joint_state.velocity)
00404       buff.write(_struct_I.pack(length))
00405       pattern = '<%sd'%length
00406       buff.write(self.state.joint_state.velocity.tostring())
00407       length = len(self.state.joint_state.effort)
00408       buff.write(_struct_I.pack(length))
00409       pattern = '<%sd'%length
00410       buff.write(self.state.joint_state.effort.tostring())
00411       _x = self
00412       buff.write(_struct_2I.pack(_x.state.multi_dof_joint_state.stamp.secs, _x.state.multi_dof_joint_state.stamp.nsecs))
00413       length = len(self.state.multi_dof_joint_state.joint_names)
00414       buff.write(_struct_I.pack(length))
00415       for val1 in self.state.multi_dof_joint_state.joint_names:
00416         length = len(val1)
00417         if python3 or type(val1) == unicode:
00418           val1 = val1.encode('utf-8')
00419           length = len(val1)
00420         buff.write(struct.pack('<I%ss'%length, length, val1))
00421       length = len(self.state.multi_dof_joint_state.frame_ids)
00422       buff.write(_struct_I.pack(length))
00423       for val1 in self.state.multi_dof_joint_state.frame_ids:
00424         length = len(val1)
00425         if python3 or type(val1) == unicode:
00426           val1 = val1.encode('utf-8')
00427           length = len(val1)
00428         buff.write(struct.pack('<I%ss'%length, length, val1))
00429       length = len(self.state.multi_dof_joint_state.child_frame_ids)
00430       buff.write(_struct_I.pack(length))
00431       for val1 in self.state.multi_dof_joint_state.child_frame_ids:
00432         length = len(val1)
00433         if python3 or type(val1) == unicode:
00434           val1 = val1.encode('utf-8')
00435           length = len(val1)
00436         buff.write(struct.pack('<I%ss'%length, length, val1))
00437       length = len(self.state.multi_dof_joint_state.poses)
00438       buff.write(_struct_I.pack(length))
00439       for val1 in self.state.multi_dof_joint_state.poses:
00440         _v5 = val1.position
00441         _x = _v5
00442         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00443         _v6 = val1.orientation
00444         _x = _v6
00445         buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00446     except struct.error as se: self._check_types(se)
00447     except TypeError as te: self._check_types(te)
00448 
00449   def deserialize_numpy(self, str, numpy):
00450     """
00451     unpack serialized message in str into this message instance using numpy for array types
00452     :param str: byte array of serialized message, ``str``
00453     :param numpy: numpy python module
00454     """
00455     try:
00456       if self.state is None:
00457         self.state = arm_navigation_msgs.msg.RobotState()
00458       end = 0
00459       start = end
00460       end += 4
00461       (length,) = _struct_I.unpack(str[start:end])
00462       self.links = []
00463       for i in range(0, length):
00464         start = end
00465         end += 4
00466         (length,) = _struct_I.unpack(str[start:end])
00467         start = end
00468         end += length
00469         if python3:
00470           val1 = str[start:end].decode('utf-8')
00471         else:
00472           val1 = str[start:end]
00473         self.links.append(val1)
00474       _x = self
00475       start = end
00476       end += 12
00477       (_x.state.joint_state.header.seq, _x.state.joint_state.header.stamp.secs, _x.state.joint_state.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00478       start = end
00479       end += 4
00480       (length,) = _struct_I.unpack(str[start:end])
00481       start = end
00482       end += length
00483       if python3:
00484         self.state.joint_state.header.frame_id = str[start:end].decode('utf-8')
00485       else:
00486         self.state.joint_state.header.frame_id = str[start:end]
00487       start = end
00488       end += 4
00489       (length,) = _struct_I.unpack(str[start:end])
00490       self.state.joint_state.name = []
00491       for i in range(0, length):
00492         start = end
00493         end += 4
00494         (length,) = _struct_I.unpack(str[start:end])
00495         start = end
00496         end += length
00497         if python3:
00498           val1 = str[start:end].decode('utf-8')
00499         else:
00500           val1 = str[start:end]
00501         self.state.joint_state.name.append(val1)
00502       start = end
00503       end += 4
00504       (length,) = _struct_I.unpack(str[start:end])
00505       pattern = '<%sd'%length
00506       start = end
00507       end += struct.calcsize(pattern)
00508       self.state.joint_state.position = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00509       start = end
00510       end += 4
00511       (length,) = _struct_I.unpack(str[start:end])
00512       pattern = '<%sd'%length
00513       start = end
00514       end += struct.calcsize(pattern)
00515       self.state.joint_state.velocity = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00516       start = end
00517       end += 4
00518       (length,) = _struct_I.unpack(str[start:end])
00519       pattern = '<%sd'%length
00520       start = end
00521       end += struct.calcsize(pattern)
00522       self.state.joint_state.effort = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00523       _x = self
00524       start = end
00525       end += 8
00526       (_x.state.multi_dof_joint_state.stamp.secs, _x.state.multi_dof_joint_state.stamp.nsecs,) = _struct_2I.unpack(str[start:end])
00527       start = end
00528       end += 4
00529       (length,) = _struct_I.unpack(str[start:end])
00530       self.state.multi_dof_joint_state.joint_names = []
00531       for i in range(0, length):
00532         start = end
00533         end += 4
00534         (length,) = _struct_I.unpack(str[start:end])
00535         start = end
00536         end += length
00537         if python3:
00538           val1 = str[start:end].decode('utf-8')
00539         else:
00540           val1 = str[start:end]
00541         self.state.multi_dof_joint_state.joint_names.append(val1)
00542       start = end
00543       end += 4
00544       (length,) = _struct_I.unpack(str[start:end])
00545       self.state.multi_dof_joint_state.frame_ids = []
00546       for i in range(0, length):
00547         start = end
00548         end += 4
00549         (length,) = _struct_I.unpack(str[start:end])
00550         start = end
00551         end += length
00552         if python3:
00553           val1 = str[start:end].decode('utf-8')
00554         else:
00555           val1 = str[start:end]
00556         self.state.multi_dof_joint_state.frame_ids.append(val1)
00557       start = end
00558       end += 4
00559       (length,) = _struct_I.unpack(str[start:end])
00560       self.state.multi_dof_joint_state.child_frame_ids = []
00561       for i in range(0, length):
00562         start = end
00563         end += 4
00564         (length,) = _struct_I.unpack(str[start:end])
00565         start = end
00566         end += length
00567         if python3:
00568           val1 = str[start:end].decode('utf-8')
00569         else:
00570           val1 = str[start:end]
00571         self.state.multi_dof_joint_state.child_frame_ids.append(val1)
00572       start = end
00573       end += 4
00574       (length,) = _struct_I.unpack(str[start:end])
00575       self.state.multi_dof_joint_state.poses = []
00576       for i in range(0, length):
00577         val1 = geometry_msgs.msg.Pose()
00578         _v7 = val1.position
00579         _x = _v7
00580         start = end
00581         end += 24
00582         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00583         _v8 = val1.orientation
00584         _x = _v8
00585         start = end
00586         end += 32
00587         (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00588         self.state.multi_dof_joint_state.poses.append(val1)
00589       return self
00590     except struct.error as e:
00591       raise genpy.DeserializationError(e) #most likely buffer underfill
00592 
00593 _struct_I = genpy.struct_I
00594 _struct_4d = struct.Struct("<4d")
00595 _struct_3I = struct.Struct("<3I")
00596 _struct_2I = struct.Struct("<2I")
00597 _struct_3d = struct.Struct("<3d")
00598 """autogenerated by genpy from chomp_motion_planner/GetChompCollisionCostResponse.msg. Do not edit."""
00599 import sys
00600 python3 = True if sys.hexversion > 0x03000000 else False
00601 import genpy
00602 import struct
00603 
00604 import chomp_motion_planner.msg
00605 
00606 class GetChompCollisionCostResponse(genpy.Message):
00607   _md5sum = "bed009b7d4d6620621ef40430dbc9236"
00608   _type = "chomp_motion_planner/GetChompCollisionCostResponse"
00609   _has_header = False #flag to mark the presence of a Header object
00610   _full_text = """
00611 
00612 float64[] costs
00613 
00614 
00615 
00616 
00617 JointVelocityArray[] gradient
00618 
00619 
00620 uint8 in_collision
00621 
00622 
00623 ================================================================================
00624 MSG: chomp_motion_planner/JointVelocityArray
00625 # A list of joint names
00626 string[] joint_names
00627 
00628 # Velocity for each of the above joints
00629 float64[] velocities
00630 
00631 """
00632   __slots__ = ['costs','gradient','in_collision']
00633   _slot_types = ['float64[]','chomp_motion_planner/JointVelocityArray[]','uint8']
00634 
00635   def __init__(self, *args, **kwds):
00636     """
00637     Constructor. Any message fields that are implicitly/explicitly
00638     set to None will be assigned a default value. The recommend
00639     use is keyword arguments as this is more robust to future message
00640     changes.  You cannot mix in-order arguments and keyword arguments.
00641 
00642     The available fields are:
00643        costs,gradient,in_collision
00644 
00645     :param args: complete set of field values, in .msg order
00646     :param kwds: use keyword arguments corresponding to message field names
00647     to set specific fields.
00648     """
00649     if args or kwds:
00650       super(GetChompCollisionCostResponse, self).__init__(*args, **kwds)
00651       #message fields cannot be None, assign default values for those that are
00652       if self.costs is None:
00653         self.costs = []
00654       if self.gradient is None:
00655         self.gradient = []
00656       if self.in_collision is None:
00657         self.in_collision = 0
00658     else:
00659       self.costs = []
00660       self.gradient = []
00661       self.in_collision = 0
00662 
00663   def _get_types(self):
00664     """
00665     internal API method
00666     """
00667     return self._slot_types
00668 
00669   def serialize(self, buff):
00670     """
00671     serialize message into buffer
00672     :param buff: buffer, ``StringIO``
00673     """
00674     try:
00675       length = len(self.costs)
00676       buff.write(_struct_I.pack(length))
00677       pattern = '<%sd'%length
00678       buff.write(struct.pack(pattern, *self.costs))
00679       length = len(self.gradient)
00680       buff.write(_struct_I.pack(length))
00681       for val1 in self.gradient:
00682         length = len(val1.joint_names)
00683         buff.write(_struct_I.pack(length))
00684         for val2 in val1.joint_names:
00685           length = len(val2)
00686           if python3 or type(val2) == unicode:
00687             val2 = val2.encode('utf-8')
00688             length = len(val2)
00689           buff.write(struct.pack('<I%ss'%length, length, val2))
00690         length = len(val1.velocities)
00691         buff.write(_struct_I.pack(length))
00692         pattern = '<%sd'%length
00693         buff.write(struct.pack(pattern, *val1.velocities))
00694       buff.write(_struct_B.pack(self.in_collision))
00695     except struct.error as se: self._check_types(se)
00696     except TypeError as te: self._check_types(te)
00697 
00698   def deserialize(self, str):
00699     """
00700     unpack serialized message in str into this message instance
00701     :param str: byte array of serialized message, ``str``
00702     """
00703     try:
00704       if self.gradient is None:
00705         self.gradient = None
00706       end = 0
00707       start = end
00708       end += 4
00709       (length,) = _struct_I.unpack(str[start:end])
00710       pattern = '<%sd'%length
00711       start = end
00712       end += struct.calcsize(pattern)
00713       self.costs = struct.unpack(pattern, str[start:end])
00714       start = end
00715       end += 4
00716       (length,) = _struct_I.unpack(str[start:end])
00717       self.gradient = []
00718       for i in range(0, length):
00719         val1 = chomp_motion_planner.msg.JointVelocityArray()
00720         start = end
00721         end += 4
00722         (length,) = _struct_I.unpack(str[start:end])
00723         val1.joint_names = []
00724         for i in range(0, length):
00725           start = end
00726           end += 4
00727           (length,) = _struct_I.unpack(str[start:end])
00728           start = end
00729           end += length
00730           if python3:
00731             val2 = str[start:end].decode('utf-8')
00732           else:
00733             val2 = str[start:end]
00734           val1.joint_names.append(val2)
00735         start = end
00736         end += 4
00737         (length,) = _struct_I.unpack(str[start:end])
00738         pattern = '<%sd'%length
00739         start = end
00740         end += struct.calcsize(pattern)
00741         val1.velocities = struct.unpack(pattern, str[start:end])
00742         self.gradient.append(val1)
00743       start = end
00744       end += 1
00745       (self.in_collision,) = _struct_B.unpack(str[start:end])
00746       return self
00747     except struct.error as e:
00748       raise genpy.DeserializationError(e) #most likely buffer underfill
00749 
00750 
00751   def serialize_numpy(self, buff, numpy):
00752     """
00753     serialize message with numpy array types into buffer
00754     :param buff: buffer, ``StringIO``
00755     :param numpy: numpy python module
00756     """
00757     try:
00758       length = len(self.costs)
00759       buff.write(_struct_I.pack(length))
00760       pattern = '<%sd'%length
00761       buff.write(self.costs.tostring())
00762       length = len(self.gradient)
00763       buff.write(_struct_I.pack(length))
00764       for val1 in self.gradient:
00765         length = len(val1.joint_names)
00766         buff.write(_struct_I.pack(length))
00767         for val2 in val1.joint_names:
00768           length = len(val2)
00769           if python3 or type(val2) == unicode:
00770             val2 = val2.encode('utf-8')
00771             length = len(val2)
00772           buff.write(struct.pack('<I%ss'%length, length, val2))
00773         length = len(val1.velocities)
00774         buff.write(_struct_I.pack(length))
00775         pattern = '<%sd'%length
00776         buff.write(val1.velocities.tostring())
00777       buff.write(_struct_B.pack(self.in_collision))
00778     except struct.error as se: self._check_types(se)
00779     except TypeError as te: self._check_types(te)
00780 
00781   def deserialize_numpy(self, str, numpy):
00782     """
00783     unpack serialized message in str into this message instance using numpy for array types
00784     :param str: byte array of serialized message, ``str``
00785     :param numpy: numpy python module
00786     """
00787     try:
00788       if self.gradient is None:
00789         self.gradient = None
00790       end = 0
00791       start = end
00792       end += 4
00793       (length,) = _struct_I.unpack(str[start:end])
00794       pattern = '<%sd'%length
00795       start = end
00796       end += struct.calcsize(pattern)
00797       self.costs = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00798       start = end
00799       end += 4
00800       (length,) = _struct_I.unpack(str[start:end])
00801       self.gradient = []
00802       for i in range(0, length):
00803         val1 = chomp_motion_planner.msg.JointVelocityArray()
00804         start = end
00805         end += 4
00806         (length,) = _struct_I.unpack(str[start:end])
00807         val1.joint_names = []
00808         for i in range(0, length):
00809           start = end
00810           end += 4
00811           (length,) = _struct_I.unpack(str[start:end])
00812           start = end
00813           end += length
00814           if python3:
00815             val2 = str[start:end].decode('utf-8')
00816           else:
00817             val2 = str[start:end]
00818           val1.joint_names.append(val2)
00819         start = end
00820         end += 4
00821         (length,) = _struct_I.unpack(str[start:end])
00822         pattern = '<%sd'%length
00823         start = end
00824         end += struct.calcsize(pattern)
00825         val1.velocities = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00826         self.gradient.append(val1)
00827       start = end
00828       end += 1
00829       (self.in_collision,) = _struct_B.unpack(str[start:end])
00830       return self
00831     except struct.error as e:
00832       raise genpy.DeserializationError(e) #most likely buffer underfill
00833 
00834 _struct_I = genpy.struct_I
00835 _struct_B = struct.Struct("<B")
00836 class GetChompCollisionCost(object):
00837   _type          = 'chomp_motion_planner/GetChompCollisionCost'
00838   _md5sum = '484cb732bcae020fb22ff8ac89a6ff9f'
00839   _request_class  = GetChompCollisionCostRequest
00840   _response_class = GetChompCollisionCostResponse


chomp_motion_planner
Author(s): Mrinal Kalakrishnan / mail@mrinal.net
autogenerated on Thu Dec 12 2013 11:08:57