Simple Debug Statement in ArudPilot Code

How can you go about adding a debug statement to the ArduPilot code. I made some changes and wanted to log or print to screen during SITL testing.

Will the Serial.print work anywhere I put it without breaking something?

Or is there something already built into the code I can call or use?

Thanks,

-Matt

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Thanks, for all the replies definately helped a ton.

    I tired to go the route of writing my own flash log outputs in the Log.pde, just glad to know there is an easier way.

    Thanks!

  • Hi Matt,

    I have used Serial.print ('' ") for debugging quite a bit. Just pit it in a slow loop so you can read it and the digits don't flicker, and comment out other prints as needed. Like here at the end of the fast loop.

        // ------------------------------
        set_servos();

    ///test///    gcs_update();
    ///test///    gcs_data_stream_send();
        
    }

    static void medium_loop()

    Add you stuff to the medium or slow loop.

  • Developer

    Hi Matt,

    Serial.printf() will work almost everywhere (the exception is places like interrupt handlers).

    If you only want the message in SITL, then you can instead use SITL_debug(), like this:

      SITL_debug("some message\n");

    Cheers, Tridge

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…