Subscribing to AoA data to sdlog

This is a newbie with little experience in coding asking for advice. I’m trying to modify the default PX4 firmware to have data from the 3.3V ADC converter channel output to the sdlogs. Following the guide for subscribing data, I’ve added these lines to src/modules/sdlog2/sdlog2.c

114 <uORB/topics/adc_report.h>
1338 int adc_report_sub;

That should allow the system to collect the data unless adc_report_sub isn’t a topic. From there, I also made the following changes

1226 struct adc_report_s adc;
1288 struct log_AOASS_s log_AOASS;
1383 subs.adc_report_sub = -1
2284 /* --- ANGLE-OF-ATTACK AND SIDESLIP --- */
2285            if (copy_if_updated(ORB_ID(adc_report), &subs.adc_report_sub, &buf.adc)) {
2286            	log_msg.msg_type = LOG_AOASS_MSG;
2287            	log_msg.body.log_AOASS.aoa_v = adc.channel_value[13];
2288             	log_msg.body.log_AOASS.ss_v = adc.channel_value[14];

Then to wrap it up, I added messages for AoA and SS respectively to sdlog2_messages.

650 /* --- AOA,SS - ANGLE OF ATTACK AND SIDESLIP --- */
651 #define LOG_AOASS_MSG 120
652 struct log_AOASS_s {
653	float aoa_v;     //# Angle-of-Attack voltage in volts.  Range 0-3.3 Volts
654	float ss_v;      //# Sideslip voltage.  Range 0 - 3.3 Volts
}
729 LOG_FORMAT(AOASS, "ff", "AOA,SS")

Ran this through a build and it said there was a error in sdlog2_messages.h. Could someone look over this code and give some pointers to a fresh faced noob?

Hi,

Is it possible for you to share the branch you are working on? Then I could have a look

Here is the link to the branch

Just checking in, have you had any luck? Ran the compiler again and came up with this error.

[ 74%] Building C object src/modules/sdlog2/CMakeFiles/modules__sdlog2.dir/sdlog2.c.obj
In file included from /home/dlear002/src/FirmwareAOASS/src/modules/sdlog2/sdlog2.c:126:0:
/home/dlear002/src/FirmwareAOASS/src/modules/sdlog2/sdlog2_messages.h:656:9: error: expected identifier or ‘(’ before ‘#pragma
#pragma pack(pop)
^
compilation terminated due to -Wfatal-errors.
src/modules/sdlog2/CMakeFiles/modules__sdlog2.dir/build.make:62: recipe for target ‘src/modules/sdlog2/CMakeFiles/modules__sdlog2.dir/sdlog2.c.obj’ failed
make[3]: *** [src/modules/sdlog2/CMakeFiles/modules__sdlog2.dir/sdlog2.c.obj] Error 1
CMakeFiles/Makefile2:3998: recipe for target ‘src/modules/sdlog2/CMakeFiles/modules__sdlog2.dir/all’ failed
make[2]: *** [src/modules/sdlog2/CMakeFiles/modules__sdlog2.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs…
[ 74%] Building CXX object src/modules/vtol_att_control/CMakeFiles/modules__vtol_att_control.dir/tiltrotor.cpp.obj

Hi,

It seems to me like you have implemented your logging in a bit non standard way so I can’t tell you directly what is going wrong. However, I would suggest you to use the new logger documented here:
http://dev.px4.io/advanced-logging.html

It is much easier to add topics etc.

This looks way easier. I’m still having trouble though, I’ve made the file etc/logging/logger_topics.txt and for <topic_name> I put

<adc_report>

It says the topics in the file will replace all the default logged topics, but when I run it through my LOGCONV.m file, it still has the default topics.