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