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 MycobotCpp compilation and running chapter
Instantiate MyCobot
1.1 I();
Function: Instantiate MyCobot
Return value: MyCobot type, singleton instance of myCobot object
Parameter description: None
Note: When calling the following API, you do not need to instantiate separately, just call this API
Overall status of the robot Overall Status
2.1 PowerOn();
Function: Power on the robot arm
Return value: None
Parameter description: None
Note: After the robot arm is powered on, you cannot move the robot arm manually
2.2 PowerOff();
Function: Power off the robot arm
Return value: None
Parameter description: None
Note: After the robot arm is powered on, if you want to move the robot arm manually, you can call this API
2.3 SetFreeMoveMode(bool free_move = true);
Function: Set free movement mode
Return value: None
Parameter description: Turn on or off free movement, true--turn on free movement, false--turn off free movement
Note: After free movement is turned on, you can move the robot manually, and the light on the atom will turn yellow, and it will turn green when it is turned off
2.4 IsFreeMoveMode()
Function: Check whether it is in free movement mode
Return value: bool type, true-free movement is turned on, false-free movement is not turned on
Parameter description: None
2.5 IsControllerConnected();
Function: Check whether the system is normal
Return value: None
Parameter description: bool type, return false will not be able to control the robot
Input program control mode MDI Mode and Robot Control (Manual Data Input)
3.1 IsInPosition(const Coords& coords, bool is_linear = true);
Function: Check whether the robot arm has reached the specified point (angle or coordinate)
Return value: bool type, return false--not reached the specified point, return true--reached the specified point
Parameter description: Parameter 1: all angles or coordinates Parameter 2: 0 or 1 (coordinate is 1 (true), angle is 0 (false))
3.2 IsMoving();
Function: Check whether the robot arm is moving
Return value: bool type, true--moving, false--not moving
Parameter description: None
3.3 WriteAngle(Joint joint, double value, int speed = DefaultSpeed)
Function: Send single joint angle
Return value: None
Parameter description: Parameter 1: joint number (1-6) Parameter 2: angle (-170°- 170°) Parameter 3: speed (0-100), default is 30
3.4 GetAngles()
Function: Get all joint angles
Return value: Angles type
Parameter description: None
3.5 WriteAngles(const Angles& angles, int speed = DefaultSpeed)
Function: Send all joint angles
Return value: None
Parameter description: Parameter 1: All angles (std::array
3.6 WriteCoord(Axis axis, double value, int speed = DefaultSpeed)
Function: Send single parameter coordinates
Return value: None
Parameter description: Parameter 1: Coordinate number (Axis enumeration type, int: 1-6 (X-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), default is 30
3.7 GetCoords()
Function: Get all coordinates
Return value: Coords type
Parameter description: None
3.8 WriteCoords(const Coords& coords, int speed = DefaultSpeed)
Function: Send all coordinates
Return value: None
Parameter description: Parameter 1: Coordinates (X, Y, Z value range -300-300.00 unit mm RX, RY, RZ, value range -180-180), Parameter 2: Speed (0-100), default is 30
3.9 StopRobot()
Function: Stop the robot arm
When the robot arm is moving, you can call this API to stop the robot arm from moving
Return value: None
Parameter description: None
Running auxiliary information Running Status and Settings
4.1 GetSpeed()
Function: Get the speed of the robot arm movement
Return value: int type, robot arm movement speed (0-100)
Parameter description: None
4.2 SetSpeed(int percentage)
Function: Set the speed of the robot arm movement
Return value: None
Parameter description: Robot arm movement speed (0-100)
4.3 GetJointMin(Joint joint)
Function: Read the minimum angle of the joint
Return value: double type, minimum angle (the minimum angle that the joint can run to)
Parameter description: Joint number (1-6)
4.4 GetJointMax(Joint joint);
Function: Read the maximum angle of the joint
Return value: double type, maximum angle (the maximum angle that the joint can run to)
Parameter description: Joint number (1-6)
4.5 SleepSecond(unsigned time)
Function: Wait
Return value: None
Parameter description: The time unit is seconds
JOG operation and operation JOG mode and operation
5.1 JogCoord(Axis axis, int direction, int speed = DefaultSpeed)
Function: Make the robot arm move in the direction of the coordinate axis
Return value: None
Parameter description: Parameter 1: Coordinate number (1-6, x y z rx ry rz), parameter 2: direction (1--positive direction, 0--negative direction), parameter 3: speed (default is 30, range: 0-100)
Note: This API will make the robot arm move in the positive and negative directions of the coordinate axis all the time, and will stop moving after reaching the limit or calling JogStop in the middle
5.2 JogAngle(Joint joint, int direction, int speed = DefaultSpeed)
Function: Make a joint move until Jogstop or reach the limit
Return value: None
Parameter description: Parameter 1: joint number (1-6), parameter 2: direction (1--positive direction, 0--negative direction), parameter 3: speed (default is 30, range: 0-100)
Note: This API will make the robot arm joint move in the positive and negative directions all the time, and will stop moving after reaching the limit or calling JogStop in the middle
5.3 JogCoordAbsolute(Axis axis, double value, int speed = DefaultSpeed)
Function: Move a coordinate axis to a given coordinate
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 (Default 30, range: 0-100)
5.4 JogAngleAbsolute(Joint joint, double value, int speed = DefaultSpeed)
Function: Make a joint move to a given angle
Return value: None
Parameter description: Parameter 1: Joint number (1-6), Parameter 2: Angle (Range: -170-170), Parameter 3: Speed (Default 30, Range 0-100)
5.5 JogCoordIncrement(Axis axis, double increment, int speed = DefaultSpeed)
Function: Make a coordinate move to the set coordinate increment
Return value: None
Parameter description: Parameter 1: Coordinate number (1-6, x y z rx ry rz), parameter 2: coordinate increment value, parameter 3: speed (default 30, range: 0-100)
Note: The robot performs stepping motion: for example, the current x-axis coordinate is 100, the increment value is 50, and after the motion, the x-axis coordinate will be 150
5.6 JogAngleIncrement(Joint joint, double increment, int speed = DefaultSpeed)
Function: Make a joint move with a set angle increment
Return value: None
Parameter description: Parameter 1: joint number (1-6), parameter 2: joint increment value, speed (default 30, range: 0-100)
Note: The robot performs stepping motion: for example, the current joint 1 coordinate is -100, the increment value is 50, and after the motion, the joint 1 will be 50
Atom terminal IO control Atom IO Control
6.1 SetDigitalOut(int pin_number, int 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)
6.2 GetDigitalIn(int 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)
6.3 SetGriper(int open)
Function: Control adaptive gripper
Return value: None
Parameter description: Gripper switch status (0--off, 1--on)
6.4 SetElectricGriper(int open)
Function: Control electric gripper
Return value: None
Parameter description: Gripper switch status (0--off, 1--on)
Base M5Stack-basicIO Control M5Stack-basic IO Control
7.1 SetBasicOut(int pin_number, int 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: Status (0--low level, 1--high level)
7.2 GetBasicIn(int pin_number)
Function: Get input io status
Return value: Pin status (0--low level, 1--high level)
Parameter description: Pin number (basic input pin number)