I have created a custom uORB topic, that publishes GPS data (custom). The uORB topic name is gps_fake, and I have verified that the messages are being published by typing the uORB topic name in the px4 console (pxh> gps_fake). I wanted the logger to log data from this topic as well, so I added only the relavant topic names in the logger_topics.txt file present in the PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/fs/microsd/etc/logging folder, as suggested here.
The logger_topics.txt file contains the following uORB topics:
However, when I run the simulation successfully, and try to download the log files from the QGroundControl software, all the default topics are only logged. The topic gps_fake is not logged at all.
I was able to figure out the issue, I am just posting it so that someone else could benefit from this. Note that I am using SITL with gazebo, and not any hardware.
I figured out that the logs were stored in ~./ros/log/<yyyy-mm-dd>/, (specifically it was ~./ros/log/2021-04-31/ as I ran the simulation on this day) which is very different than the directory rootfs/fs/microsd/log/ which was mentioned in the documentation. I an not very sure why this was the case, but the solution worked for me. Further, in the official loggerdocumentation, the rootfs directory is asked to be put inside the directory PX4-Autopilot/build/px4_sitl_default/tmp/.
But when I put the logger_topics.txt in the directory PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/fs/microsd/etc/logging/, the logger just recorded all the default topics (my custom uORB topic wasn’t included). However, considering where the logs were stored, I put the logger_topics.txt file inside ~/.ros/etc/logging folder, and it is working perfectly now. The logger records only the topics mentioned in the file. Thus in my case, the entire PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/fs/microsd/ path was getting mapped to ~./ros/ folder for SITL.
I don’t know why this was the situation, but it finally worked.
Specifying the list of topics in the following file doesn’t override the default list of logged topics:
PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/fs/microsd/etc/logging/logger_topics.txt
I tried to use Jarvis’s solution, but I can’t find any ~/.ros or ~./ros directory
So, where does logger_topics.txt really need to go (for SITL)?
Specifically, I’m running it with the following command:
make px4_sitl_default gazebo-classic_plane