Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdlog2: Log actuator output group 1 as well #3413

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/modules/sdlog2/sdlog2.c
Expand Up @@ -1116,7 +1116,7 @@ int sdlog2_thread_main(int argc, char *argv[])
struct log_STAT_s log_STAT;
struct log_VTOL_s log_VTOL;
struct log_RC_s log_RC;
struct log_OUT0_s log_OUT0;
struct log_OUT_s log_OUT;
struct log_AIRS_s log_AIRS;
struct log_ARSP_s log_ARSP;
struct log_FLOW_s log_FLOW;
Expand Down Expand Up @@ -1160,6 +1160,7 @@ int sdlog2_thread_main(int argc, char *argv[])
int att_sp_sub;
int rates_sp_sub;
int act_outputs_sub;
int act_outputs_1_sub;
int act_controls_sub;
int act_controls_1_sub;
int local_pos_sub;
Expand Down Expand Up @@ -1198,6 +1199,7 @@ int sdlog2_thread_main(int argc, char *argv[])
subs.att_sp_sub = -1;
subs.rates_sp_sub = -1;
subs.act_outputs_sub = -1;
subs.act_outputs_1_sub = -1;
subs.act_controls_sub = -1;
subs.act_controls_1_sub = -1;
subs.local_pos_sub = -1;
Expand Down Expand Up @@ -1526,8 +1528,14 @@ int sdlog2_thread_main(int argc, char *argv[])
/* --- ACTUATOR OUTPUTS --- */
if (copy_if_updated(ORB_ID(actuator_outputs), &subs.act_outputs_sub, &buf.act_outputs)) {
log_msg.msg_type = LOG_OUT0_MSG;
memcpy(log_msg.body.log_OUT0.output, buf.act_outputs.output, sizeof(log_msg.body.log_OUT0.output));
LOGBUFFER_WRITE_AND_COUNT(OUT0);
memcpy(log_msg.body.log_OUT.output, buf.act_outputs.output, sizeof(log_msg.body.log_OUT.output));
LOGBUFFER_WRITE_AND_COUNT(OUT);
}

if (copy_if_updated(ORB_ID(actuator_outputs), &subs.act_outputs_1_sub, &buf.act_outputs)) {
log_msg.msg_type = LOG_OUT1_MSG;
memcpy(log_msg.body.log_OUT.output, buf.act_outputs.output, sizeof(log_msg.body.log_OUT.output));
LOGBUFFER_WRITE_AND_COUNT(OUT);
}

/* --- ACTUATOR CONTROL --- */
Expand Down
11 changes: 7 additions & 4 deletions src/modules/sdlog2/sdlog2_messages.h
Expand Up @@ -195,9 +195,9 @@ struct log_RC_s {
uint32_t frame_drop;
};

/* --- OUT0 - ACTUATOR_0 OUTPUT --- */
/* --- OUT - ACTUATOR OUTPUT --- */
#define LOG_OUT0_MSG 12
struct log_OUT0_s {
struct log_OUT_s {
float output[8];
};

Expand Down Expand Up @@ -479,6 +479,8 @@ struct log_MACS_s {
float yaw_rate_integ;
};

/* WARNING: ID 46 is already in use for ATTC1 */

/* --- CONTROL STATE --- */
#define LOG_CTS_MSG 47
struct log_CTS_s {
Expand All @@ -491,7 +493,7 @@ struct log_CTS_s {
float yaw_rate;
};

/* WARNING: ID 46 is already in use for ATTC1 */
#define LOG_OUT1_MSG 50

/********** SYSTEM MESSAGES, ID > 0x80 **********/

Expand Down Expand Up @@ -535,7 +537,8 @@ static const struct log_format_s log_formats[] = {
LOG_FORMAT(VTOL, "f", "Arsp"),
LOG_FORMAT(CTS, "fffffff", "Vx_b,Vy_b,Vz_b,Vinf,P,Q,R"),
LOG_FORMAT(RC, "ffffffffffffBBBL", "C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,RSSI,CNT,Lost,Drop"),
LOG_FORMAT(OUT0, "ffffffff", "Out0,Out1,Out2,Out3,Out4,Out5,Out6,Out7"),
LOG_FORMAT_S(OUT0, OUT, "ffffffff", "Out0,Out1,Out2,Out3,Out4,Out5,Out6,Out7"),
LOG_FORMAT_S(OUT1, OUT, "ffffffff", "Out0,Out1,Out2,Out3,Out4,Out5,Out6,Out7"),
LOG_FORMAT(AIRS, "fff", "IndSpeed,TrueSpeed,AirTemp"),
LOG_FORMAT(ARSP, "fff", "RollRateSP,PitchRateSP,YawRateSP"),
LOG_FORMAT(FLOW, "BffffffLLHhB", "ID,RawX,RawY,RX,RY,RZ,Dist,TSpan,DtSonar,FrmCnt,GT,Qlty"),
Expand Down