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