Logging and/or plotting a new topic

Hey everybody

During my implemented algorithm, I am calculating certain parameters. Now I created a new topic for these and published the corresponding values. As far as I can tell, this worked (not sure though, but I don’t get any compile errors).

Now, I want to somehow plot these values. Therefore, I added a add_topic line in the file logger.cpp. Can this work and if not, how can I plot these topic values? Because when analyzing the resulting log files, there is my topic mentioned (after converting to a txt file), but when trying to make plots, it doesn’t come up in the list.

Does anybody can give me a hint, or maybe even a better alternative to get these parameters out of my code to analyze them? (Until now, I could only printf them to the terminal.

Thank you and regards!

1 Like


To view the value of a topic in real time use the listener command. For analyzing the log file you can use several different tools or if you prefer matlab

Thank you for your reply! I will definitely try out the listener command.

I am indeed able to analyze my log files and plot them with the use of the online tool or FlighPilot. The problem is, I am not sure how to get my newly created topic into the log file because until now I cannot plot it using e.g. FlighPilot.

I only added the topic to the logger.cpp file, is this enough?

It depends on where you added it in the file. But for testing you can also define the topics to log in a text file. But in general yes, if you can see the topic publishing using uorb top or listener then adding the one line to logger.cpp should work

Thanks for the answer. It worked indeed. I used the uorb top command and the listener command which gave me the expected values. Thus, publishing should work.

Now, I analyzed the log file and I see plots e.g. for actuator signals and so on. My new topic is listed in the FlightPlot app, too, but there are no values plotted if I select it.

Is there something else I have to consider such that the values are somehow saved in the log file? I really only added this one line add_topic(my_topic) in the logger.cpp file.

EDIT: I realised that I didn’t implement an unadvertise command, is this necessary?

Try to run ulog2csv on the .ulg file, then you will get one CSV file for every topic which should be easy to inspect

Thank you very much, it finally worked (even without running ulog2csv).

do you remember what did you do to be able to see the new topic with uorb top?
I am not able to see the new topic that I created even though the building is smooth and all the automamtically generated headers, and sources for my topic are in the build directory…