ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Copter: stop using global ap variable as bitmask

Open peterbarker opened this issue 1 year ago • 2 comments

Table edited for new iterate-over-cast-structure scheme:

CubeOrange-periph-heavy  *                                                                     
CubeRedPrimary                      *      *           -448    -408              *      *      *
Durandal                            *      *           -272    -128              *      *      *
Hitec-Airspeed           *                                                                     
KakuteH7-bdshot                     *      *           -424    -360              *      *      *
MatekF405                           *      *           -376    -352              *      *      *
Pixhawk1-1M-bdshot                  *                  -416    -360              *      *      *
f103-QiotekPeriph        *                                                                     
f303-Universal           *                                                                     
iomcu                                                                *                         
revo-mini                           *      *           -384    -352              *      *      *
skyviper-v2450                                         -464                                    

Tested in SITL by generating a simple log-disarmed log and looking at the message, and using du32_change.py to see bits are changing appropriately

peterbarker avatar Oct 09 '24 01:10 peterbarker

For a simple up-and-down flight, setting log_disarmed first:

pbarker@fx:~/rc/ardupilot(pr/ap-bitmask-stop-it)$ ./Tools/scripts/du32_change.py logs/00000033.BIN 
1728616069: Creating connection
Original armed_with_airmode_switch: 0
Original auto_armed: 0
Original compass_mot: 0
Original gps_glitching: 0
Original in_arming_delay: 0
Original initialised: 1
Original initialised_params: 1
Original land_complete: 1
Original land_complete_maybe: 1
Original land_repo_active: 0
Original logging_started: 0
Original motor_interlock_switch: 0
Original motor_test: 0
Original new_radio_frame: 1
Original pre_arm_check: 1
Original pre_arm_rc_check: 1
Original prec_land_active: 0
Original rc_receiver_present_unused: 0
Original system_time_set_unused: 0
Original throttle_zero: 1
Original unused1: 0
Original unused2: 0
Original unused3: 0
Original unused_was_simple_mode bit1: 0
Original unused_was_simple_mode bit2: 0
Original usb_connected_unused: 0
Original using_interlock: 0
2024-10-11 14:06:46.23:  +in_arming_delay
2024-10-11 14:06:48.23:  -in_arming_delay
2024-10-11 14:06:49.23:  +auto_armed -throttle_zero
2024-10-11 14:06:50.23:  -land_complete -land_complete_maybe
2024-10-11 14:07:14.23:  +land_complete_maybe
2024-10-11 14:07:15.23:  +land_complete
2024-10-11 14:07:16.23:  -auto_armed
pbarker@fx:~/rc/ardupilot(pr/ap-bitmask-stop-it)$ 

peterbarker avatar Oct 11 '24 03:10 peterbarker

... and the same thing but arming the vehicle with an airmode switch (aux function 154)

pbarker@fx:~/rc/ardupilot(pr/ap-bitmask-stop-it)$ ./Tools/scripts/du32_change.py logs/00000034.BIN 
1728616318: Creating connection
Original armed_with_airmode_switch: 1
Original auto_armed: 1
Original compass_mot: 0
Original gps_glitching: 0
Original in_arming_delay: 1
Original initialised: 1
Original initialised_params: 1
Original land_complete: 1
Original land_complete_maybe: 1
Original land_repo_active: 0
Original logging_started: 0
Original motor_interlock_switch: 0
Original motor_test: 0
Original new_radio_frame: 1
Original pre_arm_check: 1
Original pre_arm_rc_check: 1
Original prec_land_active: 0
Original rc_receiver_present_unused: 0
Original system_time_set_unused: 0
Original throttle_zero: 0
Original unused1: 0
Original unused2: 0
Original unused3: 0
Original unused_was_simple_mode bit1: 0
Original unused_was_simple_mode bit2: 0
Original usb_connected_unused: 0
Original using_interlock: 0
2024-10-11 14:11:28.25:  -in_arming_delay
2024-10-11 14:11:31.25:  -auto_armed
2024-10-11 14:11:44.25:  +auto_armed +in_arming_delay
2024-10-11 14:11:46.25:  -in_arming_delay
2024-10-11 14:11:47.25:  -auto_armed

... so I think the offsets are currently correct.

peterbarker avatar Oct 11 '24 03:10 peterbarker