$search
00001 """autogenerated by genmsg_py from Segment.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import geometry_msgs.msg 00006 00007 class Segment(roslib.message.Message): 00008 _md5sum = "3fb3f9dacc279b964c4c8341122c34df" 00009 _type = "pr2_dremel_server/Segment" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """geometry_msgs/Point[] points 00012 00013 ================================================================================ 00014 MSG: geometry_msgs/Point 00015 # This contains the position of a point in free space 00016 float64 x 00017 float64 y 00018 float64 z 00019 00020 """ 00021 __slots__ = ['points'] 00022 _slot_types = ['geometry_msgs/Point[]'] 00023 00024 def __init__(self, *args, **kwds): 00025 """ 00026 Constructor. Any message fields that are implicitly/explicitly 00027 set to None will be assigned a default value. The recommend 00028 use is keyword arguments as this is more robust to future message 00029 changes. You cannot mix in-order arguments and keyword arguments. 00030 00031 The available fields are: 00032 points 00033 00034 @param args: complete set of field values, in .msg order 00035 @param kwds: use keyword arguments corresponding to message field names 00036 to set specific fields. 00037 """ 00038 if args or kwds: 00039 super(Segment, self).__init__(*args, **kwds) 00040 #message fields cannot be None, assign default values for those that are 00041 if self.points is None: 00042 self.points = [] 00043 else: 00044 self.points = [] 00045 00046 def _get_types(self): 00047 """ 00048 internal API method 00049 """ 00050 return self._slot_types 00051 00052 def serialize(self, buff): 00053 """ 00054 serialize message into buffer 00055 @param buff: buffer 00056 @type buff: StringIO 00057 """ 00058 try: 00059 length = len(self.points) 00060 buff.write(_struct_I.pack(length)) 00061 for val1 in self.points: 00062 _x = val1 00063 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00064 except struct.error as se: self._check_types(se) 00065 except TypeError as te: self._check_types(te) 00066 00067 def deserialize(self, str): 00068 """ 00069 unpack serialized message in str into this message instance 00070 @param str: byte array of serialized message 00071 @type str: str 00072 """ 00073 try: 00074 end = 0 00075 start = end 00076 end += 4 00077 (length,) = _struct_I.unpack(str[start:end]) 00078 self.points = [] 00079 for i in range(0, length): 00080 val1 = geometry_msgs.msg.Point() 00081 _x = val1 00082 start = end 00083 end += 24 00084 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00085 self.points.append(val1) 00086 return self 00087 except struct.error as e: 00088 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00089 00090 00091 def serialize_numpy(self, buff, numpy): 00092 """ 00093 serialize message with numpy array types into buffer 00094 @param buff: buffer 00095 @type buff: StringIO 00096 @param numpy: numpy python module 00097 @type numpy module 00098 """ 00099 try: 00100 length = len(self.points) 00101 buff.write(_struct_I.pack(length)) 00102 for val1 in self.points: 00103 _x = val1 00104 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00105 except struct.error as se: self._check_types(se) 00106 except TypeError as te: self._check_types(te) 00107 00108 def deserialize_numpy(self, str, numpy): 00109 """ 00110 unpack serialized message in str into this message instance using numpy for array types 00111 @param str: byte array of serialized message 00112 @type str: str 00113 @param numpy: numpy python module 00114 @type numpy: module 00115 """ 00116 try: 00117 end = 0 00118 start = end 00119 end += 4 00120 (length,) = _struct_I.unpack(str[start:end]) 00121 self.points = [] 00122 for i in range(0, length): 00123 val1 = geometry_msgs.msg.Point() 00124 _x = val1 00125 start = end 00126 end += 24 00127 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00128 self.points.append(val1) 00129 return self 00130 except struct.error as e: 00131 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00132 00133 _struct_I = roslib.message.struct_I 00134 _struct_3d = struct.Struct("<3d")