by billyzelsnack » Sat Jan 27, 2007 7:43 am
by billyzelsnack
Sat Jan 27, 2007 7:43 am
I guess it's about time this got it's own named thread!
My write latency problem went away if I use sync writes. Here's the current dmtalk api functions.
int dmtalk_connect( enum DMTalkApiVersion apiVersion, const char* port );
void dmtalk_disconnect( );
int dmtalk_packet_read( int valuesCapacity, unsigned char* result_servoId, unsigned char* result_error, unsigned char* result_values );
int dmtalk_packet_write( int servoId, enum DMTalkInstruction instruction, enum DMTalkAddress address, int numValues, const unsigned char* values);
int dmtalk_ping( int servoId );
int dmtalk_value_get( int servoId, enum DMTalkAddress address, int numValues, unsigned char* result_values);
int dmtalk_value_get_8( int servoId, enum DMTalkAddress address, unsigned char* result_value);
int dmtalk_value_get_16( int servoId, enum DMTalkAddress address, unsigned short* result_value);
int dmtalk_value_set( int servoId, enum DMTalkAddress address, int dataLength, const unsigned char* data, int noRead);
int dmtalk_value_set_8( int servoId, enum DMTalkAddress address, unsigned char value, int noRead);
int dmtalk_value_set_16( int servoId, enum DMTalkAddress address, unsigned short value, int noRead);
int dmtalk_value_sync_set( int servoId, const unsigned char* data );
int dmtalk_value_sync_set_8( int servoId, unsigned char value );
int dmtalk_value_sync_set_16( int servoId, unsigned short value );
int dmtalk_value_sync_set_begin( enum DMTalkAddress address, int dataLength );
int dmtalk_value_sync_set_end();
I have not measured the latency (kinda hard with just writes), but it feels pretty instantaneous. I was getting a little discouraged with the performance, but I feel a lot better after seeing this. I'm actually surprised at how large the speedup was. It literally went from 1/4 second to 'pretty instantaneous'. That 1/4 second is even with changing the return level and tweaking the commtimeouts.
Just having fast writes is not too useful for my application. I want to be reading back the positions every pose (or possible more). Hopefully I won't have to get fancy and try to write a 'sync_read' concept for the communication between the cm5 and the pc!
I guess it's about time this got it's own named thread!
My write latency problem went away if I use sync writes. Here's the current dmtalk api functions.
int dmtalk_connect( enum DMTalkApiVersion apiVersion, const char* port );
void dmtalk_disconnect( );
int dmtalk_packet_read( int valuesCapacity, unsigned char* result_servoId, unsigned char* result_error, unsigned char* result_values );
int dmtalk_packet_write( int servoId, enum DMTalkInstruction instruction, enum DMTalkAddress address, int numValues, const unsigned char* values);
int dmtalk_ping( int servoId );
int dmtalk_value_get( int servoId, enum DMTalkAddress address, int numValues, unsigned char* result_values);
int dmtalk_value_get_8( int servoId, enum DMTalkAddress address, unsigned char* result_value);
int dmtalk_value_get_16( int servoId, enum DMTalkAddress address, unsigned short* result_value);
int dmtalk_value_set( int servoId, enum DMTalkAddress address, int dataLength, const unsigned char* data, int noRead);
int dmtalk_value_set_8( int servoId, enum DMTalkAddress address, unsigned char value, int noRead);
int dmtalk_value_set_16( int servoId, enum DMTalkAddress address, unsigned short value, int noRead);
int dmtalk_value_sync_set( int servoId, const unsigned char* data );
int dmtalk_value_sync_set_8( int servoId, unsigned char value );
int dmtalk_value_sync_set_16( int servoId, unsigned short value );
int dmtalk_value_sync_set_begin( enum DMTalkAddress address, int dataLength );
int dmtalk_value_sync_set_end();
I have not measured the latency (kinda hard with just writes), but it feels pretty instantaneous. I was getting a little discouraged with the performance, but I feel a lot better after seeing this. I'm actually surprised at how large the speedup was. It literally went from 1/4 second to 'pretty instantaneous'. That 1/4 second is even with changing the return level and tweaking the commtimeouts.
Just having fast writes is not too useful for my application. I want to be reading back the positions every pose (or possible more). Hopefully I won't have to get fancy and try to write a 'sync_read' concept for the communication between the cm5 and the pc!