(gdb) p hal_sitl_inst
$7 = {<AP_HAL::HAL> = {_vptr.HAL = 0x555555ad9690 <vtable for HAL_SITL+16>,
i2c_mgr = 0x555555b1d410 <i2c_mgr_instance>, spi = 0x555555b1d418 <spi_mgr_instance>,
wspi = 0x555555b006c0 <wspi_mgr_instance>, analogin = 0x555555b1c630 <sitlAnalogIn>,
storage = 0x555555b17ea0 <sitlStorage>, console = 0x555555b1c660 <sitlSerial0Driver>, gpio = 0x555555b1c610 <sitlGPIO>,
rcin = 0x555555b1c588 <sitlRCInput>, rcout = 0x555555b1c5a0 <sitlRCOutput>,
scheduler = 0x555555b1c540 <sitlScheduler>, util = 0x555555b1d420 <utilInstance>,
opticalflow = 0x555555b006b0 <emptyOpticalFlow>, flash = 0x555555b006b8 <emptyFlash>,
dsp = 0x555555b006a8 <dspDriver>, can = {0x0, 0x0}, static num_serial = 10 '\n', serial_array = {
0x555555b1c660 <sitlSerial0Driver>, 0x555555b1c7c0 <sitlSerial1Driver>, 0x555555b1c920 <sitlSerial2Driver>,
0x555555b1ca80 <sitlSerial3Driver>, 0x555555b1cbe0 <sitlSerial4Driver>, 0x555555b1cd40 <sitlSerial5Driver>,
0x555555b1cea0 <sitlSerial6Driver>, 0x555555b1d000 <sitlSerial7Driver>, 0x555555b1d160 <sitlSerial8Driver>,
0x555555b1d2c0 <sitlSerial9Driver>}, simstate = 0x555555b1c640 <xsimstate>},
_sitl_state = 0x555555b1c040 <sitlState>, storage_posix_enabled = true, storage_flash_enabled = false,
storage_fram_enabled = false, wipe_storage = false}
sitlRCOutput
(gdb) p *hal_sitl_inst.rcout
$9 = {_vptr.RCOutput = 0x555555ad9898 <vtable for HALSITL::RCOutput+16>, static DSHOT_ZERO_THROTTLE = 48 '0',
static ALL_CHANNELS = 255, static DSHOT_BIT_WIDTH_TICKS_DEFAULT = 8, static DSHOT_BIT_0_TICKS_DEFAULT = 3,
static DSHOT_BIT_1_TICKS_DEFAULT = 6, static DSHOT_BIT_WIDTH_TICKS_S = 11, static DSHOT_BIT_0_TICKS_S = 4,
static DSHOT_BIT_1_TICKS_S = 8, static NEOP_BIT_WIDTH_TICKS = 8, static NEOP_BIT_0_TICKS = 2,
static NEOP_BIT_1_TICKS = 6, static PROFI_BIT_0_TICKS = 7, static PROFI_BIT_1_TICKS = 14,
static PROFI_BIT_WIDTH_TICKS = 20, static LED_OUTPUT_PERIOD_US = 10000, _esc_pwm_min = 1000, _esc_pwm_max = 2000}
/////////////////////////
Old value = 1000
New value = 1001
SRV_Channel::set_output_pwm (this=0x555555b0a1b8 <copter+36952>, pwm=1001, force=false) at ../../libraries/SRV_Channel/SRV_Channel.cpp:251
251 have_pwm_mask |= (1U<<ch_num);
(gdb) bt
#0 SRV_Channel::set_output_pwm (this=0x555555b0a1b8 <copter+36952>, pwm=1001, force=false)
at ../../libraries/SRV_Channel/SRV_Channel.cpp:251
#1 0x0000555555728796 in SRV_Channels::set_output_pwm (function=SRV_Channel::k_motor1, value=1001)
at ../../libraries/SRV_Channel/SRV_Channel_aux.cpp:360
#2 0x0000555555819260 in AP_Motors::rc_write (this=0x555555bad4f0, chan=0 '\000', pwm=1001)
at ../../libraries/AP_Motors/AP_Motors_Class.cpp:103
#3 0x000055555581a249 in AP_MotorsMatrix::output_to_motors (this=0x555555bad4f0)
at ../../libraries/AP_Motors/AP_MotorsMatrix.cpp:181
#4 0x000055555581cc5f in AP_MotorsMulticopter::output (this=0x555555bad4f0)
at ../../libraries/AP_Motors/AP_MotorsMulticopter.cpp:287
#5 0x00005555555e68e5 in Mode::output_to_motors (this=0x555555b0e888 <copter+55080>) at ../../ArduCopter/mode.cpp:1003
#6 0x000055555560578e in Copter::motors_output (this=0x555555b01160 <copter>, full_push=true)
at ../../ArduCopter/motors.cpp:108
#7 0x00005555556057fd in Copter::motors_output_main (this=0x555555b01160 <copter>) at ../../ArduCopter/motors.cpp:125
#8 0x00005555555d2319 in Functor<void>::method_wrapper<Copter, &Copter::motors_output_main> (
////////

核心状态量(24 状态)
struct state_elements {
QuaternionF quat; // 姿态四元数 (4)
Vector3F velocity; // NED 速度 (3)
Vector3F position; // NED 位置 (3)
Vector3F gyro_bias; // 陀螺零偏 (3)
Vector3F accel_bias; // 加计零偏 (3)
Vector3F earth_magfield; // 地球磁场 NED (3)
Vector3F body_magfield; // 机体磁场 XYZ (3)
Vector2F wind_vel; // 风速 NE (2)
};
(gdb) p dal
$38 = (AP_DAL &) @0x555555b4b920: {_RFRH = {time_us = 106937208, time_flying_ms = 54505, _end = 0 '\000'}, _RFRF = {frame_types = 8 '\b',
core_slow = 0 '\000', _end = 0 '\000'}, _RFRN = {lat = -353632621, lng = 149165237
(gdb) p hal
$37 = (const AP_HAL::HAL &) @0x555555b1c920: {_vptr.HAL = 0x555555ad8690 <vtable for HAL_SITL+16>, i2c_mgr = 0x555555b1c410 <i2c_mgr_instance>,
spi = 0x555555b1c418 <spi_mgr_instance>, wspi = 0x555555aff6c0 <wspi_mgr_instance>, analogin = 0x55
(gdb) p AP_GPS::get_singleton()->state0.location.alt
$55 = 68406
/*
possibly send a new GPS packet
*/
void GPS::update()
{
if (!init_sitl_pointer()) {
return;
}
check_backend_allocation();
if (backend == nullptr) {
return;
}
double latitude =_sitl->state.latitude;
double longitude = _sitl->state.longitude;