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