Hi All,

I'm reading the wrong current pos values from my AX-12s. (Pan and tilt) It keeps spitting back the same value (- 52.17, +52.17) Even though I'm able to send it commands and move it.

Any ideas what could be wrong? My code for reading pos is as follows:

get_position(int id){

struct DXL_inst_packet instPacket;
struct DXL_status_packet statPacket;
instPacket.id = id;
instPacket.length = 4; /* Read length */
instPacket.instruction = INST_READ;
instPacket.address = P_PRESENT_POSITION_L;
instPacket.parameter[0]= 2; /* I want to read two bytes */

send_packet(&instPacket);

if(read_packet(&statPacket)!=-1)
{
int position_read_from_servo_hex = ((statPacket.parameter[1]<<8)| statPacket.parameter[0]);
if(id==PAN_ID)
return ((position_read_from_servo_hex-CENTRE_HEX_PAN)*POSITION_HEX_xTHIS_GIVES_POSITION_ RADIANS); // Return radians
else if(id==TILT_ID)
return ((position_read_from_servo_hex-CENTRE_HEX_TILT)*POSITION_HEX_xTHIS_GIVES_POSITION _RADIANS); // Return radians
}
return -1;
}

Any help would be much appreciated! I'm using Ubuntu to compile all this

Thanks again!