yahboom
HomeTutorialsProduct
Solution
Blog
Online Store
About Us
EN/中文
Store
myCobot 320 Arm📖
1.Product Feature
  • 1.Functional Parameters
  • 2.Controller Parameters
  • 3.Structural Parameters
  • 4.Electronic Parameters
  • 5.Coordinate System
  • 6.Introduction of Adaptive Gripper
  • 7.Introduction of force-controlled gripper
2.Common Problem
  • 1.how to ask
  • 2.driver
  • 3.software
  • 4.hardware
3.First Install and Use
  • 1.Product Standard List
  • 2.Product Unboxing Guide
  • 3.Power-on Test Guide
4.Basic Application
1. miniRoboFLow
  • 1. miniRoboFLow
  • 2. Drag & Play
  • 3. Joint Calibration
  • 4. Computer Connect
  • 5. Robot Information
2.1 myblockly
  • 1. What is myBlockly
  • 2. Preparations before using myBlockly
  • 3. myBlockly download and install
  • 4. myBlockly interface display and use of basic functions
  • 5. Control RGB light panel
  • 6. Control the robotic arm to return to the origin
  • 7. Control single joint movement
  • 8. Control multiple joints
  • 9. Use of adaptive grippers
  • 10. Use of force-controlled grippers
  • 11. Q&A
  • 12. API
2.2 myStudio
  • 1. myStudio
  • 2. myStudio environment setup
  • 3. Install driver
  • 4. Burn and update firmware
3. Firmware Description
  • 1.Firmware Description
  • 2.Burn Firmware
5.Mobile APP control
  • Mobile APP control
6.SDK Development
1.Development Environment Construction
  • 1.Development Environment Construction
2.Python
  • 1.What is Python
  • 2.Environment Building
  • 3.Python API usage instaructions
  • 4.TCP IP
  • 5.Drag to teach
  • 6.Use Cases
  • 7.Use of adaptive grippers
  • 8.Use of force-controlled grippers
3.ROS1
  • 1.ROS
  • 2.Environment Building
  • 3.ROS basics
  • 4.Rviz use
  • 5.Basic function case
  • 6.Use of adaptive grippers
  • 7.Use of force-controlled grippers
4.ROS2
  • 1.ROS2 introduction
  • 2.Environment Building
  • 3.ROS2 basics
  • 4.Rviz2 use
  • 5.Basic function case
