First Experience With Mycobot280-m5stack

About the project

Record the process of using the robotic arm

Project info

Difficulty: Easy

Platforms: M5StackElephant Robotics

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Elephant Robotics myCobot-6 DOF collaborative robot Elephant Robotics myCobot-6 DOF collaborative robot x 1
M5Stack ESP32 Basic Core IoT Development Kit M5Stack ESP32 Basic Core IoT Development Kit x 1

Software apps and online services

Elephant Robotics myCobot 280 M5Stack 2023 Elephant Robotics myCobot 280 M5Stack 2023

Story

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:

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

    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.

    We can see the angles of myCobot as shown

    (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.

    (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.

    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)

    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

    Code

    Github| pymycobot

    pymycobot

    Credits

    Photo of Elephant Robotics

    Elephant Robotics

    Elephant Robotics is a technology firm specializing in the design and production of robotics, development and applications of operating system and intelligent manufacturing services in industry, commerce, education, scientific research, home and etc.

       

    Leave your feedback...