Browse Source

ESC status - supporting negative RPM

sbg
Pavel Kirienko 10 years ago
parent
commit
f9856c6228
  1. 4
      src/modules/sdlog2/sdlog2_messages.h
  2. 2
      src/modules/uORB/topics/esc_status.h
  3. 2
      src/modules/uavcan/actuators/esc.cpp

4
src/modules/sdlog2/sdlog2_messages.h

@ -248,7 +248,7 @@ struct log_ESC_s { @@ -248,7 +248,7 @@ struct log_ESC_s {
uint16_t esc_version;
float esc_voltage;
float esc_current;
uint16_t esc_rpm;
int32_t esc_rpm;
float esc_temperature;
float esc_setpoint;
uint16_t esc_setpoint_raw;
@ -452,7 +452,7 @@ static const struct log_format_s log_formats[] = { @@ -452,7 +452,7 @@ static const struct log_format_s log_formats[] = {
LOG_FORMAT(FLOW, "hhfffBB", "RawX,RawY,CompX,CompY,Dist,Q,SensID"),
LOG_FORMAT(GPOS, "LLfffffff", "Lat,Lon,Alt,VelN,VelE,VelD,EPH,EPV,TALT"),
LOG_FORMAT(GPSP, "BLLffBfbf", "NavState,Lat,Lon,Alt,Yaw,Type,LoitR,LoitDir,PitMin"),
LOG_FORMAT(ESC, "HBBBHHffHffH", "count,nESC,Conn,N,Ver,Adr,Volt,Amp,RPM,Temp,SetP,SetPRAW"),
LOG_FORMAT(ESC, "HBBBHHffiffH", "count,nESC,Conn,N,Ver,Adr,Volt,Amp,RPM,Temp,SetP,SetPRAW"),
LOG_FORMAT(GVSP, "fff", "VX,VY,VZ"),
LOG_FORMAT(BATT, "ffff", "V,VFilt,C,Discharged"),
LOG_FORMAT(DIST, "ffB", "Bottom,BottomRate,Flags"),

2
src/modules/uORB/topics/esc_status.h

@ -99,7 +99,7 @@ struct esc_status_s { @@ -99,7 +99,7 @@ struct esc_status_s {
uint16_t esc_setpoint_raw; /**< setpoint of current ESC (Value sent to ESC) */
uint16_t esc_address; /**< Address of current ESC (in most cases 1-8 / must be set by driver) */
uint16_t esc_version; /**< Version of current ESC - if supported */
uint16_t esc_rpm; /**< RPM measured from current ESC [RPM] - if supported */
int32_t esc_rpm; /**< Motor RPM, negative for reverse rotation [RPM] - if supported */
uint16_t esc_state; /**< State of ESC - depend on Vendor */
} esc[CONNECTED_ESC_MAX];

2
src/modules/uavcan/actuators/esc.cpp

@ -140,7 +140,7 @@ void UavcanEscController::esc_status_sub_cb(const uavcan::ReceivedDataStructure< @@ -140,7 +140,7 @@ void UavcanEscController::esc_status_sub_cb(const uavcan::ReceivedDataStructure<
ref.esc_current = msg.current;
ref.esc_temperature = msg.temperature;
ref.esc_setpoint = msg.power_rating_pct;
ref.esc_rpm = abs(msg.rpm);
ref.esc_rpm = msg.rpm;
ref.esc_errorcount = msg.error_count;
}
}

Loading…
Cancel
Save