_Action.py
Go to the documentation of this file.
00001 """autogenerated by genpy from jsk_gui_msgs/Action.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class Action(genpy.Message):
00009   _md5sum = "d81dc8475ff89ce7097d2e73ebfc2591"
00010   _type = "jsk_gui_msgs/Action"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """byte RARMID=0
00013 byte LARMID=1
00014 
00015 # task: push, pick, open, slide, MoveNeck, MoveBase
00016 string task_name
00017 
00018 # selection: button names
00019 # string selection_name
00020 
00021 # arm: :rarm, :lsrm
00022 int64 arm_id
00023 
00024 # state of touch: touch, pick, pinch, sweep
00025 # for debugging
00026 string state
00027 # value of state
00028 float64 state_value
00029 
00030 # direction: up, down, left, right
00031 string direction
00032 # value of direction, degree
00033 float64 direction_value
00034 
00035 int64 touch_x
00036 int64 touch_y
00037 
00038 # Example
00039 #  push: touches[0].x, touches[0].y, task_name, arm_id
00040 #  open: touches[0 1 2].x, touches[0 1 2].y, task_name, arm_id
00041 #  slide: touches[0 1 2].x, touches[0 1 2].y, task_name, arm_id
00042 #  move_neck: task_name, direction, direction_value
00043 #  move_base: task_name, direction, direction_value
00044 """
00045   # Pseudo-constants
00046   RARMID = 0
00047   LARMID = 1
00048 
00049   __slots__ = ['task_name','arm_id','state','state_value','direction','direction_value','touch_x','touch_y']
00050   _slot_types = ['string','int64','string','float64','string','float64','int64','int64']
00051 
00052   def __init__(self, *args, **kwds):
00053     """
00054     Constructor. Any message fields that are implicitly/explicitly
00055     set to None will be assigned a default value. The recommend
00056     use is keyword arguments as this is more robust to future message
00057     changes.  You cannot mix in-order arguments and keyword arguments.
00058 
00059     The available fields are:
00060        task_name,arm_id,state,state_value,direction,direction_value,touch_x,touch_y
00061 
00062     :param args: complete set of field values, in .msg order
00063     :param kwds: use keyword arguments corresponding to message field names
00064     to set specific fields.
00065     """
00066     if args or kwds:
00067       super(Action, self).__init__(*args, **kwds)
00068       #message fields cannot be None, assign default values for those that are
00069       if self.task_name is None:
00070         self.task_name = ''
00071       if self.arm_id is None:
00072         self.arm_id = 0
00073       if self.state is None:
00074         self.state = ''
00075       if self.state_value is None:
00076         self.state_value = 0.
00077       if self.direction is None:
00078         self.direction = ''
00079       if self.direction_value is None:
00080         self.direction_value = 0.
00081       if self.touch_x is None:
00082         self.touch_x = 0
00083       if self.touch_y is None:
00084         self.touch_y = 0
00085     else:
00086       self.task_name = ''
00087       self.arm_id = 0
00088       self.state = ''
00089       self.state_value = 0.
00090       self.direction = ''
00091       self.direction_value = 0.
00092       self.touch_x = 0
00093       self.touch_y = 0
00094 
00095   def _get_types(self):
00096     """
00097     internal API method
00098     """
00099     return self._slot_types
00100 
00101   def serialize(self, buff):
00102     """
00103     serialize message into buffer
00104     :param buff: buffer, ``StringIO``
00105     """
00106     try:
00107       _x = self.task_name
00108       length = len(_x)
00109       if python3 or type(_x) == unicode:
00110         _x = _x.encode('utf-8')
00111         length = len(_x)
00112       buff.write(struct.pack('<I%ss'%length, length, _x))
00113       buff.write(_struct_q.pack(self.arm_id))
00114       _x = self.state
00115       length = len(_x)
00116       if python3 or type(_x) == unicode:
00117         _x = _x.encode('utf-8')
00118         length = len(_x)
00119       buff.write(struct.pack('<I%ss'%length, length, _x))
00120       buff.write(_struct_d.pack(self.state_value))
00121       _x = self.direction
00122       length = len(_x)
00123       if python3 or type(_x) == unicode:
00124         _x = _x.encode('utf-8')
00125         length = len(_x)
00126       buff.write(struct.pack('<I%ss'%length, length, _x))
00127       _x = self
00128       buff.write(_struct_d2q.pack(_x.direction_value, _x.touch_x, _x.touch_y))
00129     except struct.error as se: self._check_types(se)
00130     except TypeError as te: self._check_types(te)
00131 
00132   def deserialize(self, str):
00133     """
00134     unpack serialized message in str into this message instance
00135     :param str: byte array of serialized message, ``str``
00136     """
00137     try:
00138       end = 0
00139       start = end
00140       end += 4
00141       (length,) = _struct_I.unpack(str[start:end])
00142       start = end
00143       end += length
00144       if python3:
00145         self.task_name = str[start:end].decode('utf-8')
00146       else:
00147         self.task_name = str[start:end]
00148       start = end
00149       end += 8
00150       (self.arm_id,) = _struct_q.unpack(str[start:end])
00151       start = end
00152       end += 4
00153       (length,) = _struct_I.unpack(str[start:end])
00154       start = end
00155       end += length
00156       if python3:
00157         self.state = str[start:end].decode('utf-8')
00158       else:
00159         self.state = str[start:end]
00160       start = end
00161       end += 8
00162       (self.state_value,) = _struct_d.unpack(str[start:end])
00163       start = end
00164       end += 4
00165       (length,) = _struct_I.unpack(str[start:end])
00166       start = end
00167       end += length
00168       if python3:
00169         self.direction = str[start:end].decode('utf-8')
00170       else:
00171         self.direction = str[start:end]
00172       _x = self
00173       start = end
00174       end += 24
00175       (_x.direction_value, _x.touch_x, _x.touch_y,) = _struct_d2q.unpack(str[start:end])
00176       return self
00177     except struct.error as e:
00178       raise genpy.DeserializationError(e) #most likely buffer underfill
00179 
00180 
00181   def serialize_numpy(self, buff, numpy):
00182     """
00183     serialize message with numpy array types into buffer
00184     :param buff: buffer, ``StringIO``
00185     :param numpy: numpy python module
00186     """
00187     try:
00188       _x = self.task_name
00189       length = len(_x)
00190       if python3 or type(_x) == unicode:
00191         _x = _x.encode('utf-8')
00192         length = len(_x)
00193       buff.write(struct.pack('<I%ss'%length, length, _x))
00194       buff.write(_struct_q.pack(self.arm_id))
00195       _x = self.state
00196       length = len(_x)
00197       if python3 or type(_x) == unicode:
00198         _x = _x.encode('utf-8')
00199         length = len(_x)
00200       buff.write(struct.pack('<I%ss'%length, length, _x))
00201       buff.write(_struct_d.pack(self.state_value))
00202       _x = self.direction
00203       length = len(_x)
00204       if python3 or type(_x) == unicode:
00205         _x = _x.encode('utf-8')
00206         length = len(_x)
00207       buff.write(struct.pack('<I%ss'%length, length, _x))
00208       _x = self
00209       buff.write(_struct_d2q.pack(_x.direction_value, _x.touch_x, _x.touch_y))
00210     except struct.error as se: self._check_types(se)
00211     except TypeError as te: self._check_types(te)
00212 
00213   def deserialize_numpy(self, str, numpy):
00214     """
00215     unpack serialized message in str into this message instance using numpy for array types
00216     :param str: byte array of serialized message, ``str``
00217     :param numpy: numpy python module
00218     """
00219     try:
00220       end = 0
00221       start = end
00222       end += 4
00223       (length,) = _struct_I.unpack(str[start:end])
00224       start = end
00225       end += length
00226       if python3:
00227         self.task_name = str[start:end].decode('utf-8')
00228       else:
00229         self.task_name = str[start:end]
00230       start = end
00231       end += 8
00232       (self.arm_id,) = _struct_q.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.state = str[start:end].decode('utf-8')
00240       else:
00241         self.state = str[start:end]
00242       start = end
00243       end += 8
00244       (self.state_value,) = _struct_d.unpack(str[start:end])
00245       start = end
00246       end += 4
00247       (length,) = _struct_I.unpack(str[start:end])
00248       start = end
00249       end += length
00250       if python3:
00251         self.direction = str[start:end].decode('utf-8')
00252       else:
00253         self.direction = str[start:end]
00254       _x = self
00255       start = end
00256       end += 24
00257       (_x.direction_value, _x.touch_x, _x.touch_y,) = _struct_d2q.unpack(str[start:end])
00258       return self
00259     except struct.error as e:
00260       raise genpy.DeserializationError(e) #most likely buffer underfill
00261 
00262 _struct_I = genpy.struct_I
00263 _struct_q = struct.Struct("<q")
00264 _struct_d2q = struct.Struct("<d2q")
00265 _struct_d = struct.Struct("<d")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


jsk_gui_msgs
Author(s): chen
autogenerated on Sat Mar 23 2013 16:13:08