Runtime plot from mavinit.scr not updating

Hello everyone,

I’m testing a new algorithm to replace the pid control laws and for that I need angular accelerations. I have implemented a filter to obtain those accelerations and I whish to plot them during runtime or log them for post flight analysis. Since I haven’t found documentation on how to add variables to the logs, I pursued the first option.

The problem: after following the DEV page tutorial to create a new mavlink message and after adding

@alias add gwdot g ANGULAR_ACCEL_FILTER.rollaccel ANGULAR_ACCEL_FILTER.pitchaccel ANGULAR_ACCEL_FILTER.yawaccel

to the mavinit.scr file, the graph doesn’t update and I really don’t know why.

If you could tell me what I’m missing or where I forgot to look, it’d be greatly appreciated.

For clarity, the mavlink message I created is:

And yes, I’ve added the message to the enum in GCS.h file in the GCS_MAVlink library, added the message also to the case in the try_send_message function in GCS_Mavlink.cpp in the Arduplane folder and finally created a function called send_wdot, similar to send_attitude, in order to send the new message.

Finally, I added the call to the sending function to the “data_stream_send” function in GCS_Mavlink.cpp.

It’s not easy, so I recommend sticking with MavLink, as it seems you have good progress. Just in case the MavLink doesn’t work out for you, open another topic or PM me and I can help with the DataFlash option.

Thank you for your reply hunt0r!

The reason for this post is really the fact that MAVLink isn’t working for me. As I said, I’ve followed the steps in the DEV documentation to create a mavlink message but still the graph won’t update during SITL simulation

You mentioned you may help me with DataFlash. Could you guide me through the process of adding the variables I need to the DataFlash memory so I can analyse them post-flight? If so, then I don’t need to solve the mavlink issure anymore.

Adding a message to DataFlash isn’t easy, but if you’re willing to go figure it out in the code, here are the big-picture steps:
0) Figure out what you want to log, and where in the codebase it’s available. If it doesn’t already exist, make a method for accessing it.

  1. In the DataFlash class, create a packet struct and a method to write data to that packet.
  2. Also in DataFlash, define the format of your loggging and its field-names, also add it to the LogMessages enum.
  3. In Plane, create (or modify) a method to log the data you want by calling the appropriate DataFlash method.

I hope this helps! Post specific questions as you find them?

1 Like

Thank you very much hunt0r for your reply.

After doing what you said, the angular accelerations are now being stored in the logs and I can use them in post flight analysis.

Although it would also be nice to be able to plot those varibles during runtime, this solution is enough for me to put the new code to work properly.

Thank you again

1 Like