MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / start_frame

Method start_frame

libraries/AP_DAL/AP_DAL.cpp:24–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22bool AP_DAL::logging_started;
23
24void AP_DAL::start_frame(AP_DAL::FrameType frametype)
25{
26#if !APM_BUILD_TYPE(APM_BUILD_AP_DAL_Standalone) && !APM_BUILD_TYPE(APM_BUILD_Replay)
27
28 if (!init_done) {
29 init_sensors();
30 }
31
32 const AP_AHRS &ahrs = AP::ahrs();
33
34 const uint32_t imu_us = AP::ins().get_last_update_usec();
35 if (_last_imu_time_us == imu_us) {
36 _RFRF.frame_types |= uint8_t(frametype);
37 return;
38 }
39 _last_imu_time_us = imu_us;
40
41 // we force write all msgs when logging starts
42#if HAL_LOGGING_ENABLED
43 bool logging = AP::logger().logging_started() && AP::logger().allow_start_ekf();
44 if (logging && !logging_started) {
45 force_write = true;
46 }
47 logging_started = logging;
48#endif
49
50 end_frame();
51
52 _RFRF.frame_types = uint8_t(frametype);
53
54#if AP_VEHICLE_ENABLED
55 _RFRH.time_flying_ms = AP::vehicle()->get_time_flying_ms();
56#else
57 _RFRH.time_flying_ms = 0;
58#endif
59 _RFRH.time_us = AP_HAL::micros64();
60 WRITE_REPLAY_BLOCK(RFRH, _RFRH);
61
62 // update RFRN data
63 const log_RFRN old = _RFRN;
64 _RFRN.armed = hal.util->get_soft_armed();
65 _home = ahrs.get_home();
66 _RFRN.lat = _home.lat;
67 _RFRN.lng = _home.lng;
68 _RFRN.alt = _home.alt;
69 _RFRN.EAS2TAS = ahrs.get_EAS2TAS();
70 _RFRN.vehicle_class = (uint8_t)ahrs.get_vehicle_class();
71 _RFRN.fly_forward = ahrs.get_fly_forward();
72 _RFRN.takeoff_expected = ahrs.get_takeoff_expected();
73 _RFRN.touchdown_expected = ahrs.get_touchdown_expected();
74 _RFRN.ahrs_airspeed_sensor_enabled = ahrs.airspeed_sensor_enabled(ahrs.get_active_airspeed_index());
75 _RFRN.available_memory = hal.util->available_memory();
76 _RFRN.ahrs_trim = ahrs.get_trim();
77#if AP_OPTICALFLOW_ENABLED
78 _RFRN.opticalflow_enabled = AP::opticalflow() && AP::opticalflow()->enabled();
79#endif
80 _RFRN.wheelencoder_enabled = AP::wheelencoder() && (AP::wheelencoder()->num_sensors() > 0);
81 _RFRN.ekf_type = ahrs.get_ekf_type();

Callers 6

InitialiseFilterMethod · 0.45
UpdateFilterMethod · 0.45
Log_WriteMethod · 0.45
InitialiseFilterMethod · 0.45
UpdateFilterMethod · 0.45
Log_WriteMethod · 0.45

Calls 15

vehicleFunction · 0.85
opticalflowFunction · 0.85
wheelencoderFunction · 0.85
get_last_update_usecMethod · 0.80
get_soft_armedMethod · 0.80
get_trimMethod · 0.80
micros64Function · 0.50
logging_startedMethod · 0.45
allow_start_ekfMethod · 0.45
get_time_flying_msMethod · 0.45
get_EAS2TASMethod · 0.45

Tested by

no test coverage detected