Best way to view controller calc data in real time?

Ok, so I’m hacking away at the code and testing in SITL with X-plane and my crazy bicopter model but i am feeling about in the dark knowing what some of the calcs are actually doing
is there a relatively painless way of outputing variable data to somewhere - a terminal window or such like -so the guts of a calculation can be known in real time?

You may have a look here. Is it what you’re looking for ?

Thanks - yes, I’ve used the hal.console-> print function but this will flood the data link if I output ever loop. I’ve just read the link in that link and figured I need a little delay function so I can get data ever 100ms or so.

Something like this:

if (AP_HAL::millis() > tempmillis) {
unit32_t tempmillis += 100;
hal.console->printf(“love you long time”);

not sure how I can init the tempmillis, but perhaps in a .h somewhere?

It’s a dirty, unshippable hack, but a useful one is to stick it in a MAVLink message that is regularly broadcast then you can view (and live graph) it on a GCS. For example you could send it in the VFR_HUD message (make sure you pick a message that is coming with the right unit types to let you stick the value in). This works well in the simulations as you can set streamrates high enough to get smooth data. In real flight testing, this usually is a bit of a problem (as well as not being a mergable thing, and can result in confused ground stations). In general though I tend to use a combination of status texts/printing.

1 Like