Fault Tolerance of XBee Communication

I am on a high school robotics team, and we desperately want our robots to communicate with each other, but we are having some difficulties. Each robot has an XBee S2 connected to a Teensy 3.2 (essentially an arduino). We worked with the XBee library written by Andrewrapp. We are using the XBees in API mode. We got them so they successfully communicating; however, we want both the sending and receiving XBee to know when the communication between the XBees is successful. When the robots were within range of each other the sender received a successful status response, meaning the sender knew that the receiver successfully received the message. However, when we deliberately weakened the XBee communication by moving the XBees out of range from each other, the receiving robot successfully received a message from the sending robot, but the robot transmitting the message did not get a response that the message was successfully transmited. Is there a way that both XBees can know with 100% certainty whether the communication went through?

Unfortunately not.

It is entirely possible for a TX to reach a remote node, handled normally, but for the return ACK to not be successful so the sending node thinks TX failed. At which point you can retry but then RX node then processes the message a second time from the retry.

Some ways to account for this in your protocol.

Add a full ackowledgement at the application level rather then depending only on the low-level TX status.

Ensure dup messages from a retry don’t have a bad side effect. A message “Increase speed by 5%” is bad if retried when already received as you’ll get +10% total from the retry. A message “Set speed to 30% absolute” is OK to receive twice.

Can add a sequence counter to ignore a message already received.

any chance you could share code on reading packets in api mode (i am using arduino), working on home automation system and want to read api packets in arduino serial monitor of the xbee receiving data from another xbee in the network