Compiling and running of mycobotCpp

1 Downloading

1.1 Downloading source code

Download MycobotCpp on github.

1.2 Dynamic library downloading

Dependency library downloading (Download the latest version, and pay attention to select Windows or Linux; the is the library required by Windows, and .tar.gz is the library required by Linux).

2 Running in Windows

2.1 Compiling

In vs2019, open MycobotCpp, select x64-Release to compile (which is next to the startup item. If there is no x64-Release, click the drop-down box -> Manage configuration to add it), at the same time select release in the configuration of cmake setting, and finally click Generate. Note: Be sure to select x64-Release to compile, as shown in the following figure.


2.2 Running

  • Add library files: add .lib to myCobotCpp/lib. Add .lib and .dll to the directory, of myCobotCppExample.exe, at the same level, such as out/build/x64-Release/bin (The two files .lib and .dll are in the myCobotCpp-0.0.3-windows-msvc-x86_64. zipped package).

  • Running: Select the startup item (which is next to the green play button and also to the running button), drop down to select myCobotCppEXample.exe (bin.exe), and click Run, as shown in the following figure: pic

2.3 Common problems and solutions.

Run-time error:

  • If myCobotCpp.dll is missing, put myCobotCpp.dll previously saved in the lib directory to the directory where mycobotcppexample.exe is located.

  • If QT5Core.dll is reported to be missing, open the qt command (search for QT in the menu bar) and select msvc 2017 64 -bit, execute the directory where windeployqt –release myCobotCppExample.exe is located (for example: windeployqt –release D:201964-Release). If the VS installation path cannot be found after executing the command here, check the settings of VS environment variable.

  • After executing the above steps, if the qt5serialport.dll file is reported to be missing, copy the file in the qt installation directory (such as: D:5.12.10\5.12.102017_64) to the directory where myCobotCppExample.exe is located.

3 Running in Linux

3.1 Compiling and building

  • mkdir build && cd build
  • cmake ..
  • cmake –build .

3.2 Run

  • copy all .so files to the lib directory;
  • command line run: ./bin/myCobotCppExample (Here it is running in the build directory).

4 For example, running on Ubuntu20.04

4.1 Compiling

  • mkdir build && cd build
  • cmake ..
  • cmake –build .

    4.2 run

  • copy all .so files to the lib directory (Note: after downloading, unzip it. Do not unzip it in Windows, and then copy to Ubuntu. Unzip it directly in Ubuntu, such as: tar -xvf and then drag the file directly to the terminal);
  • Soft-link (in the QT installation directory, such as: /home/"username"/Qt5.12.10/5.12.10 /gcc_64/lib) to mycobotcpp/build/bin (Do not copy directly). The command is as follows (Be careful to choose your path): ln -s /home/"username"/Qt5.12.10/5.12.10/gcc_64/ lib/ /home/“username”/myCobotCpp/build/bin/

    4.3 Common problems and solutions

  • Error during compilation: QTDIR is not found. Solution: Check whether QTDIR is configured correctly. You may check it in the command line output: echo $QTDIR
  • run-time error: Serial port problem: The serial port cannot be opened. Solution: Modify the permission for the serial port of the robot arm. You cannot directly chmod..., because the permission must be modified every time of restart. Modify the file directly:
    • cd /etc/udev/rules.d
    • sudo gedit 20-usb-serial.rules
    • Add in the file: KERNEL=="ttyUSB*" MODE="0777"
  • The file cannot be found: such as could not be opened or found.
    Solution: Check the running step 2 above.


    If you don't use cmake to compile, and if you use it directly in MFC, do configurations as shown in the figure below.


results matching ""

    No results matching ""