def makePacket(ID, instr, reg=None, params=None):
pkt = []<EOL>pkt += [<NUM_LIT>, <NUM_LIT>, <NUM_LIT>]  <EOL>pkt += [<NUM_LIT>]  <EOL>pkt += [ID]<EOL>pkt += [<NUM_LIT>, <NUM_LIT>]  <EOL>pkt += [instr]  <EOL>if reg:<EOL><INDENT>pkt += le(reg)  <EOL><DEDENT>if params:<EOL><INDENT>pkt += params    <EOL><DEDENT>length = le(len(pkt) - <NUM_LIT:5>)  <EOL>pkt[<NUM_LIT:5>] = length[<NUM_LIT:0>]  <EOL>pkt[<NUM_LIT:6>] = length[<NUM_LIT:1>]  <EOL>crc = crc16(pkt)<EOL>pkt += le(crc)<EOL>return pkt<EOL>
This makes a generic packet.

TODO: look a struct ... does that add value using it?

0xFF, 0xFF, 0xFD, 0x00, ID, LEN_L, LEN_H, INST, PARAM 1, PARAM 2, ..., PARAM N, CRC_L, CRC_H]
in:
        ID - servo id
        instr - instruction
        reg - register
        params - instruction parameter values
out: packet