First experience with myCobot280-M5Stack



  • myCobot is a 6-DOF robotic arm from Elephant Robotics, which owns the highest cost-performance in collaborative robotic arms. This article is about the experience of using the myCobot280-M5Stack. I will program it in python, including environment building, code testing, and, development.

    Introduction

    Just as its name implies, this robot uses the M5Stack controller. So when using it, we need to build the compiled environment with a computer, and I will be using the python language to do this.
    There is an official library named pymycobot, I will use it in python to manipulate the robotic arm.

    Environment building

    Install the python environment on the computer and download the pymycobot library. Two methods are provided:

    1. A more detailed tutorial on building the python environment is available on Elephant Robotics Gitbook.
    2. Search the related tutorials on Google.
      After installing the programming environment, we download the driver library.
      pip install pymycobot
      0_1665476252556_1.png

    Controlling the robotic arm

    Get started with importing some python libraries.

    from pymycobot.mycobot import MyCobot
    import time
    

    (1)MyCobot(port,baud)

    To create an object to communicate with the myCobot.
    Port: Serial port of the robotic arm.
    Baud: Baud rate for the robotic arm.

    #The serial port of my arm is COM7, baud rate 115200.
    mc = MyCobot('COM7',115200)
    

    (2)get_angles()

    To get the angle data of all joints of myCobot.
    Return Value: The return value is a list with six elements of data, corresponding to joints 1 to 6.
    0_1665476468102_2.png
    We can see the angles of myCobot as shown
    0_1665476638997_3。1.jpg

    (3)send_angles(degree,speed)

    To send the angle and speed of movement to all joints.
    Degree: The angles of the joints are in the range of -180 to 180 and are stored in a list in the order of 1 to 6 joints respectively.
    Speed: The speed of the robotic arm during its movement to the specified angle.
    mc.send_angles([0,0,0,0,0,0],50)
    Run like this.
    demo
    Forum can't put gif

    (4)send_angle(id,degree,speed)

    To send the angle and speed to a single joint.
    Id: Integers in the range 1 to 6. It corresponds to robotic arms with 1-6 axes, respectively.
    Degree: The angles of the joints are in the range of -180 to 180 and are stored in a list in the order of 1 to 6 joints respectively.
    Speed: The speed of the robotic arm during its movement to the specified angle.
    Make a joint's movement reach a position of 90 degrees at a speed of 50.
    mc.send_angle(1,90,50)

    (5)release_all_servos()

    To unlock the robotic arm so it can swing manually at will. Note that when this command is executed, the arm will fall due to gravity, so be careful to prevent it from hitting other things.
    mc.release_all_servos()
    The robotic arm is powered on when it is controlled, and with this function, we can swing the robotic arm.
    demo2
    Forum can't put gif

    Demo

    Write a demo to make myCobot280-M5Stack dance.

    #!/usr/bin/python3
    #-*- coding: UTF-8 -*-
    from pymycobot.mycobot import MyCobot
    import time
    mc = MyCobot('COM7',115200)
    mc.send_angles([0,0,0,0,0,0],50)
    time.sleep(1)
    for count in range(3):
      mc.send_angles([87.8,(-51.5),60.9,11.95,(-15.9),(-6.06)],50)
      time.sleep(1)
      mc.send_angles([87.97,42.01,(-45.26),10.37,(-15.9),(-6.06)],50)
      time.sleep(1)
    mc.send_angles([19.77,79.36,(-114.34),39.63,(-15.9),(-6.06)],50)
    time.sleep(1)
    for count2 in range(4):
      mc.send_angles([43.24,93.42,(-140.88),48.07,60.64,(-6.06)],50)
      time.sleep(1)
      mc.send_angles([19.77,79.36,(-114.34),39.63,(-15.9),(-6.06)],50)
      time.sleep(1)
    

    demo3
    This is the end of myCobot280-M5Stack first experience.
    If you like this article, please give me a like or leave a comment to support it. Thank you!

    Github | pymycobot



  • This looks great.
    Hope you can share more of your operating experience!



  • Can I develop the M5Stack basic module by myself? In the case of keeping mycobot connected to the computer.



  • I also have a myCobot and look forward to you sharing more of your experiences and sharing them together sometime!



  • @kehu Of course,You can try out various developments and feel free to contact us if you come across mycobot280 that you cannot manipulate.