Just for fun, I started time measurements on the APM code.
- Probe A goes high when loop() begins and the 50Hz time check is valid, low when loop() ends.
- Within function update_GPS(), Probe B goes high right before executing function GPS.update(), low when its finished.
- GPS OUT shows the serial data send from the UBLOX
Results:
- Main loop uses about ~5ms to execute. repeated every 20ms
- update_GPS function is executed every ~100ms
- UBLOX sends every ~250ms new data.
You need to be a member of diydrones to add comments!
Replies
Just ENABLE this in the APM_Config file:
// LOG_PM OPTIONAL
//
// Logs IMU performance monitoring info every 20 seconds.
// Defaults to DISABLED.
Here's the code, so you can see what's measured:
void Log_Write_Performance()
{
DataFlash.WriteByte(HEAD_BYTE1);
DataFlash.WriteByte(HEAD_BYTE2);
DataFlash.WriteByte(LOG_PERFORMANCE_MSG);
DataFlash.WriteLong(millis()- perf_mon_timer);
DataFlash.WriteInt(mainLoop_count);
DataFlash.WriteInt(G_Dt_max);
DataFlash.WriteByte(gyro_sat_count);
DataFlash.WriteByte(adc_constraints);
DataFlash.WriteByte(renorm_sqrt_count);
DataFlash.WriteByte(renorm_blowup_count);
DataFlash.WriteByte(gps_fix_count);
DataFlash.WriteInt((int)(imu_health*1000));
DataFlash.WriteByte(END_BYTE);
}