Pioneer 3™ Pioneer 2™ H8- Series Operations Manual
Pioneer 3™ Pioneer 2™ H8- Series Operations Manual
Pioneer 3™ Pioneer 2™ H8- Series Operations Manual
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
ActivMedia Robotics Operating System<br />
Data types are simple and depend on the element (see descriptions below): client<br />
commands, SIP types, and so on, are single 8-bit bytes, for example. Command<br />
arguments and SIP values may be 2-byte integers, ordered as least-significant byte<br />
always first. Some data are strings of up to a maximum 200 bytes, prefaced by a length<br />
byte. Unlike common data integers, the two-byte checksum appears with its mostsignificant<br />
byte first (opposite order).<br />
Packet Checksum<br />
Calculate the PSOS/P2OS/AROS client-server packet checksum by successively adding<br />
data byte pairs (high byte first) to a running checksum (initially zero), disregarding sign<br />
and overflow. If there is an odd number of data bytes, the last byte is XORed to the<br />
low-order byte of the checksum.<br />
int calc_chksum(unsigned char *ptr) // ptr is array of bytes<br />
{ // first is data count<br />
int n;<br />
int c = 0;<br />
n = *(ptr++); /* Step over byte count */<br />
n -= 2; /* don't include checksum word */<br />
while (n > 1)<br />
{<br />
c += (*(ptr)