Statistics
| Branch: | Revision:

root / vision / src / vision / msg / _TargetDescriptor.py @ 06738945

History | View | Annotate | Download (5.2 KB)

1
"""autogenerated by genmsg_py from TargetDescriptor.msg. Do not edit."""
2
import roslib.message
3
import struct
4

    
5
import std_msgs.msg
6

    
7
class TargetDescriptor(roslib.message.Message):
8
  _md5sum = "bd12171ec6aa565dd41eff192ff44cfb"
9
  _type = "vision/TargetDescriptor"
10
  _has_header = True #flag to mark the presence of a Header object
11
  _full_text = """Header header
12
float64 x
13
float64 y
14
float64 size
15

16
================================================================================
17
MSG: std_msgs/Header
18
# Standard metadata for higher-level stamped data types.
19
# This is generally used to communicate timestamped data 
20
# in a particular coordinate frame.
21
# 
22
# sequence ID: consecutively increasing ID 
23
uint32 seq
24
#Two-integer timestamp that is expressed as:
25
# * stamp.secs: seconds (stamp_secs) since epoch
26
# * stamp.nsecs: nanoseconds since stamp_secs
27
# time-handling sugar is provided by the client library
28
time stamp
29
#Frame this data is associated with
30
# 0: no frame
31
# 1: global frame
32
string frame_id
33

34
"""
35
  __slots__ = ['header','x','y','size']
36
  _slot_types = ['Header','float64','float64','float64']
37

    
38
  def __init__(self, *args, **kwds):
39
    """
40
    Constructor. Any message fields that are implicitly/explicitly
41
    set to None will be assigned a default value. The recommend
42
    use is keyword arguments as this is more robust to future message
43
    changes.  You cannot mix in-order arguments and keyword arguments.
44
    
45
    The available fields are:
46
       header,x,y,size
47
    
48
    @param args: complete set of field values, in .msg order
49
    @param kwds: use keyword arguments corresponding to message field names
50
    to set specific fields. 
51
    """
52
    if args or kwds:
53
      super(TargetDescriptor, self).__init__(*args, **kwds)
54
      #message fields cannot be None, assign default values for those that are
55
      if self.header is None:
56
        self.header = std_msgs.msg._Header.Header()
57
      if self.x is None:
58
        self.x = 0.
59
      if self.y is None:
60
        self.y = 0.
61
      if self.size is None:
62
        self.size = 0.
63
    else:
64
      self.header = std_msgs.msg._Header.Header()
65
      self.x = 0.
66
      self.y = 0.
67
      self.size = 0.
68

    
69
  def _get_types(self):
70
    """
71
    internal API method
72
    """
73
    return self._slot_types
74

    
75
  def serialize(self, buff):
76
    """
77
    serialize message into buffer
78
    @param buff: buffer
79
    @type  buff: StringIO
80
    """
81
    try:
82
      _x = self
83
      buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
84
      _x = self.header.frame_id
85
      length = len(_x)
86
      buff.write(struct.pack('<I%ss'%length, length, _x))
87
      _x = self
88
      buff.write(_struct_3d.pack(_x.x, _x.y, _x.size))
89
    except struct.error as se: self._check_types(se)
90
    except TypeError as te: self._check_types(te)
91

    
92
  def deserialize(self, str):
93
    """
94
    unpack serialized message in str into this message instance
95
    @param str: byte array of serialized message
96
    @type  str: str
97
    """
98
    try:
99
      if self.header is None:
100
        self.header = std_msgs.msg._Header.Header()
101
      end = 0
102
      _x = self
103
      start = end
104
      end += 12
105
      (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
106
      start = end
107
      end += 4
108
      (length,) = _struct_I.unpack(str[start:end])
109
      start = end
110
      end += length
111
      self.header.frame_id = str[start:end]
112
      _x = self
113
      start = end
114
      end += 24
115
      (_x.x, _x.y, _x.size,) = _struct_3d.unpack(str[start:end])
116
      return self
117
    except struct.error as e:
118
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
119

    
120

    
121
  def serialize_numpy(self, buff, numpy):
122
    """
123
    serialize message with numpy array types into buffer
124
    @param buff: buffer
125
    @type  buff: StringIO
126
    @param numpy: numpy python module
127
    @type  numpy module
128
    """
129
    try:
130
      _x = self
131
      buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
132
      _x = self.header.frame_id
133
      length = len(_x)
134
      buff.write(struct.pack('<I%ss'%length, length, _x))
135
      _x = self
136
      buff.write(_struct_3d.pack(_x.x, _x.y, _x.size))
137
    except struct.error as se: self._check_types(se)
138
    except TypeError as te: self._check_types(te)
139

    
140
  def deserialize_numpy(self, str, numpy):
141
    """
142
    unpack serialized message in str into this message instance using numpy for array types
143
    @param str: byte array of serialized message
144
    @type  str: str
145
    @param numpy: numpy python module
146
    @type  numpy: module
147
    """
148
    try:
149
      if self.header is None:
150
        self.header = std_msgs.msg._Header.Header()
151
      end = 0
152
      _x = self
153
      start = end
154
      end += 12
155
      (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
156
      start = end
157
      end += 4
158
      (length,) = _struct_I.unpack(str[start:end])
159
      start = end
160
      end += length
161
      self.header.frame_id = str[start:end]
162
      _x = self
163
      start = end
164
      end += 24
165
      (_x.x, _x.y, _x.size,) = _struct_3d.unpack(str[start:end])
166
      return self
167
    except struct.error as e:
168
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
169

    
170
_struct_I = roslib.message.struct_I
171
_struct_3I = struct.Struct("<3I")
172
_struct_3d = struct.Struct("<3d")