_ActuatorStatistics.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_mechanism_msgs/ActuatorStatistics.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import genpy
00008 
00009 class ActuatorStatistics(genpy.Message):
00010   _md5sum = "c37184273b29627de29382f1d3670175"
00011   _type = "pr2_mechanism_msgs/ActuatorStatistics"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# This message contains the state of an actuator on the pr2 robot.
00014 # An actuator contains a motor and an encoder, and is connected
00015 # to a joint by a transmission
00016 
00017 # the name of the actuator
00018 string name
00019 
00020 # the sequence number of the MCB in the ethercat chain. 
00021 # the first device in the chain gets deviced_id zero
00022 int32 device_id
00023 
00024 # the time at which this actuator state was measured
00025 time timestamp
00026 
00027 # the encoder position, represented by the number of encoder ticks
00028 int32 encoder_count
00029 
00030 # The angular offset (in radians) that is added to the encoder reading, 
00031 # to get to the position of the actuator. This number is computed when the referece
00032 # sensor is triggered during the calibration phase
00033 float64 encoder_offset
00034 
00035 # the encoder position in radians
00036 float64 position
00037 
00038 # the encoder velocity in encoder ticks per second
00039 float64 encoder_velocity
00040 
00041 # the encoder velocity in radians per second
00042 float64 velocity
00043 
00044 # the value of the calibration reading: low (false) or high (true)
00045 bool calibration_reading
00046 
00047 # bool to indicate if the joint already triggered the rising/falling edge of the reference sensor
00048 bool calibration_rising_edge_valid
00049 bool calibration_falling_edge_valid
00050 
00051 # the encoder position when the last rising/falling edge was observed. 
00052 # only read this value when the calibration_rising/falling_edge_valid is true
00053 float64 last_calibration_rising_edge
00054 float64 last_calibration_falling_edge
00055 
00056 # flag to indicate if this actuator is enabled or not. 
00057 # An actuator can only be commanded when it is enabled.
00058 bool is_enabled
00059 
00060 # indicates if the motor is halted. A motor can be halted because of a voltage or communication problem
00061 bool halted
00062 
00063 # the last current/effort command that was requested
00064 float64 last_commanded_current
00065 float64 last_commanded_effort
00066 
00067 # the last current/effort command that was executed by the actuator
00068 float64 last_executed_current
00069 float64 last_executed_effort
00070 
00071 # the last current/effort that was measured by the actuator
00072 float64 last_measured_current
00073 float64 last_measured_effort
00074 
00075 # the motor voltate
00076 float64 motor_voltage
00077 
00078 # the number of detected encoder problems 
00079 int32 num_encoder_errors
00080 
00081 
00082 """
00083   __slots__ = ['name','device_id','timestamp','encoder_count','encoder_offset','position','encoder_velocity','velocity','calibration_reading','calibration_rising_edge_valid','calibration_falling_edge_valid','last_calibration_rising_edge','last_calibration_falling_edge','is_enabled','halted','last_commanded_current','last_commanded_effort','last_executed_current','last_executed_effort','last_measured_current','last_measured_effort','motor_voltage','num_encoder_errors']
00084   _slot_types = ['string','int32','time','int32','float64','float64','float64','float64','bool','bool','bool','float64','float64','bool','bool','float64','float64','float64','float64','float64','float64','float64','int32']
00085 
00086   def __init__(self, *args, **kwds):
00087     """
00088     Constructor. Any message fields that are implicitly/explicitly
00089     set to None will be assigned a default value. The recommend
00090     use is keyword arguments as this is more robust to future message
00091     changes.  You cannot mix in-order arguments and keyword arguments.
00092 
00093     The available fields are:
00094        name,device_id,timestamp,encoder_count,encoder_offset,position,encoder_velocity,velocity,calibration_reading,calibration_rising_edge_valid,calibration_falling_edge_valid,last_calibration_rising_edge,last_calibration_falling_edge,is_enabled,halted,last_commanded_current,last_commanded_effort,last_executed_current,last_executed_effort,last_measured_current,last_measured_effort,motor_voltage,num_encoder_errors
00095 
00096     :param args: complete set of field values, in .msg order
00097     :param kwds: use keyword arguments corresponding to message field names
00098     to set specific fields.
00099     """
00100     if args or kwds:
00101       super(ActuatorStatistics, self).__init__(*args, **kwds)
00102       #message fields cannot be None, assign default values for those that are
00103       if self.name is None:
00104         self.name = ''
00105       if self.device_id is None:
00106         self.device_id = 0
00107       if self.timestamp is None:
00108         self.timestamp = genpy.Time()
00109       if self.encoder_count is None:
00110         self.encoder_count = 0
00111       if self.encoder_offset is None:
00112         self.encoder_offset = 0.
00113       if self.position is None:
00114         self.position = 0.
00115       if self.encoder_velocity is None:
00116         self.encoder_velocity = 0.
00117       if self.velocity is None:
00118         self.velocity = 0.
00119       if self.calibration_reading is None:
00120         self.calibration_reading = False
00121       if self.calibration_rising_edge_valid is None:
00122         self.calibration_rising_edge_valid = False
00123       if self.calibration_falling_edge_valid is None:
00124         self.calibration_falling_edge_valid = False
00125       if self.last_calibration_rising_edge is None:
00126         self.last_calibration_rising_edge = 0.
00127       if self.last_calibration_falling_edge is None:
00128         self.last_calibration_falling_edge = 0.
00129       if self.is_enabled is None:
00130         self.is_enabled = False
00131       if self.halted is None:
00132         self.halted = False
00133       if self.last_commanded_current is None:
00134         self.last_commanded_current = 0.
00135       if self.last_commanded_effort is None:
00136         self.last_commanded_effort = 0.
00137       if self.last_executed_current is None:
00138         self.last_executed_current = 0.
00139       if self.last_executed_effort is None:
00140         self.last_executed_effort = 0.
00141       if self.last_measured_current is None:
00142         self.last_measured_current = 0.
00143       if self.last_measured_effort is None:
00144         self.last_measured_effort = 0.
00145       if self.motor_voltage is None:
00146         self.motor_voltage = 0.
00147       if self.num_encoder_errors is None:
00148         self.num_encoder_errors = 0
00149     else:
00150       self.name = ''
00151       self.device_id = 0
00152       self.timestamp = genpy.Time()
00153       self.encoder_count = 0
00154       self.encoder_offset = 0.
00155       self.position = 0.
00156       self.encoder_velocity = 0.
00157       self.velocity = 0.
00158       self.calibration_reading = False
00159       self.calibration_rising_edge_valid = False
00160       self.calibration_falling_edge_valid = False
00161       self.last_calibration_rising_edge = 0.
00162       self.last_calibration_falling_edge = 0.
00163       self.is_enabled = False
00164       self.halted = False
00165       self.last_commanded_current = 0.
00166       self.last_commanded_effort = 0.
00167       self.last_executed_current = 0.
00168       self.last_executed_effort = 0.
00169       self.last_measured_current = 0.
00170       self.last_measured_effort = 0.
00171       self.motor_voltage = 0.
00172       self.num_encoder_errors = 0
00173 
00174   def _get_types(self):
00175     """
00176     internal API method
00177     """
00178     return self._slot_types
00179 
00180   def serialize(self, buff):
00181     """
00182     serialize message into buffer
00183     :param buff: buffer, ``StringIO``
00184     """
00185     try:
00186       _x = self.name
00187       length = len(_x)
00188       if python3 or type(_x) == unicode:
00189         _x = _x.encode('utf-8')
00190         length = len(_x)
00191       buff.write(struct.pack('<I%ss'%length, length, _x))
00192       _x = self
00193       buff.write(_struct_i2Ii4d3B2d2B7di.pack(_x.device_id, _x.timestamp.secs, _x.timestamp.nsecs, _x.encoder_count, _x.encoder_offset, _x.position, _x.encoder_velocity, _x.velocity, _x.calibration_reading, _x.calibration_rising_edge_valid, _x.calibration_falling_edge_valid, _x.last_calibration_rising_edge, _x.last_calibration_falling_edge, _x.is_enabled, _x.halted, _x.last_commanded_current, _x.last_commanded_effort, _x.last_executed_current, _x.last_executed_effort, _x.last_measured_current, _x.last_measured_effort, _x.motor_voltage, _x.num_encoder_errors))
00194     except struct.error as se: self._check_types(se)
00195     except TypeError as te: self._check_types(te)
00196 
00197   def deserialize(self, str):
00198     """
00199     unpack serialized message in str into this message instance
00200     :param str: byte array of serialized message, ``str``
00201     """
00202     try:
00203       if self.timestamp is None:
00204         self.timestamp = genpy.Time()
00205       end = 0
00206       start = end
00207       end += 4
00208       (length,) = _struct_I.unpack(str[start:end])
00209       start = end
00210       end += length
00211       if python3:
00212         self.name = str[start:end].decode('utf-8')
00213       else:
00214         self.name = str[start:end]
00215       _x = self
00216       start = end
00217       end += 129
00218       (_x.device_id, _x.timestamp.secs, _x.timestamp.nsecs, _x.encoder_count, _x.encoder_offset, _x.position, _x.encoder_velocity, _x.velocity, _x.calibration_reading, _x.calibration_rising_edge_valid, _x.calibration_falling_edge_valid, _x.last_calibration_rising_edge, _x.last_calibration_falling_edge, _x.is_enabled, _x.halted, _x.last_commanded_current, _x.last_commanded_effort, _x.last_executed_current, _x.last_executed_effort, _x.last_measured_current, _x.last_measured_effort, _x.motor_voltage, _x.num_encoder_errors,) = _struct_i2Ii4d3B2d2B7di.unpack(str[start:end])
00219       self.calibration_reading = bool(self.calibration_reading)
00220       self.calibration_rising_edge_valid = bool(self.calibration_rising_edge_valid)
00221       self.calibration_falling_edge_valid = bool(self.calibration_falling_edge_valid)
00222       self.is_enabled = bool(self.is_enabled)
00223       self.halted = bool(self.halted)
00224       self.timestamp.canon()
00225       return self
00226     except struct.error as e:
00227       raise genpy.DeserializationError(e) #most likely buffer underfill
00228 
00229 
00230   def serialize_numpy(self, buff, numpy):
00231     """
00232     serialize message with numpy array types into buffer
00233     :param buff: buffer, ``StringIO``
00234     :param numpy: numpy python module
00235     """
00236     try:
00237       _x = self.name
00238       length = len(_x)
00239       if python3 or type(_x) == unicode:
00240         _x = _x.encode('utf-8')
00241         length = len(_x)
00242       buff.write(struct.pack('<I%ss'%length, length, _x))
00243       _x = self
00244       buff.write(_struct_i2Ii4d3B2d2B7di.pack(_x.device_id, _x.timestamp.secs, _x.timestamp.nsecs, _x.encoder_count, _x.encoder_offset, _x.position, _x.encoder_velocity, _x.velocity, _x.calibration_reading, _x.calibration_rising_edge_valid, _x.calibration_falling_edge_valid, _x.last_calibration_rising_edge, _x.last_calibration_falling_edge, _x.is_enabled, _x.halted, _x.last_commanded_current, _x.last_commanded_effort, _x.last_executed_current, _x.last_executed_effort, _x.last_measured_current, _x.last_measured_effort, _x.motor_voltage, _x.num_encoder_errors))
00245     except struct.error as se: self._check_types(se)
00246     except TypeError as te: self._check_types(te)
00247 
00248   def deserialize_numpy(self, str, numpy):
00249     """
00250     unpack serialized message in str into this message instance using numpy for array types
00251     :param str: byte array of serialized message, ``str``
00252     :param numpy: numpy python module
00253     """
00254     try:
00255       if self.timestamp is None:
00256         self.timestamp = genpy.Time()
00257       end = 0
00258       start = end
00259       end += 4
00260       (length,) = _struct_I.unpack(str[start:end])
00261       start = end
00262       end += length
00263       if python3:
00264         self.name = str[start:end].decode('utf-8')
00265       else:
00266         self.name = str[start:end]
00267       _x = self
00268       start = end
00269       end += 129
00270       (_x.device_id, _x.timestamp.secs, _x.timestamp.nsecs, _x.encoder_count, _x.encoder_offset, _x.position, _x.encoder_velocity, _x.velocity, _x.calibration_reading, _x.calibration_rising_edge_valid, _x.calibration_falling_edge_valid, _x.last_calibration_rising_edge, _x.last_calibration_falling_edge, _x.is_enabled, _x.halted, _x.last_commanded_current, _x.last_commanded_effort, _x.last_executed_current, _x.last_executed_effort, _x.last_measured_current, _x.last_measured_effort, _x.motor_voltage, _x.num_encoder_errors,) = _struct_i2Ii4d3B2d2B7di.unpack(str[start:end])
00271       self.calibration_reading = bool(self.calibration_reading)
00272       self.calibration_rising_edge_valid = bool(self.calibration_rising_edge_valid)
00273       self.calibration_falling_edge_valid = bool(self.calibration_falling_edge_valid)
00274       self.is_enabled = bool(self.is_enabled)
00275       self.halted = bool(self.halted)
00276       self.timestamp.canon()
00277       return self
00278     except struct.error as e:
00279       raise genpy.DeserializationError(e) #most likely buffer underfill
00280 
00281 _struct_I = genpy.struct_I
00282 _struct_i2Ii4d3B2d2B7di = struct.Struct("<i2Ii4d3B2d2B7di")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends


pr2_mechanism_msgs
Author(s): Stuart Glaser sglaser@willowgarage.com, Wim Meeussen
autogenerated on Mon Nov 19 2012 16:39:56