src/experiments/rescuer/DGS_MCU_Driver/DGSCyberGlove.cpp
void DGSCyberGlove::fillDataStructure(unsigned char *inBytes, DataGloveData *destStruct)
{
	// ---------- thumb
    destStruct->thumb[0]  = inBytes[1]; // rotation across palm
    destStruct->thumb[1]  = inBytes[2]; // inner phalanx
    destStruct->thumb[2]  = inBytes[3]; // outer phalanx
	// ---------- fingers (inner, middle outer phalanx for each finger)
	// index
	destStruct->index[0]  = inBytes[5];
	destStruct->index[1]  = inBytes[6];
	destStruct->index[2]  = inBytes[7];
	// middle
	destStruct->middle[0] = inBytes[8];
	destStruct->middle[1] = inBytes[9];
	destStruct->middle[2] = inBytes[10];
	// ring
	destStruct->ring[0]   = inBytes[12];
	destStruct->ring[1]   = inBytes[13];
	destStruct->ring[2]   = inBytes[14];
	// pinkie
	destStruct->pinkie[0] = inBytes[16];
	destStruct->pinkie[1] = inBytes[17];
	destStruct->pinkie[2] = inBytes[18];
	// ---------- finger-finger abductions
	destStruct->abduction[0] = inBytes[4];  // thumb-index relative abduction
	destStruct->abduction[1] = inBytes[11]; // index-middle relative abduction
	destStruct->abduction[2] = inBytes[15]; // middle-ring abduction
	destStruct->abduction[3] = inBytes[19]; // ring-pinkie abduction
	// ---------- palm arch
	destStruct->palmArch = inBytes[20];
	// ---------- wrist pitch
	destStruct->wristPitch = inBytes[21];
	// ---------- wrist yaw
	destStruct->wristYaw = inBytes[22];
}
/** 
 * CyberGloveResources::_fillDataStructure Fill data structure with bytes read
 * off the serial port.
 * Notes: 
 * (1) inBytes is an array of 24 bytes, but:
 * (2) inBytes[0] must be skipped (it is the echoed 'G' command) and so must
 * be inBytes[23] (it is the terminating 0 character)
 * (3) as a consequence of this, valid data bytes are inBytes[1] to
 * inBytes[22]
 * (4) the manual seems to fail in the description of the data bytes. The
 * correct order is the one reported is this fucntion 
 * 
 * @param inBytes The pointer to the buffer containg the byted read from the
 * serial port.
 * @param destStruct The DataGloveData struct that will accomodate the readed
 * data.
 */
:_fillDataStructure Fill data structure with bytes read
off the serial port.
Notes:
(1) inBytes is an array of 24 bytes, but:
(2) inBytes[0] must be skipped (it is the echoed 'G' command) and so must
be inBytes[23] (it is the terminating 0 character)
(3) as a consequence of this, valid data bytes are inBytes[1] to
inBytes[22]
(4) the manual seems to fail in the description of the data bytes. The
correct order is the one reported is this fucntion

@param inBytes The pointer to the buffer containg the byted read from the
serial port.
@param destStruct The DataGloveData struct that will accomodate the readed
data.
: _fillDataStructure Fill data structure with bytes read off the serial port . Notes : ( 1 ) inBytes is an array of 24 bytes but : ( 2 ) inBytes [ 0 ] must be skipped ( it is the echoed ' G ' command ) and so must be inBytes [ 23 ] ( it is the terminating 0 character ) ( 3 ) as a consequence of this valid data bytes are inBytes [ 1 ] to inBytes [ 22 ] ( 4 ) the manual seems to fail in the description of the data bytes . The correct order is the one reported is this fucntion @param inBytes The pointer to the buffer containg the byted read from the serial port . @param destStruct The DataGloveData struct that will accomodate the readed data .
void DGSCyberGlove::fillDataStructure(unsigned char *inBytes, DataGloveData *destStruct)
{
    destStruct->thumb[0]  = inBytes[1]; 
    destStruct->thumb[1]  = inBytes[2]; 
    destStruct->thumb[2]  = inBytes[3]; 
	destStruct->index[0]  = inBytes[5];
	destStruct->index[1]  = inBytes[6];
	destStruct->index[2]  = inBytes[7];
	destStruct->middle[0] = inBytes[8];
	destStruct->middle[1] = inBytes[9];
	destStruct->middle[2] = inBytes[10];
	destStruct->ring[0]   = inBytes[12];
	destStruct->ring[1]   = inBytes[13];
	destStruct->ring[2]   = inBytes[14];
	destStruct->pinkie[0] = inBytes[16];
	destStruct->pinkie[1] = inBytes[17];
	destStruct->pinkie[2] = inBytes[18];
	destStruct->abduction[0] = inBytes[4];  
	destStruct->abduction[1] = inBytes[11]; -middle relative abduction
	destStruct->abduction[2] = inBytes[15]; -ring abduction
	destStruct->abduction[3] = inBytes[19]; -pinkie abduction
	destStruct->palmArch = inBytes[20];
	destStruct->wristPitch = inBytes[21];
	destStruct->wristYaw = inBytes[22];
}
void DGSCyberGlove :: fillDataStructure ( unsigned char * inBytes , DataGloveData * destStruct ) { destStruct -> thumb [ 0 ] = inBytes [ 1 ] ; destStruct -> thumb [ 1 ] = inBytes [ 2 ] ; destStruct -> thumb [ 2 ] = inBytes [ 3 ] ; destStruct -> index [ 0 ] = inBytes [ 5 ] ; destStruct -> index [ 1 ] = inBytes [ 6 ] ; destStruct -> index [ 2 ] = inBytes [ 7 ] ; destStruct -> middle [ 0 ] = inBytes [ 8 ] ; destStruct -> middle [ 1 ] = inBytes [ 9 ] ; destStruct -> middle [ 2 ] = inBytes [ 10 ] ; destStruct -> ring [ 0 ] = inBytes [ 12 ] ; destStruct -> ring [ 1 ] = inBytes [ 13 ] ; destStruct -> ring [ 2 ] = inBytes [ 14 ] ; destStruct -> pinkie [ 0 ] = inBytes [ 16 ] ; destStruct -> pinkie [ 1 ] = inBytes [ 17 ] ; destStruct -> pinkie [ 2 ] = inBytes [ 18 ] ; destStruct -> abduction [ 0 ] = inBytes [ 4 ] ; destStruct -> abduction [ 1 ] = inBytes [ 11 ] ; destStruct -> abduction [ 2 ] = inBytes [ 15 ] ; destStruct -> abduction [ 3 ] = inBytes [ 19 ] ; destStruct -> palmArch = inBytes [ 20 ] ; destStruct -> wristPitch = inBytes [ 21 ] ; destStruct -> wristYaw = inBytes [ 22 ] ; }
CyberGloveResources::_fillDataStructure Fill data structure with bytes read
 off the serial port.
CyberGloveResources :: _fillDataStructure Fill data structure with bytes read off the serial port .
// ---------- thumb // rotation across palm // inner phalanx // outer phalanx // ---------- fingers (inner, middle outer phalanx for each finger) // index // middle // ring // pinkie // ---------- finger-finger abductions // thumb-index relative abduction // index-middle relative abduction // middle-ring abduction // ring-pinkie abduction // ---------- palm arch // ---------- wrist pitch // ---------- wrist yaw