Difference between revisions of "BHand library"
(Created page with "===BHand Library=== You will make.... <br><br> Initialize CAN I/O thread and start. <syntaxhighlight lang="cpp"> // Open a CAN data channel bool OpenCAN() { printf(">CAN(...") |
|||
Line 46: | Line 46: | ||
return true; | return true; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br><br> | <br><br> |
Revision as of 09:59, 3 July 2019
BHand Library
You will make....
Initialize CAN I/O thread and start.
// Open a CAN data channel bool OpenCAN() { printf(">CAN(%d): open\n", CAN_Ch); // CAN open int ret = command_can_open(CAN_Ch); if(ret < 0) { printf("ERROR command_can_open !!! \n"); return false; } // initialize CAN I/O thread ioThreadRun = true; pthread_create(&hThread, NULL, ioThreadProc, 0); printf(">CAN: starts listening CAN frames\n"); // set periodic communication parameters(period) printf(">CAN: Comm period set\n"); short comm_period[3] = {3, 0, 0}; // millisecond {position, imu, temperature} ret = command_set_period(CAN_Ch, comm_period); if(ret < 0) { printf("ERROR command_set_period !!! \n"); command_can_close(CAN_Ch); return false; } // servo on printf(">CAN: servo on\n"); ret = command_servo_on(CAN_Ch); if(ret < 0) { printf("ERROR command_servo_on !!! \n"); command_set_period(CAN_Ch, 0); command_can_close(CAN_Ch); return false; } return true; }
Whos here now: Members 0 Guests 0 Bots & Crawlers 1 |