sdlog2: ATTC - vehicle attitude control logging added

This commit is contained in:
Anton Babushkin 2013-06-06 23:19:16 +04:00
parent aedacc7bc8
commit 4052652a28
2 changed files with 17 additions and 1 deletions

View File

@ -652,6 +652,7 @@ int sdlog2_thread_main(int argc, char *argv[])
struct log_LPOS_s log_LPOS; struct log_LPOS_s log_LPOS;
struct log_LPSP_s log_LPSP; struct log_LPSP_s log_LPSP;
struct log_GPS_s log_GPS; struct log_GPS_s log_GPS;
struct log_ATTC_s log_ATTC;
} body; } body;
} log_msg = { } log_msg = {
LOG_PACKET_HEADER_INIT(0) LOG_PACKET_HEADER_INIT(0)
@ -930,7 +931,12 @@ int sdlog2_thread_main(int argc, char *argv[])
/* --- ACTUATOR CONTROL --- */ /* --- ACTUATOR CONTROL --- */
if (fds[ifds++].revents & POLLIN) { if (fds[ifds++].revents & POLLIN) {
orb_copy(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, subs.act_controls_sub, &buf.act_controls); orb_copy(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, subs.act_controls_sub, &buf.act_controls);
// TODO not implemented yet log_msg.msg_type = LOG_ATTC_MSG;
log_msg.body.log_ATTC.roll = buf.act_controls.control[0];
log_msg.body.log_ATTC.pitch = buf.act_controls.control[1];
log_msg.body.log_ATTC.yaw = buf.act_controls.control[2];
log_msg.body.log_ATTC.thrust = buf.act_controls.control[3];
LOGBUFFER_WRITE_AND_COUNT(ATTC);
} }
/* --- ACTUATOR CONTROL EFFECTIVE --- */ /* --- ACTUATOR CONTROL EFFECTIVE --- */

View File

@ -132,6 +132,15 @@ struct log_GPS_s {
float vel_d; float vel_d;
float cog; float cog;
}; };
/* --- ATTC - ATTITUDE CONTROLS --- */
#define LOG_ATTC_MSG 9
struct log_ATTC_s {
float roll;
float pitch;
float yaw;
float thrust;
};
#pragma pack(pop) #pragma pack(pop)
/* construct list of all message formats */ /* construct list of all message formats */
@ -145,6 +154,7 @@ static const struct log_format_s log_formats[] = {
LOG_FORMAT(LPOS, "fffffffLLf", "X,Y,Z,VX,VY,VZ,Heading,HomeLat,HomeLon,HomeAlt"), LOG_FORMAT(LPOS, "fffffffLLf", "X,Y,Z,VX,VY,VZ,Heading,HomeLat,HomeLon,HomeAlt"),
LOG_FORMAT(LPSP, "ffff", "X,Y,Z,Yaw"), LOG_FORMAT(LPSP, "ffff", "X,Y,Z,Yaw"),
LOG_FORMAT(GPS, "QBffLLfffff", "GPSTime,FixType,EPH,EPV,Lat,Lon,Alt,VelN,VelE,VelD,Cog"), LOG_FORMAT(GPS, "QBffLLfffff", "GPSTime,FixType,EPH,EPV,Lat,Lon,Alt,VelN,VelE,VelD,Cog"),
LOG_FORMAT(ATTC, "ffff", "Roll,Pitch,Yaw,Thrust"),
}; };
static const int log_formats_num = sizeof(log_formats) / sizeof(struct log_format_s); static const int log_formats_num = sizeof(log_formats) / sizeof(struct log_format_s);