RoboGeeks

Robotiq Open-Source C++ SDK for Adaptive Grippers - Environment Setup

Robotiq · Uploaded · 18:31 · Watch on YouTube

Robotiq application engineer Benoit walks through the documentation for the company's C++ SDK for adaptive grippers. He sets up a project with the SDK as a git submodule, configures MSYS2 and CMake on Windows, and builds and runs a test program from VS Code.

Transcript

Captions as a .vtt fileEmbed with the transcript

  1. 0:00Hello everyone, my name is Benoit. I'm an application engineer for physical AI at Robotic
  2. 0:06and in this video I'm going to introduce you our C++ library to control the Robotic
  3. 0:12Adaptative Grippers. So let's get started. I just accessed the Robotic GitHub repository.
  4. 0:19Robotic is providing several open source software tools to help you integrate your
  5. 0:24Robotic product into your project. So on the Robotic GitHub homepage you will see a description
  6. 0:33of the different software tool available and you have a link to access the documentation.
  7. 0:39That's what I'm going to access now. So here is the documentation website of the Robotic GitHub.
  8. 0:49You will see that the different Robotic products are listed here and for each product you can see
  9. 0:59the different software tool available for developers. And so we are going to select the C++ library for
  10. 1:07the Adaptive Robotic Grippers. So in the documentation you will find some introduction guide with
  11. 1:19like written the explanation about how to set up your environment to compile the C++ code. You will have
  12. 1:28a quick start to that explain the basic function of the package. A more detailed description about how things
  13. 1:37are working. Another example here that is more in-depth like explaining how to really properly
  14. 1:49code with the code with the library and make something robust. There is even a little guide here to explain
  15. 1:55you how to deploy the library on a specific platform like STM32. So those are the introduction guides.
  16. 2:07So it's good documentation to review to familiarize yourself with the library and we are going to go
  17. 2:15through this documentation together. There is also an API reference which gives you information about
  18. 2:23each function available in the C++ library. There is an index also like with all the listed class
  19. 2:34names, data types, variables, functions here. So you can access a different function and see the detail.
  20. 2:45The topic section organizes all those functions in groups and you can so access
  21. 2:55the documentation of all those functions. So we are going first to look together at the introduction guide
  22. 3:07and we will go through those guides and just make the exercise of deploying the C++ library together.
  23. 3:16At the first step we are going to build the environment to compile the C++ code of the library. In my case,
  24. 3:25I'm using Windows. There are some specificities due to this environment. If you are using Linux,
  25. 3:34it's quite easy to set up this environment. So let's do that. First of all, you need to
  26. 3:44create a project folder and then we are going to import in this folder the C++ library of the
  27. 3:57Robotic Adaptive Gripper as a sub-module. So I'm going to create a folder in which I will place all my C++ code.
  28. 4:09So let's call this folder gripper test. Okay, now I'm going to enter in this folder like this. We are going to
  29. 4:26initialize our project using git. So now our project folder is created. So we are going to use
  30. 4:43the sub-model command to import the C++ library as a sub-module now. So the the C++ SDK have been imported
  31. 5:03as a sub-module. So we are good. If we open the file explorer so we can see that in the gripper test
  32. 5:14project folder there is a folder called third party that has been created. Inside we can find
  33. 5:21the gripper folder which is the clone version of the Robotic C++ SDK. So now I have everything
  34. 5:34I need in my development folder to start coding. So we have now the Robotic C++ library in our project
  35. 5:48folder. Then we need to set up the compilation environment. So actually if you are using Linux
  36. 6:01Linux, the compilation environment is really native based on Linux. So you just have to compile
  37. 6:12within Linux and that's fine. For Windows it's a bit specific. We have to use a compilation environment
  38. 6:21called MSYS2 and so we are going to go through this procedure. So note that if you are using Linux or Mac
  39. 6:34you just have to execute those two lines of code here. This will install the lib serial port library
  40. 6:43and this will be used when you will compile the code. So that's just what you need to do to get
  41. 6:50everything set up on Linux. So for Windows, so as I said it's a bit specific, we need to install the
  42. 6:59MSYS2
  43. 7:03compilation environment. So we are going to access
  44. 7:07MSYS2 to install that. So we can install it using WIGGET. I am going to install it right now. So the
  45. 7:23the installation is now complete and so we can now access the MSYS2 environment. So let's open that.
  46. 7:37You can search for MSYS2 in the Windows search bar and so you will access the MSYS2 terminal like this.
  47. 7:53So we are going to follow the instruction of the documentation. So there are some codes here that you need to execute.
  48. 8:03First we are going to execute the pacman su command. So this is going to refresh
  49. 8:16the different tools that you can import in this compilation environment.
  50. 8:23So then you get a message saying that the terminal will have to close.
  51. 8:28So just say yes to the terminal close. And then you can access MSYS2 terminal again to complete the procedure.
  52. 8:43So let's look at the documentation again. So we have to install several compilation tools using pacman.
  53. 8:53So we are going to copy those instructions here. Then go back to the MSYS2 terminal.
  54. 9:03Paste those instructions and execute. So that will install all the compilation tools we need.
  55. 9:15The compilation environment for Windows is now set up. We are going back to the documentation
  56. 9:22for the next step. Now we need to explain to this compilation environment how to compile.
  57. 9:33And this is done by the cmake list file. And we are going to create this file right now.
  58. 9:41I'm using VS Code to code and organize my project. I'm going to open
  59. 9:48the folder, the project folder, the project folder we previously created.
  60. 9:55Gripper test. So now all the files of the project are loaded in VS Code.
  61. 10:07So we are going to create the cmake list file. I'm using VS Code to organize my code.
  62. 10:15So let's create the file. So cmake list.txt. I'm going to copy the example of cmake list file we have in the documentation.
  63. 10:36So next we have to create a cmake list file to explain how to do the compilation. So we are going to create this file.
  64. 10:47I'm using VS Code to organize the code of my project.
  65. 10:53So let's create the cmake list file like this.
  66. 11:05And we are going to copy the example of cmake file of the documentation and use it for our project like this.
  67. 11:19So in this cmake file, you can see we define the minimum version required.
  68. 11:26The project name is defined. It's robotic gripper app and we precise the language
  69. 11:31used. We precise the cmake version used for the compilation.
  70. 11:37We precise that we have a subdirectory to include. So this is a subdirectory where we have the C++ robotic
  71. 11:47SDK to control the adaptive gripper.
  72. 11:50And then we precise what is the name of the executable we want to compile.
  73. 11:56So the name will be your app. And we precise which file we are going to compile, which is like main.cpp.
  74. 12:04And we are going to create this file by the way.
  75. 12:09Then at the end there is a command to link the robotic gripper library.
  76. 12:15So now let's create the main.cpp file.
  77. 12:28And here we are just going to make a very simple hello world cpp file,
  78. 12:45just to see if we can compile properly. So we have done the main.cpp.
  79. 12:54So the next step will be to configure the compilation environment and then compile this first piece of code.
  80. 13:04So we are going to first configure the environments. So I'm going to open msys2.
  81. 13:20First I need to navigate to the project folder. So to do that I will go to the C drive
  82. 13:28and I will navigate to the project folder which is in my case in a users document,
  83. 13:44users then my username, then documents, github folder and the name of the project folder which is
  84. 13:56gripper tests. So we are now in the project folder. I'm going to paste the CMake instruction
  85. 14:03to configure the compilation environment like this. And then once again, so following the instructions,
  86. 14:14I'm going to copy the CMake build command and paste it to the terminal. So now the project is compiling and
  87. 14:31we can see that an executable like yourapp.exe has been created. So we can list those files here.
  88. 14:40So we can see there is a build folder that have been created where we have the compiled binaries.
  89. 14:51And inside this folder we can find the yourapp.exe file here and we can actually execute it. So
  90. 15:02like this and we can see that hello world is printed in terminal. So the compilation worked.
  91. 15:13Here we did the compilation in msys2, so in the compilation environment. But you can also compile
  92. 15:20directly from VS code and here we are going to go through the procedure to do that. So let's check the
  93. 15:28the documentation. So in the documentation we provide a compilation kit
  94. 15:36definition that you can put in VS code to say to VS code in which environment need to be
  95. 15:45you need to do the compilation. So let's copy that and add this kit in VS code. So I'm going to
  96. 16:00click on the navigation bar on top and click on show and run commands and I'm going to enter like the CMake
  97. 16:13instructions and select edit user local CMake kits. So here is the definition of different kits that
  98. 16:21VS code that VS code is using to do the compilation and we are going to paste here the the kits that is provided
  99. 16:32in the documentation like this and we are going to save the file. Then going back to the documentation you
  100. 16:44you will see that there is an instruction to select the kit that we just added to VS code. So let's do that.
  101. 16:58So we are once again going to select show and run commands and enter like CMake select a kit and here you have the list of kits
  102. 17:14that is available on VS code that is available on VS code and we are going to select the
  103. 17:18msys2 kit that we previously created. So now the the kit is selected and
  104. 17:26uh so you can select your main dot cpp file and in the bottom of VS code you can click on build
  105. 17:38it's going to build the file and you can click on the the play button and it's going to execute the the
  106. 17:52the file that have been compiled so we see the hello world. So now we can compile and execute within VS code.
  107. 17:59Here all the the manipulation we do like with the the compilation kit like this specific compilation
  108. 18:08kit that use msys2 so if you are under Linux you don't need to create a specific compilation kit using
  109. 18:16msys2 just use one of the like the compilation kit already available
Embed this video with its transcript

Paste this into your page. The frame holds the player and the transcript; the link below it says where the transcript comes from.

Discussion

You pick a name in the next step. Already a member? Log in.

A mail when somebody comments. No account needed.

The newsletter

Get our free newsletter with new robots, prices and robotics news.