myCobot API
Please import our API library before using the following function interfaces, otherwise it will not run successfully. For downloading and importing the library, please refer to the Mycobot.csharp case compilation and running section.
Prerequisites for controlling the robot arm
1.1 MyCobot(string port, int baud=115200)
Function: Instantiate MyCobot
Return value: None
Parameter description: Parameter 1: Serial port number ("COM" on Windows (such as COM30) Parameter 2: Baud rate (default is 115200)
Note: *If you want to call the following API, you need to instantiate it first
1.2 Open()
Function: Open the serial port
Return value: None
Parameter description: None
Note: To communicate with the robot arm, you need to open the serial port first
1.3 Close()
Function: Close the serial port
Return value: None
Parameter description: None
Note: At the end of the program, it is best to close the serial port
Overall operation status of the robot Overall Status
2.1 PowerOn();
Function: Power on the robot
Return value: None
Parameter description: None
Note: After the robot is powered on, it will not be possible to move the robot manually<
2.2 PowerOff()
Function: Power off the robot
Return value: None
Parameter description: None
Note: After the robot is powered on, if you want to move the robot manually, you can use this api to power off the robot
Input program control mode MDI Mode and Robot Control (Manual Data Input)
3.1 SendOneAngle(int jointNo, int angle, int speed)
Function: Send single joint angle
Return value: None
Parameter description: Parameter 1: joint number (1 - 6), Parameter 2: angle (range: -170°- 170°), parameter 3: speed (0-100)
3.2 GetAngles()
Function: Get all joint angles
Return value: Return int type array, int[], length: 6
Parameter description: None
3.3 SendAngles(int[] angles, int speed)
Function description: Send all joint angles
Return value: None
Parameter description: Parameter 1: All joint angles (range: -170°- 170°), Parameter 2: Speed (0-100)
3.4 GetCoords()
Function: Get all coordinates
Return value: Return int type array, int[], length: 6
Parameter description: None
3.5 SendCoords(int[] coords, int speed, int mode)
Function: Send multi-parameter coordinates
Return value: None
Parameter description: Parameter 1: All coordinates (X, Y, Z value range -300-300.00 unit mm RX, RY, RZ, value range -180-180), Parameter 2: Speed (0-100), Parameter 3: Mode (0 - angular, 1 - linear)
3.6 SendOneCoord(int coord, int value, int speed)
Function: Send single parameter coordinates
Return value: None
Parameter description: Parameter 1: Coordinate number (1-6(x, y, z, rx, ry, rz)), Parameter 2: Coordinate (X, Y, Z value range -300-300.00 unit mm RX, RY, RZ, value range -180-180), Parameter 3: Speed (0-100)
Atom terminal IO control Atom IO Control
4.1 SetDigitalOut(byte pin_number, byte pin_signal)
Function: Set output io high and low levels
Return value: None
Parameter description: Parameter 1: Pin number (atom output pin number), Parameter 2: Status (0--low level, 1--high level)
4.2 GetDigitalIn(byte pin_number)
Function: Get input io status
Return value: Pin status (0--low level, 1--high level)
Parameter description: Pin number (atom input pin number)
4.3 setGripperValue(byte angle, byte speed)
Function: Control adaptive gripper
Return value: None
Parameter description: Parameter 1: Gripper opening and closing angle (0-100, 0--closed, 100-open maximum angle), Parameter 2: Gripper opening and closing speed (0-100)
4.4 SetElectricGriper(byte open)
Function: Control electric gripper
Return value: None
Parameter description: Gripper switch status (0--off, 1--on)
4.5 getGripperValue()
Function: Get adaptive gripper angle
Return value: int type, return gripper angle (0--closed, 100-open maximum angle)
Parameter description: None
M5Stack-basicIO Control M5Stack-basic IO Control
5.1 SetBasicOut(byte pin_number, byte pin_signal)
Function: Set output io high and low levels
Return value: None
Parameter description: Parameter 1: pin number (basic output pin number), parameter 2: state (0--low level, 1--high level)
5.2 GetBasicIn(byte pin_number)
Function: Get input io state
Return value: pin state (0--low level, 1--high level)
Parameter description: pin number (basic input pin number)