Pioneer 2 Operating Systemserver to client. Both are bit streams consisting of four main elements: a two-byteheader, a one-byte count of the number of subsequent packet bytes, the clientcommand and its arguments or the server information data bytes, and, finally, a two-byte checksum.Packet Data TypesClient commands and server information packets contain several data types, as definedin Table 3.Packet ChecksumCalculate the PSOS/P2OS client-server packet checksum by successively adding databyte pairs (high byte first) to the running checksum (initially zero), disregarding sign andoverflow. If there is an odd number of data bytes, the last byte is XORed to the low-order byte of the checksum.Table 3. P2OS Communication Packet Data TypesData Type Bytes Orderinteger 2 b0 low byte; b1 high byteword 4 b0 low byte; b3 high bytestring up to ~200,length-prefixedb0 length of string;b 1 first byte of stringint calc_chksum(unsigned char *ptr) // ptr is array of bytes{ // first is data countint n;int c = 0;n = (ptr++); /* Step over byte count */n -= 2; /* don't include checksum word */while (n > 1){c += (*(ptr)<<8) | *(ptr+1);c = c & 0xffff;n -= 2;ptr += 2;}if (n > 0)c = c ^ (int)*(ptr++);return(c);}NOTE: In P2OS, the checksum word is placed at the end of the packet, with its bytes inthe reverse order of that used for arguments and data; that is, b0 is the high byte and b1is the low byte.Packet ErrorsCurrently, P2OS ignores a client command packet whose Byte Count exceeds 200 or hasan erroneous checksum. The client should similarly ignore erroneous server informationpackets.P2OS does not acknowledge receipt of a command packet nor does it have any facilityto handle client acknowledgment of a server information packet. Consequently, Pioneerclient/server communications are as reliable as the physical communication link. Acable tether between the robot and client computer, such as a piggyback laptop,30