Arithmetic exception

Hello all,

I found that some changed parameters lead arithmetic exceptions. I just want to inform the found cases for future if you guys want to fix them. Thanks!

  • param set GND_ABS_PRESS 0.000001
    @@@@@
    Program received signal SIGFPE, Arithmetic exception.
    0x00000000004be1a6 in GCS_MAVLINK::global_position_int_relative_alt (
    this=0x923ba0) at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:4095
    4095 return posD;
    (gdb) bt
    #0 0x00000000004be1a6 in GCS_MAVLINK::global_position_int_relative_alt (
    this=0x923ba0) at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:4095
    #1 0x00000000004be2d3 in GCS_MAVLINK::send_global_position_int (this=0x923ba0)
    at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:4108
    #2 0x00000000004be5c2 in GCS_MAVLINK::try_send_message (this=0x923ba0,
    id=MSG_LOCATION) at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:4201
    #3 0x000000000040d11f in GCS_MAVLINK_Copter::try_send_message (this=0x923ba0,
    id=MSG_LOCATION) at …/…/ArduCopter/GCS_Mavlink.cpp:294
    #4 0x00000000004b66a3 in GCS_MAVLINK::do_try_send_message (this=0x923ba0,
    id=MSG_LOCATION) at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:942
    #5 0x00000000004b6ab0 in GCS_MAVLINK::update_send (this=0x923ba0)
    at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:1088
    #6 0x00000000004b8bcc in GCS::update_send (this=0x8bc1a8 <copter+13992>)
    at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:1886
    #7 0x000000000040b0bb in Functor::method_wrapper<GCS, &GCS::update_send>
    (obj=0x8bc1a8 <copter+13992>)
    at …/…/libraries/AP_HAL/utility/functor.h:88
    #8 0x000000000047af5e in Functor::operator() (
    this=0x619e40 Copter::scheduler_tasks+1056)
    at …/…/libraries/AP_HAL/utility/functor.h:54
    #9 0x0000000000493827 in AP_Scheduler::run (this=0x8bac60 <copter+8544>,
    time_available=2500) at …/…/libraries/AP_Scheduler/AP_Scheduler.cpp:191
    #10 0x0000000000493ce4 in AP_Scheduler::loop (this=0x8bac60 <copter+8544>)

  • param set PSC_POSXY_P 0.000000000001
    @@@@@
    Program received signal SIGFPE, Arithmetic exception.
    0x0000000000447ecf in Location::offset (this=0x7fffffffd7e0,
    ofs_north=-1.01659576e+10, ofs_east=1.38510735e+10)
    at …/…/libraries/AP_Common/Location.cpp:250
    250 int32_t dlat = ofs_north * LOCATION_SCALING_FACTOR_INV;
    (gdb) bt
    #0 0x0000000000447ecf in Location::offset (this=0x7fffffffd7e0,
    ofs_north=-1.01659576e+10, ofs_east=1.38510735e+10)
    at …/…/libraries/AP_Common/Location.cpp:250
    #1 0x0000000000508be3 in AC_WPNav::get_wp_destination (this=0x931620,
    destination=…) at …/…/libraries/AC_WPNav/AC_WPNav.cpp:182
    #2 0x000000000050bfa0 in AC_WPNav_OA::get_oa_wp_destination (this=0x931620,
    destination=…) at …/…/libraries/AC_WPNav/AC_WPNav_OA.cpp:14
    #3 0x0000000000425ee1 in ModeGuided::get_wp (this=0x8bdcb8 <copter+20920>,
    destination=…) at …/…/ArduCopter/mode_guided.cpp:212
    #4 0x000000000040c750 in GCS_MAVLINK_Copter::send_position_target_global_int (
    this=0x923ba0) at …/…/ArduCopter/GCS_Mavlink.cpp:93
    #5 0x00000000004beba9 in GCS_MAVLINK::try_send_message (this=0x923ba0,
    id=MSG_POSITION_TARGET_GLOBAL_INT)
    at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:4318
    #6 0x000000000040d11f in GCS_MAVLINK_Copter::try_send_message (this=0x923ba0,
    id=MSG_POSITION_TARGET_GLOBAL_INT) at …/…/ArduCopter/GCS_Mavlink.cpp:294
    #7 0x00000000004b66a3 in GCS_MAVLINK::do_try_send_message (this=0x923ba0,
    id=MSG_POSITION_TARGET_GLOBAL_INT)
    at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:942
    #8 0x00000000004b6ab0 in GCS_MAVLINK::update_send (this=0x923ba0)
    at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:1088
    #9 0x00000000004b8bcc in GCS::update_send (this=0x8bc1a8 <copter+13992>)
    at …/…/libraries/GCS_MAVLink/GCS_Common.cpp:1886

  • param set RC3_DZ 0 && param set RC3_MAX 0 && param set RC3_MIN 0
    @@@@@
    Program received signal SIGFPE, Arithmetic exception.
    0x00000000004c0b39 in RC_Channel::get_control_mid (this=0x8ba488 <copter+6536>)
    at …/…/libraries/RC_Channel/RC_Channel.cpp:183
    183 return (((int32_t)(high_in) * (int32_t)(r_in - radio_trim_low)) / (int32_t)(radio_max - radio_trim_low));
    (gdb) bt
    #0 0x00000000004c0b39 in RC_Channel::get_control_mid (
    this=0x8ba488 <copter+6536>)
    at …/…/libraries/RC_Channel/RC_Channel.cpp:183
    #1 0x0000000000432d0f in Copter::get_throttle_mid (this=0x8b8b00 )
    at …/…/ArduCopter/radio.cpp:216
    #2 0x000000000041a9a3 in Mode::get_pilot_desired_throttle (this=
    0x8bdfd0 <copter+21712>) at …/…/ArduCopter/mode.cpp:680
    #3 0x000000000042d8a7 in ModeStabilize::run (this=0x8bdfd0 <copter+21712>)
    at …/…/ArduCopter/mode_stabilize.cpp:61
    #4 0x0000000000419835 in Copter::update_flight_mode (this=0x8b8b00 )
    at …/…/ArduCopter/mode.cpp:318
    #5 0x0000000000408fa5 in Copter::fast_loop (this=0x8b8b00 )
    at …/…/ArduCopter/Copter.cpp:266
    #6 0x000000000040ac01 in Functor::method_wrapper<Copter, &Copter::fast_loop> (obj=0x8b8b00 ) at …/…/libraries/AP_HAL/utility/functor.h:88
    #7 0x000000000047af5e in Functor::operator() (
    this=0x8bac90 <copter+8592>) at …/…/libraries/AP_HAL/utility/functor.h:54
    #8 0x0000000000493c1c in AP_Scheduler::loop (this=0x8bac60 <copter+8544>)
    at …/…/libraries/AP_Scheduler/AP_Scheduler.cpp:275
    #9 0x0000000000408f02 in Copter::loop (this=0x8b8b00 )
    at …/…/ArduCopter/Copter.cpp:230
    #10 0x000000000052ae5b in HAL_SITL::run (
    this=0x8c7140 <AP_HAL::get_HAL()::hal>, argc=10, argv=0x7fffffffdc28,
    callbacks=0x8b8b00 )
    at …/…/libraries/AP_HAL_SITL/HAL_SITL_Class.cpp:213
    #11 0x000000000040aa04 in main (argc=10, argv=0x7fffffffdc28)
    at …/…/ArduCopter/Copter.cpp:641

Please open a github issue

1 Like

Hummm I am not sure that we will fix those … those are Zero exception but shouldn’t append unless somebody explicitly set the parameters to 0 … (value <= 0.00001 are equal to 0). So in that case the user get what he want ! And normally, the GCS will trigger a out of range warning !

1 Like

I agree that the users get what they want when they intentionally change the parameters. I think that it will be nice if the GCS can show the out of range warning after arming. As you already know, ArduPilot does not check the valid range of parameters after arming/takeoff. Thanks!

I have still open an issue to discuss this with the other dev. Thanks anyway

1 Like

@khancyr @amilcarlucas Thanks!