Copter SITL binary crashing unexplicably

I am trying to use the ArduCopter SITL binary in standalone mode for my development. I have my own glue code on top of pymavlink connecting to the binary on tcp 5760 for command and data. Inexplicably, all the time, the binary crashes with the message as below:

…/resources/arducopter_amd64_master20210527 --model quad --defaults …/resources/copter.parm --home 19.1341996,72.9121133,45,20.0 --sysid 1
Suggested EK3_BCOEF_* = 16.288, EK3_MCOEF = 0.209
Home: 19.134200 72.912113 alt=45.000000m hdg=20.000000
Starting sketch ‘ArduCopter’
Starting SITL input
Using Irlock at port : 9005
bind port 5760 for 0
Serial port 0 on TCP port 5760
Waiting for connection …
Connection on serial port 5760
Loaded defaults from …/resources/copter.parm
bind port 5762 for 2
Serial port 2 on TCP port 5762
bind port 5763 for 3
Serial port 3 on TCP port 5763
MKFIFO failed with File exists
MKFIFO failed with File exists
Smoothing reset at 0.001
bus.bus=0 address=0x55
bus.bus=1 address=0x55
bus.bus=0 address=0x38
bus.bus=0 address=0x39
bus.bus=1 address=0x38
bus.bus=1 address=0x39
bus.bus=2 address=0x38
bus.bus=2 address=0x39
bus.bus=3 address=0x38
bus.bus=3 address=0x39
bus.bus=0 address=0x38
bus.bus=0 address=0x39
validate_structures:489: Validating structures
Loaded defaults from …/resources/copter.parm
PANIC: Should not be called on invalid location
Running: sh 26162 >dumpstack_arducopter_amd64_ma 2>&1
Stack dumped
Could not attach to process. If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
/tmp/gdb.26354:2: Error in sourced command file:
No stack.

I don’t understand what’s happening. The happens everytime as soon as I set the mode to ‘GUIDED’ using pymavlink set_mode, set_mode_send(as shared here) or command_long_send(MAV_CMD_DO_SET_MODE). Of course i am waiting for the EKF to set its home location before sending the set_mode command.

Just to clarify, i get all vehicle data and parameters in my code and i am using master branch to compile my sitl binary. Attaching dumpstack_arducopter_amd64_ma.txt (313 Bytes) for reference. I copied in the directory containing sitl binary.

Can somebody help me out??? Tagging @khancyr for help.


You cannot send location that is (0, 0, 0)

@khancyr Thanks a Ton! Can I create a PR for the master which rejects the command with (0,0,0) global location requests ? I guess this should be included in the code.

We could reject or we could consider it to be “here” - we do both in the