When we connect the Tower application to a Pixhawk which also has APM Planner 2 connected we see an exception in the Tower application in a call to:
packet.payload.putUnsignedByte(target_system);
The issue is that the system ID of APM Planner 2 is 252 and the dronekit-android throws an exception since it sees the target_system as -4 which fails the following check in putUnsignedByte() when trying to send a message to APM Planner:
if(data < UNSIGNED_BYTE_MIN_VALUE || data > UNSIGNED_BYTE_MAX_VALUE){ throw new IllegalArgumentException("Value is outside of the range of an unsigned byte: " + data); }
Presumably there shouldn't be a limit in dronekit preventing it from sending Mavlink messages to system IDs > 127?
Regards