Project

General

Profile

Revision b3fc8ce7

IDb3fc8ce73f68975fc610b69e47707c6bf6df1af5

Added by Jeff Cooper over 12 years ago

de-crapping the repository. Kids, don't git add * if you don't know what you're doing.

View differences:

scout/power/src/power/msg/__init__.py
1
from _power_state_changed import *
scout/power/src/power/msg/_power_state_changed.py
1
"""autogenerated by genmsg_py from power_state_changed.msg. Do not edit."""
2
import roslib.message
3
import struct
4

  
5
import std_msgs.msg
6

  
7
class power_state_changed(roslib.message.Message):
8
  _md5sum = "fc98f58bb6056947bbbbbad6cc36490a"
9
  _type = "power/power_state_changed"
10
  _has_header = True #flag to mark the presence of a Header object
11
  _full_text = """Header header
12
#32-bit integer with current voltage info
13
uint32 voltage
14
#power percentage [0-100]
15
uint32 percentage
16
#current draw in mW
17
uint32 draw
18
#are we on external power?
19
bool externalpower
20
#is the battery at a warning state?
21
bool warning
22
#is the battery at a critical state?
23
bool critical
24

  
25

  
26
================================================================================
27
MSG: std_msgs/Header
28
# Standard metadata for higher-level stamped data types.
29
# This is generally used to communicate timestamped data 
30
# in a particular coordinate frame.
31
# 
32
# sequence ID: consecutively increasing ID 
33
uint32 seq
34
#Two-integer timestamp that is expressed as:
35
# * stamp.secs: seconds (stamp_secs) since epoch
36
# * stamp.nsecs: nanoseconds since stamp_secs
37
# time-handling sugar is provided by the client library
38
time stamp
39
#Frame this data is associated with
40
# 0: no frame
41
# 1: global frame
42
string frame_id
43

  
44
"""
45
  __slots__ = ['header','voltage','percentage','draw','externalpower','warning','critical']
46
  _slot_types = ['Header','uint32','uint32','uint32','bool','bool','bool']
47

  
48
  def __init__(self, *args, **kwds):
49
    """
50
    Constructor. Any message fields that are implicitly/explicitly
51
    set to None will be assigned a default value. The recommend
52
    use is keyword arguments as this is more robust to future message
53
    changes.  You cannot mix in-order arguments and keyword arguments.
54
    
55
    The available fields are:
56
       header,voltage,percentage,draw,externalpower,warning,critical
57
    
58
    @param args: complete set of field values, in .msg order
59
    @param kwds: use keyword arguments corresponding to message field names
60
    to set specific fields. 
61
    """
62
    if args or kwds:
63
      super(power_state_changed, self).__init__(*args, **kwds)
64
      #message fields cannot be None, assign default values for those that are
65
      if self.header is None:
66
        self.header = std_msgs.msg._Header.Header()
67
      if self.voltage is None:
68
        self.voltage = 0
69
      if self.percentage is None:
70
        self.percentage = 0
71
      if self.draw is None:
72
        self.draw = 0
73
      if self.externalpower is None:
74
        self.externalpower = False
75
      if self.warning is None:
76
        self.warning = False
77
      if self.critical is None:
78
        self.critical = False
79
    else:
80
      self.header = std_msgs.msg._Header.Header()
81
      self.voltage = 0
82
      self.percentage = 0
83
      self.draw = 0
84
      self.externalpower = False
85
      self.warning = False
86
      self.critical = False
87

  
88
  def _get_types(self):
89
    """
90
    internal API method
91
    """
92
    return self._slot_types
93

  
94
  def serialize(self, buff):
95
    """
96
    serialize message into buffer
97
    @param buff: buffer
98
    @type  buff: StringIO
99
    """
100
    try:
101
      _x = self
102
      buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
103
      _x = self.header.frame_id
104
      length = len(_x)
105
      buff.write(struct.pack('<I%ss'%length, length, _x))
106
      _x = self
107
      buff.write(_struct_3I3B.pack(_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical))
108
    except struct.error, se: self._check_types(se)
109
    except TypeError, te: self._check_types(te)
110

  
111
  def deserialize(self, str):
112
    """
113
    unpack serialized message in str into this message instance
114
    @param str: byte array of serialized message
115
    @type  str: str
116
    """
117
    try:
118
      if self.header is None:
119
        self.header = std_msgs.msg._Header.Header()
120
      end = 0
121
      _x = self
122
      start = end
123
      end += 12
