AP_Logger: add Write_Winch

This commit is contained in:
Randy Mackay 2020-07-24 14:59:41 +09:00
parent 5d99ce9a84
commit f7ec08ff18
3 changed files with 56 additions and 2 deletions

View File

@ -288,6 +288,7 @@ public:
void Write_OABendyRuler(bool active, float target_yaw, bool ignore_chg, float margin, const Location &final_dest, const Location &oa_dest);
void Write_OADijkstra(uint8_t state, uint8_t error_id, uint8_t curr_point, uint8_t tot_points, const Location &final_dest, const Location &oa_dest);
void Write_SimpleAvoidance(uint8_t state, const Vector2f& desired_vel, const Vector2f& modified_vel, bool back_up);
void Write_Winch(bool healthy, bool thread_end, bool moving, bool clutch, uint8_t mode, float desired_length, float length, float desired_rate, uint16_t tension, float voltage, int8_t temp);
void Write(const char *name, const char *labels, const char *fmt, ...);
void Write(const char *name, const char *labels, const char *units, const char *mults, const char *fmt, ...);

View File

@ -1093,3 +1093,23 @@ void AP_Logger::Write_SimpleAvoidance(uint8_t state, const Vector2f& desired_vel
};
WriteBlock(&pkt, sizeof(pkt));
}
void AP_Logger::Write_Winch(bool healthy, bool thread_end, bool moving, bool clutch, uint8_t mode, float desired_length, float length, float desired_rate, uint16_t tension, float voltage, int8_t temp)
{
struct log_Winch pkt{
LOG_PACKET_HEADER_INIT(LOG_WINCH_MSG),
time_us : AP_HAL::micros64(),
healthy : healthy,
thread_end : thread_end,
moving : moving,
clutch : clutch,
mode : mode,
desired_length : desired_length,
length : length,
desired_rate : desired_rate,
tension : tension,
voltage : voltage,
temp : temp
};
WriteBlock(&pkt, sizeof(pkt));
}

View File

@ -1232,6 +1232,22 @@ struct PACKED log_Arm_Disarm {
uint8_t method;
};
struct PACKED log_Winch {
LOG_PACKET_HEADER;
uint64_t time_us;
uint8_t healthy;
uint8_t thread_end;
uint8_t moving;
uint8_t clutch;
uint8_t mode;
float desired_length;
float length;
float desired_rate;
uint16_t tension;
float voltage;
int8_t temp;
};
// FMT messages define all message formats other than FMT
// UNIT messages define units which can be referenced by FMTU messages
// FMTU messages associate types (e.g. centimeters/second/second) to FMT message fields
@ -2381,6 +2397,21 @@ struct PACKED log_Arm_Disarm {
// @Field: V22: Variance for state 22
// @Field: V23: Variance for state 23
// @LoggerMessage: WINC
// @Description: Winch
// @Field: TimeUS: Time since system startup
// @Field: Heal: Healthy
// @Field: ThEnd: Reached end of thread
// @Field: Mov: Motor is moving
// @Field: Clut: Clutch is engaged (motor can move freely)
// @Field: Mode: 0 is Relaxed, 1 is Position Control, 2 is Rate Control
// @Field: DLen: Desired Length
// @Field: Len: Estimated Length
// @Field: DRate: Desired Rate
// @Field: Tens: Tension on line
// @Field: Vcc: Voltage to Motor
// @Field: Temp: Motor temperature
// messages for all boards
#define LOG_BASE_STRUCTURES \
{ LOG_FORMAT_MSG, sizeof(log_Format), \
@ -2592,8 +2623,9 @@ struct PACKED log_Arm_Disarm {
{ LOG_ARM_DISARM_MSG, sizeof(log_Arm_Disarm), \
"ARM", "QBIBB", "TimeUS,ArmState,ArmChecks,Forced,Method", "s----", "F----" }, \
{ LOG_ERROR_MSG, sizeof(log_Error), \
"ERR", "QBB", "TimeUS,Subsys,ECode", "s--", "F--" }
"ERR", "QBB", "TimeUS,Subsys,ECode", "s--", "F--" }, \
{ LOG_WINCH_MSG, sizeof(log_Winch), \
"WINC", "QBBBBBfffHfb", "TimeUS,Heal,ThEnd,Mov,Clut,Mode,DLen,Len,DRate,Tens,Vcc,Temp", "s-----mmn?vO", "F-----000000" }
// @LoggerMessage: SBPH
// @Description: Swift Health Data
@ -2752,6 +2784,7 @@ enum LogMessages : uint8_t {
LOG_OA_DIJKSTRA_MSG,
LOG_VISUALVEL_MSG,
LOG_SIMPLE_AVOID_MSG,
LOG_WINCH_MSG,
_LOG_LAST_MSG_
};