Compiling and Running of a MycobotCpp Case

1 Downloading

1.1 Downloading source code

Download Mycobot.csharp from github.

1.2 Downloading a dynamic library

To run the case, you need to use this dynamic library, which encapsulates the API to control the robot arm:

  • Select the latest version, as shown in the following figure:
    9-1-2.1-001

  • The dynamic library is divided into two versions: Windows (Windows is divided into .net and .net framework. For the way to distinguish them, see running under Windows below) and Raspberry Pi system, as shown in the following figure.
    9-1-2.1-002
    1 适用于树莓派机械臂系统
    2 适用于Windows系统

    2 Running in Windows

2.1 Directly running the Mycobot.csharp case downloaded from github.

  • Double-click Mycobot.csharp.sln to open it (Make sure that vs2019 has been installed in the computer. If not, see 9.1 Environment building)
    9-2-2.1-001

  • Compile and run the project, and check the serial port number of the robot arm. If it is inconsistent with the example, modify the serial port number, as shown in the picture below.
    pic

2.2 Calling a Mycobot.csharp dynamic library in your own project

  • Check the target frame of the project, and then download the dynamic library corresponding thereto. If the target frame is .net core, download net core/Mycobot.csharp.dll; if it is .net framework, download net framework/Mycobot.csharp.dll )
    pic
  • Import Mycobot.csharp.dll into the project.
    pic
  • Add system.io.ports to .csproj (the project name, and the file is located in the directory of the project), as shown in the picture below:
    frame: .net core
    9-2-2.2-003
    frame: .net framework
    9-2-2.2-004
  • For the use of library functions, see 9.7 Mycobot API, 9.8 Use Cases and the separate use of joints, coordinates, etc. in the following chapters.

2.3 Problems

Problems that may be encountered during use:

  • Problem: System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies… Solution: update your sdk (if .net core, update to 5.0 and choose, if .net framework update to 4.0 and choose 4.7.2), watch the following animation:
    pic
  • Problem: System.IO.FileNotFoundException: "Could not load file or assembly 'System.IO.Ports, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Solution: See the step 3 of 9.2.2.2 above.

3 Running in the Raspberry Pi robot arm

  • Create a C# console application;
  • copy the program.cs and paste it to the application;
  • change the port number in program.cs to /dev/ttyAMA0 (MyCobot mc = new MyCobot(“/dev/ttyAMA0”));
    9-2-3-001
  • change the compilation method to Release ;
    9-2-3-002
  • Add the Mycobot.csharp.dll library file to the project, library: ReFerences–>Edit References–>.Net Assembly–>Browse(path for .dll)
    pic
  • Run it. Note: compile and run it. For the whole operation process, watch the the following animation.
    pic

results matching ""

    No results matching ""