Currently, different models support angle, coordinate, and gripper control. MyCobot320 supports adaptive gripper and electric gripper control.
For the myCobot320m5 use case, it includes zero position calibration, drag teaching, communication, etc. (based on this, control the robotic arm using RoboFlow, python, myblockly, etc.), and information retrieval (get servo atom connection status, as well as basic, atom firmware versions).
Note: For Arduino environment setup and case compilation, refer to our Gitbook documentation (https://docs.elephantrobotics.com/docs/gitbook/10-ArduinoEnv/) and the video on Bilibili (https://www.bilibili.com/video/BV1X3411W7Sn/).
This case initializes a MyCobotBasic instance, powers on the robot arm, moves joint 1 at a speed of 30 to 100°, then moves the robot arm to zero at a speed of 50. It waits for 5 seconds for the arm to complete its movement, and the program ends. Let's start by modifying the Chinese characters in the above text.
MyCobotBasic myCobot;
Angles angles = {0, 0, 0, 0, 0, 0};
void setup()
{
myCobot.setup(); // Required API
delay(100);
myCobot.powerOn(); // Power on the robot arm
delay(100);
}
void loop()
{
myCobot.writeAngle((Joint)1, 100, 30);
delay(200);
myCobot.writeAngles(angles, 50);
delay(5000);
}
This case initializes a MyCobotBasic instance, powers on the robot arm, adjusts all joints to a suitable pose at a speed of 50, then moves the end effector to z=260mm. After the action, it controls the robot arm to reach the pose specified by coords = {215.8,-42.400,209.300,-178.260, 14, -90} at a speed of 30. The parameters are x, y, z, rx, ry, rz, and the program ends.
#include <MyCobotBasic.h>
MyCobotBasic myCobot;
Coords coords = {215.8,-42.400,209.300,-178.260, 14, -90};
void setup()
{
myCobot.setup(); // Required API
delay(100);
myCobot.powerOn(); // Power on the robot arm
delay(100);
myCobot.writeAngles({2, -7, -89, 15.9, 90, 26}, 50); // Adjust all joints to a suitable pose at a speed of 50
delay(6000);
}
void loop()
{
myCobot.writeCoord((Axis)3, 260, 30); // Move the end effector to z=260mm at a speed of 30
delay(300); // Wait for a while to ensure the robot arm reaches the position
myCobot.writeCoords(coords, 30); // Move the robot arm to the specified position using coordinate control
delay(5000);
}
This case initializes a MyCobotBasic instance, powers on the robot arm, initializes the electric gripper, opens the gripper, closes the gripper, and the program ends.
#include <MyCobotBasic.h>
MyCobotBasic myCobot;
void setup()
{
myCobot.setup(); // Required API
delay(100);
myCobot.powerOn(); // Power on the robot arm
delay(100);
myCobot.InitEletricGripper(); // Initialize the electric gripper
delay(100);
}
void loop()
{
myCobot.setEletricGripper(0); // Open the gripper
delay(600);
myCobot.setEletricGripper(1); // Close the gripper
delay(600);
}
This case initializes a MyCobotBasic instance, powers on the robot arm, and initializes the adaptive gripper. Within the initialization, the gripper undergoes one opening and closing operation. Subsequently, the gripper is controlled to reach two specified positions, followed by an opening and closing action, and the program ends.
#include <MyCobotBasic.h>
MyCobotBasic myCobot;
void setup()
{
myCobot.setup(); // Required API
delay(100);
myCobot.powerOn(); // Power on the robot arm
delay(100);
GipperInit(); // Initialize the adaptive gripper
}
void loop()
{
myCobot.setGripperValue(80, 50); // Open the gripper to 80° at a speed of 50
delay(500); // Once in place, proceed to the next step
myCobot.setGripperValue(20, 50); // Open the gripper to 20° at a speed of 50
delay(500);
myCobot.setGripperState(0, 30); // Fully open the gripper at a speed of 30
delay(600);
myCobot.setGripperState(1, 30); // Fully close the gripper at a speed of 30
delay(600);
}
void GipperInit()
{
myCobot.setGripperMode(0);
delay(100);
myCobot.setGripperState(0, 100); // Fully open the gripper at a speed of 100
delay(200);
myCobot.setGripperState(1, 100); // Fully close the gripper at a speed of 100
delay(200);
}