Examples of Running C++ SDK
Compile and Run CMake Projects with QtCreator in Linux Environment
The following describes how to compile and run the example_startup.cpp example in the SDK using the QtCreator. After successful compilation and running, the teach pendant will be powered on successfully.
**Note: If the client of the SDK is connected to a real robot arm, the IP address in the code must be set to the robot arm's IP address. If the project is run on the Aubo Sim virtual machine and the client of the SDK is connected to the virtual machine, the IP address should be 127.0.0.1. **
Open the QtCreator and click "Open".
Locate the path of the C++ example in the SDK, select the CMakeLists.txt, and click "Open".
Configure the compiler.
Select and right-click the aubo_sdk_example, and click "Run CMake".
In the Build step, select "Current executable" in the Targets column.
Select the example_startup.
Compile and run the codes.
The terminal prints information, indicating that the robot arm is powered on and the brake is released successfully.
The status of the robot arm changes to Running, indicating that the robot arm is powered on and the brake is released successfully.
Compile and Run CMake projects with QtCreator in Windows Environment
The following describes how to compile and run the example_startup.cpp example in the SDK using the QtCreator. After successful compilation and running, the teach pendant will be powered on successfully.
**Note: To ensure successful communication between the client of the SDK and the robot arm, the IP address in the code must be changed to the IP address of the Aubo Sim virtual machine or the real robot arm before compilation and running. **
Open the QtCreator and click "Open".
Locate the path of the C++ example in the SDK, select the CMakeLists.txt, and click "Open".
Configure the compiler.
Select and right-click the aubo_sdk_example, and click "Run CMake".
In the Build step, enter "-j8" in the Tool arguments field and select example_startup.
Select the example_startup.
Compile and run the codes.
The console prints information.
If the information printed by the console is garbled Chinese characters, please set the codes as shown in the figure below, and then perform compilation and running again.
The teach pendant shows successful power-on.
Compile and Run CMake Projects with Visual Studio in Windows Environment
The following describes how to compile and run the example_startup.cpp example in the SDK using the Visual Studio. After successful compilation and running, the teach pendant will be powered on successfully.
**Note: To ensure successful communication between the client of the SDK and the robot arm, the IP address in the code must be changed to the IP address of the Aubo Sim virtual machine or the real robot arm before compilation and running. **
Open the Visual Studio and click “Open Local Folder”.
Find the path where the C++ examples are located in the SDK, select the “c++” folder, and click "Select Folder".
Build the configuration, and select "x64-Release".
If there is no Release mode in the VS, follow the steps below:
Step 1: Click "Manage Configuration".
Step 2: In the CMakeSettings.json file, first click the "+" icon, then select "x64-Release", and click "Select".
As shown in the figure below, the "x64-Release" configuration is successful.
If an error stating that the aubo_sdk.dll file cannot be found is reported during the compilation, move the aubo_sdk.dll to the executable program directory, that is, ../example/c++/build/bin.
Select the example_startup.exe and perform compilation and running.
The console prints information.
The teach pendant shows successful power-on.
Compile and Run non-CMake Projects with Visual Studio in Windows Environment
The following describes how to compile and run the example_startup.cpp example in the SDK using the Visual Studio. After successful compilation and running, the teach pendant will be powered on successfully.
**Note: To ensure successful communication between the client of the SDK and the robot arm, the IP address in the code must be changed to the IP address of the Aubo Sim virtual machine or the real robot arm before compilation and running. **
Open the Visual Studio and click "Open Project or Solution".
Find the path where the visual_studio.sln is located in the SDK, select the visual_studio.sln, and click "Open".
Set the project to be run as the startup project.
Taking the example_startup project as an example, in the "Solution Explorer", select the example_startup, right-click it, and click "Set as Startup Project".
Open the example_startup.cpp file, modify the robot's IP address, select "Release" or "Debug", and perform running and debugging.
If the following error occurs during the opening of the example_startup.cpp file:
Re-add the example_startup.cpp file using the following method.
Select the example_startup.cpp file, right-click it, and click "Exclude from Project".
Select the example_startup.cpp file, right-click it, click "Add", and then click "Existing Item".
Find and select the example_startup.cpp file, and click "Add".
The console prints the following information, indicating that the power-up is successful.
The teach pendant shows that power-on is successful.