Compass Calibration not working perfectly

Probably because PX4 waits for a heartbeat from your pymavlink setup before it is sending anything.

See this answer and the others in the topic, or this one and it’s topic.