Pioneer 2 / PeopleBot Manuel d'utilisateur Page 36

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 78
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 35
Pioneer 2 Operating System
server to client. Both are bit streams consisting of four main elements: a two-byte
header, a one-byte count of the number of subsequent packet bytes, the client
command and its arguments or the server information data bytes, and, finally, a two-
byte checksum.
Packet Data Types
Client commands and server information packets contain several data types, as defined
in Table 3.
Packet Checksum
Calculate the PSOS/P2OS client-server packet checksum by successively adding data
byte pairs (high byte first) to the running checksum (initially zero), disregarding sign and
overflow. 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 Types
Data Type Bytes Order
integer 2 b
0
low byte; b
1
high byte
word 4 b
0
low byte; b
3
high byte
string up to ~200,
length-prefixed
b
0
length of string;
b
1
first byte of string
int calc_chksum(unsigned char *ptr) // ptr is array of bytes
{ // first is data count
int 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 in
the reverse order of that used for arguments and data; that is, b
0
is the high byte and b
1
is the low byte.
Packet Errors
Currently, P2OS ignores a client command packet whose Byte Count exceeds 200 or has
an erroneous checksum. The client should similarly ignore erroneous server information
packets.
P2OS does not acknowledge receipt of a command packet nor does it have any facility
to handle client acknowledgment of a server information packet. Consequently, Pioneer
client/server communications are as reliable as the physical communication link. A
cable tether between the robot and client computer, such as a piggyback laptop,
30
Vue de la page 35
1 2 ... 31 32 33 34 35 36 37 38 39 40 41 ... 77 78

Commentaires sur ces manuels

Pas de commentaire