Logging data to pixhawk SD card

Hello guys…

After a long time I have started working with pixhawk again. I need a bit of help with data logging to px4 sd card.

I am working the 5 hole probe and using Teensy & Probe I can get velocity , alpha and beta of the vehicle. I’m able to read this values in pixhawk telem1 port. I want this parameters also to be logged as soon as the controller is armed. Can someone point me in a direction how to do this ?

Thanks in advance

How are you reading them within PX4? If you publish the messages with uORB they can be directly logged.

Thanks man…just some doubts…

  1. How the topic is getting linked to the uORB publishing/subscribing system ? Do I need to add the topic to any topic list or something ?

  2. I’m sending the data serially to telem 1 in pixhawk and i can read the data from that port ( have written a code for that in the example section ). For publishing to the topic I can use the same code in modules with ‘#include <uORB/topics/topic_name.h>’ header right ?

  3. And for logging : " The list of logged topics can be customized with a file on the SD card. Create a file etc/logging/logger_topics.txt " , there is no etc folder on the SD card itself ! There is just the log folder . Does adding here will append the topics to the log file created when pixhwak is armed.

Thanks Dagar…I’m able to log the data to the SD card now ( by creating a file etc/logging/logger_topics.txt on the sd card ).

I would like to add my topic to the default log file generated by pixhawk. Will it work if I just add my topic to the logger.cpp ?


Yes, just keep in mind you have to keep the number of logged topics under the maximum number of file descriptors on nuttx. I think it’s currently 53 or 54.

Its not working for me. I cant identify my mistake here.

I have added the topic to logger.cpp ( in add_common_topics ) and generated the log file using logger on but when I convert it into csv file ( using ulog2csv) I cant find a file with my topic name in it.

But if I add etc/logging/logger_topics.txt and add my topic to the text file , then I can see logging taking place. But when I try generating csv file using ulog2csv it is not generating the csv file. Cant find the mistake !!

Do you see any messages in the console or if you upload the log to http://logs.px4.io/? Did you check the file descriptor limit? You’ll probably need to remove something from the default list in logger.cpp.

hello dagar

Just need a little bit of information.I’m able to log the values now ( either by adding the topic name in logger_topics.txt or adding the topic name in logger.cpp ) . But the issue is until and unless I start mu publisher code ( written as a daemon app ) explicitly , my topics wont get logged. I have to start my publisher code first ( probe_pub start ) and then start logger on in both cases so that I can get my topic values to get logged.

I want my daemon app to run once the controller is powered on ? How can I do that ?

Thanks in advance