5.C Sharp(C#)
  • 1.C#
  • 2.Environmental construction
  • 3.Mechanical control
  • 4.myCobot API
  • 5.Use Cases
  • 6.Use of adaptive grippers
6.c plus plus (C++)
  • 1.C++
  • 2.CPlus Download
  • 3.build
  • 4.API
  • 5.example
7.Arduino
  • 1.Arduino
  • 2.Arduino Download
  • 3.API
  • 4.example
  • 5.Use of adaptive grippers
8.Serial communication
  • 1.Serial communication
  • 2.Use of force-controlled grippers
7.Documents Download
  • 1.Product Brochure
  • 2.Software and Source Code
  • 3.System lnformation
Download
  • 3D_Model_File
  • Android Mobile APP
  • Manual
Download ZIP

Welcome to myCobot 320 Arm repository

5.example

example

one.Joint control

In this case, the machine will be powered on first, and then the current Angle will be read. After that, the minimum Angle and maximum Angle of joint 1 will be read for single joint Angle control and multi-joint Angle control, and then the specified joint motion, the point motion of absolute position and the point motion of incremental position will be carried out in jog movement. All of the motions mentioned above will print out motion information.

xxxxxxxxxx
int main(int argc, char* argv[]) {
try {
    QCoreApplication a(argc, argv);
    using namespace std::chrono_literals;

    if (!mycobot::MyCobot::I().IsControllerConnected()) {
        std::cerr << "Robot is not connected\n";
        exit(EXIT_FAILURE);
    }

    std::cout << "Robot is connected\n";
    mycobot::MyCobot::I().PowerOn(); // Power on the robot
    mycobot::MyCobot::I().StopRobot(); // Stop the robot
    std::cout << "Robot is moving: " << mycobot::MyCobot::I().IsMoving() << "\n"; // Check if the robot is moving

    mycobot::Angles angles = mycobot::MyCobot::I().GetAngles(); // Get the current angles of the robot
    std::this_thread::sleep_for(200ms);
    mycobot::Coords coords = mycobot::MyCobot::I().GetCoords(); // Get the current coordinates of the robot
    angles = mycobot::MyCobot::I().GetAngles(); // Get the current angles of the robot
    std::cout << "[" << angles[mycobot::J1] << ", " << angles[mycobot::J2] << ", " << angles[mycobot::J3] << ", "
              << angles[mycobot::J4] << ", " << angles[mycobot::J5] << ", " << angles[mycobot::J6] << "]";

    mycobot::MyCobot::I().WriteAngle(mycobot::Joint::J1, 10, 30); // Send single joint angle

    while (mycobot::MyCobot::I().IsMoving()) { // Check if the robot has reached the target angle
        angles = mycobot::MyCobot::I().GetAngles();
        std::cout << "Current joint angles" << "[" << angles[mycobot::J1] << ", " << angles[mycobot::J2] << ", "
                  << angles[mycobot::J3] << ", " << angles[mycobot::J4] << ", "
                  << angles[mycobot::J5] << ", " << angles[mycobot::J6] << "]" << std::flush;
        std::this_thread::sleep_for(200ms);
    }


    mycobot::Angles goal_angles = { 5, 5, 5, 5, 5, 5 }; // Define a set of angles
    mycobot::MyCobot::I().WriteAngles(goal_angles); // Send joint angles

    while (mycobot::MyCobot::I().IsMoving()) { // Check if the robot has reached the angles
        angles = mycobot::MyCobot::I().GetAngles();
        std::cout << "Current angles" << "[" << angles[mycobot::J1] << ", " << angles[mycobot::J2] << ", "
                  << angles[mycobot::J3] << ", " << angles[mycobot::J4] << ", "
                  << angles[mycobot::J5] << ", " << angles[mycobot::J6] << "]" << std::flush;
        std::this_thread::sleep_for(200ms);
    }


    mycobot::MyCobot::I().GetJointMin(mycobot::Joint::J1); // Read the minimum joint angle
    std::cout << "Current joint angle" << "[" << angles[mycobot::J1]  << "]" << std::flush;
    std::this_thread::sleep_for(200ms);

    mycobot::MyCobot::I().GetJointMax(mycobot::Joint::J1); // Read the maximum joint angle
    std::cout << "Current joint angle" << "[" << angles[mycobot::J1]  << "]" << std::flush;
    std::this_thread::sleep_for(200ms);

    // Jog motion on a specified joint
    mycobot::MyCobot::I().JogAngle((mycobot::Joint)0, 100, 5);
    std::this_thread::sleep_for(200ms);
    while (mycobot::MyCobot::I().IsMoving()) { // Check if the motion is completed
        angles = mycobot::MyCobot::I().GetAngles();
        std::cout << "Performing specified motion, current angle of joint 1" << "[" << angles[mycobot::J1] << "]"
                  << std::flush;
        std::this_thread::sleep_for(200ms);
    }


    // Jog motion with incremental position on a specified joint
    mycobot::MyCobot::I().JogAngleIncrement((mycobot::Joint)0, 5, 180);
    std::this_thread::sleep_for(200ms);

    while (mycobot::MyCobot::I().IsMoving()) { // Check if the motion is completed
        angles = mycobot::MyCobot::I().GetAngles();
        std::cout << "Performing incremental motion, current angle of joint 1" << "[" << angles[mycobot::J1] << "]"
                  << std::flush;
        std::this_thread::sleep_for(200ms);
    }

    std::this_thread::sleep_for(5000ms); // Delay function
    mycobot::MyCobot::I().StopRobot(); // Stop the robot

    std::cout << "\n";
    exit(EXIT_SUCCESS); // Exit with success
} catch (std::error_code&) {
    std::cerr << "System error. Exiting.\n";
    exit(EXIT_FAILURE);
} catch (...) {
    std::cerr << "Unknown exception thrown. Exiting.\n";
    exit(EXIT_FAILURE);
}

return 0;
}

two.Coordinate control

In this case, the machine will be powered on first, and then the current coordinates will be read. After that, the single coordinate control and multiple coordinate control will be carried out, and then the specified joint coordinate movement in jog motion, the coordinate point movement of absolute position and the coordinate point movement of incremental position will be carried out. All of the motions mentioned above will print out motion information.

xxxxxxxxxx
int main(int argc, char* argv[]) {
try {
    QCoreApplication a(argc, argv);
    using namespace std::chrono_literals;

    if (!mycobot::MyCobot::I().IsControllerConnected()) {
        std::cerr << "Robot is not connected\n";
        exit(EXIT_FAILURE);
    }

    std::cout << "Robot is connected\n";
    mycobot::MyCobot::I().PowerOn(); // Power on the robot
    mycobot::MyCobot::I().StopRobot(); // Stop the robot
    std::cout << "Robot is moving: " << mycobot::MyCobot::I().IsMoving() << "\n";
    mycobot::Angles angles = mycobot::MyCobot::I().GetAngles(); // Get current joint angles
    std::this_thread::sleep_for(200ms);
    mycobot::Coords coords = mycobot::MyCobot::I().GetCoords(); // Get current coordinates
    std::cout << "Coordinates before motion" << "[" << coords[mycobot::Axis::X] << ", " << coords[mycobot::Axis::Y] << ", " << coords[mycobot::Axis::Z] << ", "
        << coords[mycobot::Axis::RX] << ", " << coords[mycobot::Axis::RY] << ", " << coords[mycobot::Axis::RZ] << "]";

    // Send single-parameter coordinates
    mycobot::Coords goal_coords = { 90, 0, 0, 0, 0, 0 }; // Define target coordinates
    mycobot::MyCobot::I().WriteCoord(mycobot::Axis::X, 90, 180); // Send target coordinates
    while (!mycobot::MyCobot::I().IsInPosition(goal_coords, false)) {
        coords = mycobot::MyCobot::I().GetCoords(); // Get current coordinates
        std::cout << "Coordinates after single-parameter motion" << "[" << coords[mycobot::Axis::X] << ", " << coords[mycobot::Axis::Y] << ", "
            << coords[mycobot::Axis::Z] << ", " << coords[mycobot::Axis::RX] << ", "
            << coords[mycobot::Axis::RY] << ", " << coords[mycobot::Axis::RZ] << "]" << std::flush;
        std::this_thread::sleep_for(200ms);
    }

    // Send all coordinates
    goal_coords = { 100, 100, 0, 0, 0, 0 }; // Define target coordinates
    mycobot::MyCobot::I().WriteCoords(goal_coords, 30);
    while (!mycobot::MyCobot::I().IsInPosition(goal_coords, false)) {
        coords = mycobot::MyCobot::I().GetCoords(); // Get current coordinates
        std::cout << "Coordinates after all-coordinates motion" << "[" << coords[mycobot::Axis::X] << ", " << coords[mycobot::Axis::Y] << ", "
            << coords[mycobot::Axis::Z] << ", " << coords[mycobot::Axis::RX] << ", "
            << coords[mycobot::Axis::RY] << ", " << coords[mycobot::Axis::RZ] << "]" << std::flush;
        std::this_thread::sleep_for(200ms);
    }

    // Jog motion on a specified coordinate axis
    mycobot::MyCobot::I().JogCoord(mycobot::Axis::X, 1, 30);
    while (mycobot::MyCobot::I().IsMoving()) {
        coords = mycobot::MyCobot::I().GetCoords(); // Get current coordinates
        std::cout << "Coordinates after jogging on specified axis" << "[" << coords[mycobot::Axis::X] << ", " << coords[mycobot::Axis::Y] << ", "
            << coords[mycobot::Axis::Z] << ", " << coords[mycobot::Axis::RX] << ", "
            << coords[mycobot::Axis::RY] << ", " << coords[mycobot::Axis::RZ] << "]" << std::flush;
        std::this_thread::sleep_for(200ms);
    }

    // Jog motion with incremental position on a specified coordinate axis
    mycobot::MyCobot::I().JogCoordIncrement(mycobot::Axis::X, 30, 30);
    while (mycobot::MyCobot::I().IsMoving()) {
        coords = mycobot::MyCobot::I().GetCoords(); // Get current coordinates
        std::cout << "Coordinates after incremental jogging on specified axis" << "[" << coords[mycobot::Axis::X] << ", " << coords[mycobot::Axis::Y] << ", "
            << coords[mycobot::Axis::Z] << ", " << coords[mycobot::Axis::RX] << ", "
            << coords[mycobot::Axis::RY] << ", " << coords[mycobot::Axis::RZ] << "]" << std::flush;
        std::this_thread::sleep_for(200ms);
    }

    mycobot::MyCobot::I().JogAngle(mycobot::Joint::J1, 1, 5);
    std::this_thread::sleep_for(5000ms);
    mycobot::MyCobot::I().StopRobot();

    std::cout << "\n";
    exit(EXIT_SUCCESS);
} catch (std::error_code&) {
    std::cerr << "System error. Exiting.\n";
    exit(EXIT_FAILURE);
} catch (...) {
    std::cerr << "Unknown exception thrown. Exiting.\n";
    exit(EXIT_FAILURE);
}

return 0;
}

tree.IO control

In this example, the machine will be powered on first, the io output will be set, 2, 5, 26 are m5 output pins,35, 36 are m5 input pins, and atom output pins 23, 33 output high level, and read the level information of atom input pins 22, 19.

​x
int main(int argc, char* argv[])
{
    try {
        QCoreApplication a(argc, argv);
        using namespace std::chrono_literals;
        if (!mycobot::MyCobot::I().IsControllerConnected()) {
            std::cerr << "Robot is not connected\n";
            exit(EXIT_FAILURE);
    }
    std::cout << "Robot is connected\n";
    mycobot::MyCobot::I().PowerOn();
    mycobot::MyCobot::I().SleepSecond(1);

    mycobot::MyCobot::I().SetBasicOut(2, 1);
    mycobot::MyCobot::I().SleepSecond(1);
    mycobot::MyCobot::I().SetBasicOut(5, 1);
    mycobot::MyCobot::I().SleepSecond(1);
    mycobot::MyCobot::I().SetBasicOut(26, 1);
    mycobot::MyCobot::I().SleepSecond(1);

    for (int i = 0; i < 2; i++) {
        std::cout << "35= " << mycobot::MyCobot::I().GetBasicIn(35) << std::endl;
        mycobot::MyCobot::I().SleepSecond(1);
        std::cout << "36= " << mycobot::MyCobot::I().GetBasicIn(36) << std::endl;
        mycobot::MyCobot::I().SleepSecond(1);
    }

    /*mycobot::MyCobot::I().SetDigitalOut(23, 1);
    mycobot::MyCobot::I().SleepSecond(1);
    mycobot::MyCobot::I().SetDigitalOut(33, 1);
    mycobot::MyCobot::I().SleepSecond(1);*/

    for (int i = 0; i < 2; i++) {
        std::cout << "22= " << mycobot::MyCobot::I().GetDigitalIn(22) << std::endl;
        mycobot::MyCobot::I().SleepSecond(1);
        std::cout << "19= " << mycobot::MyCobot::I().GetDigitalIn(19) << std::endl;
        mycobot::MyCobot::I().SleepSecond(1);
    }

    mycobot::MyCobot::I().StopRobot();
    std::cout << "Robot is moving: " << mycobot::MyCobot::I
    std::this_thread::sleep_for(5000ms);
    mycobot::MyCobot::I().StopRobot();

    std::cout << "\n";
    exit(EXIT_SUCCESS);
    } catch (std::error_code&) {
    std::cerr << "System error. Exiting.\n";
    exit(EXIT_FAILURE);
    } catch (...) {
    std::cerr << "Unknown exception thrown. Exiting.\n";
    exit(EXIT_FAILURE);
    }
}
API
Arduino

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文