124
      (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
125
      start = end
126
      end += 4
127
      (length,) = _struct_I.unpack(str[start:end])
128
      start = end
129
      end += length
130
      self.header.frame_id = str[start:end]
131
      _x = self
132
      start = end
133
      end += 15
134
      (_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical,) = _struct_3I3B.unpack(str[start:end])
135
      self.externalpower = bool(self.externalpower)
136
      self.warning = bool(self.warning)
137
      self.critical = bool(self.critical)
138
      return self
139
    except struct.error, e:
140
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
141

  
142

  
143
  def serialize_numpy(self, buff, numpy):
144
    """
145
    serialize message with numpy array types into buffer
146
    @param buff: buffer
147
    @type  buff: StringIO
148
    @param numpy: numpy python module
149
    @type  numpy module
150
    """
151
    try:
152
      _x = self
153
      buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
154
      _x = self.header.frame_id
155
      length = len(_x)
156
      buff.write(struct.pack('<I%ss'%length, length, _x))
157
      _x = self
158
      buff.write(_struct_3I3B.pack(_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical))
159
    except struct.error, se: self._check_types(se)
160
    except TypeError, te: self._check_types(te)
161

  
162
  def deserialize_numpy(self, str, numpy):
163
    """
164
    unpack serialized message in str into this message instance using numpy for array types
165
    @param str: byte array of serialized message
166
    @type  str: str
167
    @param numpy: numpy python module
168
    @type  numpy: module
169
    """
170
    try:
171
      if self.header is None:
172
        self.header = std_msgs.msg._Header.Header()
173
      end = 0
174
      _x = self
175
      start = end
176
      end += 12
177
      (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
178
      start = end
179
      end += 4
180
      (length,) = _struct_I.unpack(str[start:end])
181
      start = end
182
      end += length
183
      self.header.frame_id = str[start:end]
184
      _x = self
185
      start = end
186
      end += 15
187
      (_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical,) = _struct_3I3B.unpack(str[start:end])
188
      self.externalpower = bool(self.externalpower)
189
      self.warning = bool(self.warning)
190
      self.critical = bool(self.critical)
191
      return self
192
    except struct.error, e:
193
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
194

  
195
_struct_I = roslib.message.struct_I
196
_struct_3I = struct.Struct("<3I")
197
_struct_3I3B = struct.Struct("<3I3B")
scout/power/src/power/srv/__init__.py
1
from _query_power import *
scout/power/src/power/srv/_query_power.py
1
"""autogenerated by genmsg_py from query_powerRequest.msg. Do not edit."""
2
import roslib.message
3
import struct
4

  
5

  
6
class query_powerRequest(roslib.message.Message):
7
  _md5sum = "d41d8cd98f00b204e9800998ecf8427e"
8
  _type = "power/query_powerRequest"
9
  _has_header = False #flag to mark the presence of a Header object
10
  _full_text = """
11
"""
12
  __slots__ = []
13
  _slot_types = []
14

  
15
  def __init__(self, *args, **kwds):
16
    """
17
    Constructor. Any message fields that are implicitly/explicitly
18
    set to None will be assigned a default value. The recommend
19
    use is keyword arguments as this is more robust to future message
20
    changes.  You cannot mix in-order arguments and keyword arguments.
21
    
22
    The available fields are:
23
       
24
    
25
    @param args: complete set of field values, in .msg order
26
    @param kwds: use keyword arguments corresponding to message field names
27
    to set specific fields. 
28
    """
29
    if args or kwds:
30
      super(query_powerRequest, self).__init__(*args, **kwds)
31

  
32
  def _get_types(self):
33
    """
34
    internal API method
35
    """
36
    return self._slot_types
37

  
38
  def serialize(self, buff):
39
    """
40
    serialize message into buffer
41
    @param buff: buffer
42
    @type  buff: StringIO
43
    """
44
    try:
45
      pass
46
    except struct.error, se: self._check_types(se)
47
    except TypeError, te: self._check_types(te)
48

  
49
  def deserialize(self, str):
50
    """
51
    unpack serialized message in str into this message instance
52
    @param str: byte array of serialized message
53
    @type  str: str
54
    """
55
    try:
56
      end = 0
57
      return self
58
    except struct.error, e:
59
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
60

  
61

  
62
  def serialize_numpy(self, buff, numpy):
63
    """
64
    serialize message with numpy array types into buffer
65
    @param buff: buffer
66
    @type  buff: StringIO
67
    @param numpy: numpy python module
68
    @type  numpy module
69
    """
70
    try:
71
      pass
72
    except struct.error, se: self._check_types(se)
73
    except TypeError, te: self._check_types(te)
74

  
75
  def deserialize_numpy(self, str, numpy):
76
    """
77
    unpack serialized message in str into this message instance using numpy for array types
78
    @param str: byte array of serialized message
79
    @type  str: str
80
    @param numpy: numpy python module
81
    @type  numpy: module
82
    """
83
    try:
84
      end = 0
85
      return self
86
    except struct.error, e:
87
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
88

  
89
_struct_I = roslib.message.struct_I
90
"""autogenerated by genmsg_py from query_powerResponse.msg. Do not edit."""
91
import roslib.message
92
import struct
93

  
94

  
95
class query_powerResponse(roslib.message.Message):
96
  _md5sum = "7f7505c0b2499fcf6c85ecc5dee6164e"
97
  _type = "power/query_powerResponse"
98
  _has_header = False #flag to mark the presence of a Header object
99
  _full_text = """
100
uint32 voltage
101

  
102
uint32 percentage
103

  
104
uint32 draw
105

  
106
bool externalpower
107

  
108
bool warning
109

  
110
bool critical
111

  
112

  
113
"""
114
  __slots__ = ['voltage','percentage','draw','externalpower','warning','critical']
115
  _slot_types = ['uint32','uint32','uint32','bool','bool','bool']
116

  
117
  def __init__(self, *args, **kwds):
118
    """
119
    Constructor. Any message fields that are implicitly/explicitly
120
    set to None will be assigned a default value. The recommend
121
    use is keyword arguments as this is more robust to future message
122
    changes.  You cannot mix in-order arguments and keyword arguments.
123
    
124
    The available fields are:
125
       voltage,percentage,draw,externalpower,warning,critical
126
    
127
    @param args: complete set of field values, in .msg order
128
    @param kwds: use keyword arguments corresponding to message field names
129
    to set specific fields. 
130
    """
131
    if args or kwds:
132
      super(query_powerResponse, self).__init__(*args, **kwds)
133
      #message fields cannot be None, assign default values for those that are
134
      if self.voltage is None:
135
        self.voltage = 0
136
      if self.percentage is None:
137
        self.percentage = 0
138
      if self.draw is None:
139
        self.draw = 0
140
      if self.externalpower is None:
141
        self.externalpower = False
142
      if self.warning is None:
143
        self.warning = False
144
      if self.critical is None:
145
        self.critical = False
146
    else:
147
      self.voltage = 0
148
      self.percentage = 0
149
      self.draw = 0
150
      self.externalpower = False
151
      self.warning = False
152
      self.critical = False
153

  
154
  def _get_types(self):
155
    """
156
    internal API method
157
    """
158
    return self._slot_types
159

  
160
  def serialize(self, buff):
161
    """
162
    serialize message into buffer
163
    @param buff: buffer
164
    @type  buff: StringIO
165
    """
166
    try:
167
      _x = self
168
      buff.write(_struct_3I3B.pack(_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical))
169
    except struct.error, se: self._check_types(se)
170
    except TypeError, te: self._check_types(te)
171

  
172
  def deserialize(self, str):
173
    """
174
    unpack serialized message in str into this message instance
175
    @param str: byte array of serialized message
176
    @type  str: str
177
    """
178
    try:
179
      end = 0
180
      _x = self
181
      start = end
182
      end += 15
183
      (_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical,) = _struct_3I3B.unpack(str[start:end])
184
      self.externalpower = bool(self.externalpower)
185
      self.warning = bool(self.warning)
186
      self.critical = bool(self.critical)
187
      return self
188
    except struct.error, e:
189
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
190

  
191

  
192
  def serialize_numpy(self, buff, numpy):
193
    """
194
    serialize message with numpy array types into buffer
195
    @param buff: buffer
196
    @type  buff: StringIO
197
    @param numpy: numpy python module
198
    @type  numpy module
199
    """
200
    try:
201
      _x = self
202
      buff.write(_struct_3I3B.pack(_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical))
203
    except struct.error, se: self._check_types(se)
204
    except TypeError, te: self._check_types(te)
205

  
206
  def deserialize_numpy(self, str, numpy):
207
    """
208
    unpack serialized message in str into this message instance using numpy for array types
209
    @param str: byte array of serialized message
210
    @type  str: str
211
    @param numpy: numpy python module
212
    @type  numpy: module
213
    """
214
    try:
215
      end = 0
216
      _x = self
217
      start = end
218
      end += 15
219
      (_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical,) = _struct_3I3B.unpack(str[start:end])
220
      self.externalpower = bool(self.externalpower)
221
      self.warning = bool(self.warning)
222
      self.critical = bool(self.critical)
223
      return self
224
    except struct.error, e:
225
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
226

  
227
_struct_I = roslib.message.struct_I
228
_struct_3I3B = struct.Struct("<3I3B")
229
class query_power(roslib.message.ServiceDefinition):
230
  _type          = 'power/query_power'
231
  _md5sum = '7f7505c0b2499fcf6c85ecc5dee6164e'
232
  _request_class  = query_powerRequest
233
  _response_class = query_powerResponse

Also available in: Unified diff