void NqDVL::timerCallBack(const ros::TimerEvent &) { readDVLData(); getVal(); _publisher.publish(_data); }
int main(int argc, char **argv) { int fd, i, tmp, retcode= 0; RawDVLData dvl; /* Make sure we don't forget to free anything! */ dvl.privDbgInf= NULL; /* Check that we have the appropriate number of arguments. */ if( (argc != 2 && argc != 3) || (argc == 2 && strcmp(argv[1], "-h") == 0)) { printf("Usage: %s <location> [number]\n", argv[0]); printf("Opens <location> and feeds it into dvl api, then prints [number] packet.\n"); return -1; } /* If we got a packet number, save it here */ if(argc == 3) { if( (tmp= sscanf(argv[2], "%d", &i)) == EOF || tmp == 0) { printf("invalid packet number\n"); return -1; } } else { /* Assume we want to check the first packet if we got no number */ i= 1; } /* Open the file handle that we recieved */ fd= openDVL(argv[1]); //fd= open(argv[1], O_RDONLY); /* Invalid file handle? Bail! */ if(fd == -1) { printf("\nCould not find device!\n"); retcode= -1; goto bail; } /* Go through the program, grabbing packets one at a time until we grabbed the number packet the user wanted. */ for(;i > 0;i--) { /* Check to make sure that we actually read something */ if( (tmp= readDVLData(fd, &dvl)) ) { translateError(tmp); //retcode= -1; //goto bail; } } /* Now we need to print everything! WOOOOOOOOOOOO! */ printf("Header:\n"); printHeader(dvl.privDbgInf); printf("\nFixed Leader:\n"); printFixedLeader(dvl.privDbgInf); printf("\nVariable Leader:\n"); printVariableLeader(dvl.privDbgInf); printf("\nBottom Track Data:\n"); printBTData(dvl.privDbgInf); bail: if(dvl.privDbgInf != NULL) { free(dvl.privDbgInf); } close(fd); return retcode; }