Code:
int convert_data(int id_limb){
char temp1[VECTOR_SIZE];
char temp2[VECTOR_SIZE];
char code;
char code_temp;
double velocities[8];
int i;
for (i=0;i<6;i++) //initializing
{
memcpy(temp1,buffer+i*VECTOR_SIZE,VECTOR_SIZE);
sscanf(temp1,"%s",temp2);
velocities[i]=atof(temp2); //
}
memcpy(&codigo_temp,buffer+6*VECTOR_SIZE,1);
sscanf(&codigo_temp,"%c",&code);
printf("\nCode %c \n",code);
return(execute_comand(velocities, code, id_limb));
}
The overall project consist of an operator sending linear and angular velocities to a robotic arm as a string of chars through the lan. As of now we need to speed up the process (it's about 0.5 ms too slow). Is there any way to optimize this particular function? For example, a way to skip the repeated calls to sscanf?
Thanks a lot