# Subscribing to AoA data to sdlog

**URL:** <https://discuss.px4.io/t/subscribing-to-aoa-data-to-sdlog/1229>\
**Category:** Uncategorized\
**Created:** [September 16, 2016, 9:24pm UTC](https://discuss.px4.io/t/subscribing-to-aoa-data-to-sdlog/1229 "2016-09-16T21:24:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deafro](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/53a042/32.png) [@Deafro](https://discuss.px4.io/u/Deafro)\
**Post date:** [September 16, 2016, 9:24pm UTC](https://discuss.px4.io/t/subscribing-to-aoa-data-to-sdlog/1229/1 "2016-09-16T21:24:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![CarlOlsson](https://discuss.px4.io/user_avatar/discuss.px4.io/carlolsson/32/4175_2.png) [@CarlOlsson](https://discuss.px4.io/u/CarlOlsson)\
**Post date:** [September 18, 2016, 7:55pm UTC](https://discuss.px4.io/t/subscribing-to-aoa-data-to-sdlog/1229/2 "2016-09-18T19:55:46Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![Deafro](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/53a042/32.png) [@Deafro](https://discuss.px4.io/u/Deafro)\
**Post date:** [September 18, 2016, 8:55pm UTC](https://discuss.px4.io/t/subscribing-to-aoa-data-to-sdlog/1229/3 "2016-09-18T20:55:01Z")

</div>

Here is the link to the branch

> **[Deafro/FirmwareAoASS](https://github.com/Deafro/FirmwareAoASS)**
>
> PX4 Pro Autopilot Software. Contribute to Deafro/FirmwareAoASS development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Deafro](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/53a042/32.png) [@Deafro](https://discuss.px4.io/u/Deafro)\
**Post date:** [September 22, 2016, 1:58pm UTC](https://discuss.px4.io/t/subscribing-to-aoa-data-to-sdlog/1229/4 "2016-09-22T13:58:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CarlOlsson](https://discuss.px4.io/user_avatar/discuss.px4.io/carlolsson/32/4175_2.png) [@CarlOlsson](https://discuss.px4.io/u/CarlOlsson)\
**Post date:** [September 22, 2016, 3:57pm UTC](https://discuss.px4.io/t/subscribing-to-aoa-data-to-sdlog/1229/5 "2016-09-22T15:57:30Z")

</div>

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](http://dev.px4.io/advanced-logging.html)

It is much easier to add topics etc.

---

<div class="post-metadata">

**Author:** ![Deafro](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/53a042/32.png) [@Deafro](https://discuss.px4.io/u/Deafro)\
**Post date:** [September 22, 2016, 6:28pm UTC](https://discuss.px4.io/t/subscribing-to-aoa-data-to-sdlog/1229/6 "2016-09-22T18:28:24Z")

</div>

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.
