Difference between revisions of "CAN Communication"
(→main.cpp) |
|||
Line 13: | Line 13: | ||
===main.cpp=== | ===main.cpp=== | ||
− | You can find '''main.cpp''' in grasp directory. | + | You can find '''main.cpp''' in grasp directory. There are 3 functions you have to edit. |
+ | <br><br> | ||
+ | |||
+ | bool OpenCAN() | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
+ | // CAN open | ||
+ | int ret = command_can_open(CAN_Ch); | ||
+ | if(ret < 0) | ||
+ | { | ||
+ | printf("ERROR command_can_open !!! \n"); | ||
+ | return false; | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | <br><br> | ||
+ | |||
+ | |||
+ | static void* ioThreadProc(void* inst) | ||
+ | <syntaxhighlight lang="cpp"> | ||
+ | // -- | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | <br><br> | ||
+ | |||
+ | |||
+ | void CloseCAN() | ||
+ | <syntaxhighlight lang="cpp"> | ||
+ | // -- | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | <br><br> |
Revision as of 13:23, 2 July 2019
CAN Communication Tutorial
Please download CAN_tutorial.zip file and follow below steps. File:CAN tutorial.zip
CAN_tutorial.zip contains CMakeList.txt, README and grasp directory.
CAN_tutorial.zip contains CMakeList.txt, README and grasp directory.
This tutorial will show how to open & close CAN communication. Also, how to get position data and send pwm to operate Allegro Hand. You will follow step by step with adding sample codes.
simple diagram
Below picture shows a structure of a sample program for this tutorial.
main.cpp
You can find main.cpp in grasp directory. There are 3 functions you have to edit.
bool OpenCAN()
// CAN open int ret = command_can_open(CAN_Ch); if(ret < 0) { printf("ERROR command_can_open !!! \n"); return false; }
static void* ioThreadProc(void* inst)
// --
void CloseCAN()
// --
Whos here now: Members 0 Guests 0 Bots & Crawlers 1 |