My robot hand's strong side is now ready and tested. It moves well and fast. Its commendable over serial using python program.

Visual representation of 3 byte communication.

I'm using 3 byte packets for communication. First bit of each byte shows what type of byte it is. The whole packet contains address byte, and two number bytes. The address consists of two parts: 3 bit MCU address and 4 bit function address. I need address because I want to put several mcu-s on same communication line. The function address shows what function I want to use. Possible functions include: move x joint, ask where joint X is. Ask how much current the servos are using and so on. Number bytes are used to send one 14 bit number. So numbers from 0 to 16384 are supported. I could have used 7 bit numbers but I thought that 7 bit is not precise enough.

The hardware has potentiometers in each joint for feedback. I send the desired position over UART and software on atmega tries to move joint to there. I use soft acceleration and breaking but the software isn't perfect yet. Idea is to implement ROS support in it so I could use massive amount of inverse and forward kinematics code and 3D support in ROS.

cool, I used a similar protocol. my software current does PI control, I'll get to PID sometime. I only support 10 bit values tho. Although the addressing is individual, I put 4 loop controllers on one avr, currently they mimmic 4 individual controllers. this is so I can make larger or smaller controllers and its transparent to the software. I use rs232 comms, everything is split and merged to/from all the avrs so the protocol ensures that only one controller can reply at once.