$search
00001 """autogenerated by genmsg_py from JointStatistics.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import roslib.rostime 00006 00007 class JointStatistics(roslib.message.Message): 00008 _md5sum = "90fdc8acbce5bc783d8b4aec49af6590" 00009 _type = "pr2_mechanism_msgs/JointStatistics" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """# This message contains the state of one joint of the pr2 robot. 00012 # This message is specificly designed for the pr2 robot. 00013 # A generic joint state message can be found in sensor_msgs::JointState 00014 00015 # the name of the joint 00016 string name 00017 00018 # the time at which these joint statistics were measured 00019 time timestamp 00020 00021 # the position of the joint in radians 00022 float64 position 00023 00024 # the velocity of the joint in radians per second 00025 float64 velocity 00026 00027 # the measured joint effort 00028 float64 measured_effort 00029 00030 # the effort that was commanded to the joint. 00031 # the actual applied effort might be different 00032 # because the safety code can limit the effort 00033 # a joint can apply 00034 float64 commanded_effort 00035 00036 # a flag indicating if the joint is calibrated or not 00037 bool is_calibrated 00038 00039 # a flag inidcating if the joint violated one of its position/velocity/effort limits 00040 # in the last publish cycle 00041 bool violated_limits 00042 00043 # the total distance travelled by the joint, measured in radians. 00044 float64 odometer 00045 00046 # the lowest position reached by the joint in the last publish cycle 00047 float64 min_position 00048 00049 # the highest position reached by the joint in the last publish cycle 00050 float64 max_position 00051 00052 # the maximum absolute velocity reached by the joint in the last publish cycle 00053 float64 max_abs_velocity 00054 00055 # the maximum absolute effort applied by the joint in the last publish cycle 00056 float64 max_abs_effort 00057 00058 """ 00059 __slots__ = ['name','timestamp','position','velocity','measured_effort','commanded_effort','is_calibrated','violated_limits','odometer','min_position','max_position','max_abs_velocity','max_abs_effort'] 00060 _slot_types = ['string','time','float64','float64','float64','float64','bool','bool','float64','float64','float64','float64','float64'] 00061 00062 def __init__(self, *args, **kwds): 00063 """ 00064 Constructor. Any message fields that are implicitly/explicitly 00065 set to None will be assigned a default value. The recommend 00066 use is keyword arguments as this is more robust to future message 00067 changes. You cannot mix in-order arguments and keyword arguments. 00068 00069 The available fields are: 00070 name,timestamp,position,velocity,measured_effort,commanded_effort,is_calibrated,violated_limits,odometer,min_position,max_position,max_abs_velocity,max_abs_effort 00071 00072 @param args: complete set of field values, in .msg order 00073 @param kwds: use keyword arguments corresponding to message field names 00074 to set specific fields. 00075 """ 00076 if args or kwds: 00077 super(JointStatistics, self).__init__(*args, **kwds) 00078 #message fields cannot be None, assign default values for those that are 00079 if self.name is None: 00080 self.name = '' 00081 if self.timestamp is None: 00082 self.timestamp = roslib.rostime.Time() 00083 if self.position is None: 00084 self.position = 0. 00085 if self.velocity is None: 00086 self.velocity = 0. 00087 if self.measured_effort is None: 00088 self.measured_effort = 0. 00089 if self.commanded_effort is None: 00090 self.commanded_effort = 0. 00091 if self.is_calibrated is None: 00092 self.is_calibrated = False 00093 if self.violated_limits is None: 00094 self.violated_limits = False 00095 if self.odometer is None: 00096 self.odometer = 0. 00097 if self.min_position is None: 00098 self.min_position = 0. 00099 if self.max_position is None: 00100 self.max_position = 0. 00101 if self.max_abs_velocity is None: 00102 self.max_abs_velocity = 0. 00103 if self.max_abs_effort is None: 00104 self.max_abs_effort = 0. 00105 else: 00106 self.name = '' 00107 self.timestamp = roslib.rostime.Time() 00108 self.position = 0. 00109 self.velocity = 0. 00110 self.measured_effort = 0. 00111 self.commanded_effort = 0. 00112 self.is_calibrated = False 00113 self.violated_limits = False 00114 self.odometer = 0. 00115 self.min_position = 0. 00116 self.max_position = 0. 00117 self.max_abs_velocity = 0. 00118 self.max_abs_effort = 0. 00119 00120 def _get_types(self): 00121 """ 00122 internal API method 00123 """ 00124 return self._slot_types 00125 00126 def serialize(self, buff): 00127 """ 00128 serialize message into buffer 00129 @param buff: buffer 00130 @type buff: StringIO 00131 """ 00132 try: 00133 _x = self.name 00134 length = len(_x) 00135 buff.write(struct.pack('<I%ss'%length, length, _x)) 00136 _x = self 00137 buff.write(_struct_2I4d2B5d.pack(_x.timestamp.secs, _x.timestamp.nsecs, _x.position, _x.velocity, _x.measured_effort, _x.commanded_effort, _x.is_calibrated, _x.violated_limits, _x.odometer, _x.min_position, _x.max_position, _x.max_abs_velocity, _x.max_abs_effort)) 00138 except struct.error as se: self._check_types(se) 00139 except TypeError as te: self._check_types(te) 00140 00141 def deserialize(self, str): 00142 """ 00143 unpack serialized message in str into this message instance 00144 @param str: byte array of serialized message 00145 @type str: str 00146 """ 00147 try: 00148 if self.timestamp is None: 00149 self.timestamp = roslib.rostime.Time() 00150 end = 0 00151 start = end 00152 end += 4 00153 (length,) = _struct_I.unpack(str[start:end]) 00154 start = end 00155 end += length 00156 self.name = str[start:end] 00157 _x = self 00158 start = end 00159 end += 82 00160 (_x.timestamp.secs, _x.timestamp.nsecs, _x.position, _x.velocity, _x.measured_effort, _x.commanded_effort, _x.is_calibrated, _x.violated_limits, _x.odometer, _x.min_position, _x.max_position, _x.max_abs_velocity, _x.max_abs_effort,) = _struct_2I4d2B5d.unpack(str[start:end]) 00161 self.is_calibrated = bool(self.is_calibrated) 00162 self.violated_limits = bool(self.violated_limits) 00163 self.timestamp.canon() 00164 return self 00165 except struct.error as e: 00166 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00167 00168 00169 def serialize_numpy(self, buff, numpy): 00170 """ 00171 serialize message with numpy array types into buffer 00172 @param buff: buffer 00173 @type buff: StringIO 00174 @param numpy: numpy python module 00175 @type numpy module 00176 """ 00177 try: 00178 _x = self.name 00179 length = len(_x) 00180 buff.write(struct.pack('<I%ss'%length, length, _x)) 00181 _x = self 00182 buff.write(_struct_2I4d2B5d.pack(_x.timestamp.secs, _x.timestamp.nsecs, _x.position, _x.velocity, _x.measured_effort, _x.commanded_effort, _x.is_calibrated, _x.violated_limits, _x.odometer, _x.min_position, _x.max_position, _x.max_abs_velocity, _x.max_abs_effort)) 00183 except struct.error as se: self._check_types(se) 00184 except TypeError as te: self._check_types(te) 00185 00186 def deserialize_numpy(self, str, numpy): 00187 """ 00188 unpack serialized message in str into this message instance using numpy for array types 00189 @param str: byte array of serialized message 00190 @type str: str 00191 @param numpy: numpy python module 00192 @type numpy: module 00193 """ 00194 try: 00195 if self.timestamp is None: 00196 self.timestamp = roslib.rostime.Time() 00197 end = 0 00198 start = end 00199 end += 4 00200 (length,) = _struct_I.unpack(str[start:end]) 00201 start = end 00202 end += length 00203 self.name = str[start:end] 00204 _x = self 00205 start = end 00206 end += 82 00207 (_x.timestamp.secs, _x.timestamp.nsecs, _x.position, _x.velocity, _x.measured_effort, _x.commanded_effort, _x.is_calibrated, _x.violated_limits, _x.odometer, _x.min_position, _x.max_position, _x.max_abs_velocity, _x.max_abs_effort,) = _struct_2I4d2B5d.unpack(str[start:end]) 00208 self.is_calibrated = bool(self.is_calibrated) 00209 self.violated_limits = bool(self.violated_limits) 00210 self.timestamp.canon() 00211 return self 00212 except struct.error as e: 00213 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00214 00215 _struct_I = roslib.message.struct_I 00216 _struct_2I4d2B5d = struct.Struct("<2I4d2B5d")