Code Monkey home page Code Monkey logo

pymycobot's Introduction

This is Python API for ElephantRobotics product

Python 2.7 Python 3 pypi_version

This is a python API for serial communication with mycobot and controlling it.

home

Installation

Notes:

Make sure that Atom is flashed into the top Atom, Transponder is flashed into the base Basic.
The firmware Atom and Transponder download address: https://github.com/elephantrobotics/myCobot/tree/main/Software
You also can use myStudio to flash them, myStudio address: https://github.com/elephantrobotics/myStudio/releases

Pip

pip install pymycobot --upgrade

Source code

git clone https://github.com/elephantrobotics/pymycobot.git <your-path>
cd <your-path>/pymycobot
# Install
[sudo] python2 setup.py install
# or
[sudo] python3 setup.py install

Or the more modern form:

# Install
pip install .
# Uninstall
pip uninstall .

## Usage:

```python
from pymycobot import MyCobot, Angle, Coord
from pymycobot import PI_PORT, PI_BAUD # For raspberry pi version of mycobot.

The demo directory stores some test case files.

You can find out which interfaces pymycobot provides in pymycobot/README.md.

Please go to here.

pymycobot's People

Contributors

2929ss avatar 3110 avatar anla-xu avatar blcuwc avatar eacousineau avatar fedorenchik avatar huangdou77 avatar mrkun5018 avatar nakano16180 avatar roggeohta avatar ryne755 avatar thandal avatar toyoshi avatar wangwking avatar wuchangji avatar wxy6655 avatar zlj-zz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pymycobot's Issues

Real-Time Synchronization of movement

Describe the bug
myCobot reads the slider values and does not run smoothly.

To Reproduce
I set up an OSC server in python and send values using the pymycobot module.
Here is a part of the function. However, I just use prepared functions.

def sync_angle(self, _angles, _speed):
        self.arm.sync_send_angles(_angles, _speed)

Here is a video recording of the operation of the slider and the actual movement.
At 1 minute and 7 seconds, I try to move the slider while holding it, but mycobot does not move smoothly.
https://www.youtube.com/watch?v=13HlRCM19ws

Expected behavior
It is expected that the position and angle of myCobot will move smoothly according to the position of the slider.
It is also hoped that a tracking device such as Leap Motion can be used to synchronize the position of the mycobot with the position of one's hand by continuously sending values in real time.

Screenshots
Recording Video:
https://www.youtube.com/watch?v=13HlRCM19ws

Desktop (please complete the following information):

  • OS: Windows 10 Home
  • Python 3.8.5
  • pymyCobot 2.4.1
  • python-osc 1.7.4
  • OSC signal from Touch Designer 2021.12380

Additional context
myCobot is Tranponder mode.

get_encoders() returns empty array

Describe the bug

  • set_encoders() definition is duplicated, so set_encoders() executes get_encoders() functionality.
  • get_encoder() returns empty array.

To Reproduce

In [1]: from pymycobot.mycobot import MyCobot
In [2]: mc = MyCobot("COM6")
In [3]: mc.set_encoders()
Out[3]: []

In [4]: for i in range(1, 7):
   ...:     print(i, mc.get_encoder(i))
   ...:
1 [913]
2 [415]
3 [416]
4 [2776]
5 [2667]
6 [2078]

Expected behavior

In [1]: from pymycobot.mycobot import MyCobot
In [2]: mc = MyCobot("COM6")
In [3]: mc.get_encoders()
Out[3]: [913, 415, 416, 2776, 2667, 2078]

Desktop:

  • myCobot-280(M5stack ver.)
    • AtomMain v3.2
    • minirobot v0.4
  • OS: Windows 11
    • Python v3.9.2
    • pymycobot v2.5.6

get_encoder() should return one scalar value

Describe the bug

  • get_encoder() returns an array with one element.

To Reproduce

In [1]: from pymycobot.mycobot import MyCobot
In [2]: mc = MyCobot("COM6")
In [3]: mc.get_encoder(1)
Out[3]: [913]

Expected behavior

In [1]: from pymycobot.mycobot import MyCobot
In [2]: mc = MyCobot("COM6")
In [3]: mc.get_encoder(1)
Out[3]: 913

Desktop:

  • OS: Windows 11
  • pymycobot: 2.5.6
  • AtomMain: 3.2

Format for Sending and Receiving Command Frames not correct

Format for Sending and Receiving Command Frames

I refer to the documentation for development:
https://docs.elephantrobotics.com/docs/myCobot-en/3-development/6-communication.html

The format data is not clear:

  1. Not sure how to send data to controller ion order ex :to move joint 2 by 20 deg
    Used differetrt configuration of provided example:
    Serial port sending example: FE FE 0F 22 06 E6 EA 4E C4 81 0B BD EA C0 02 B6 FA
    But is seems there is not correct. Could you please specify how I should arrange the "string" to perform move joint 2 by 20 deg

  2. While running the debugging mode and mycobot.get_angles() I can see the data format which I receive is not consistent with the provided documentation:
    I expected to receive (similar) ex from documentation:
    FE FE 0E 20 06 E6 EA 4E C4 81 0B BD EA C0 02 B6 FA

but I received:
11:51:10.354 DEBU [pymycobot.generate] _read: b'\xff\xff\x01\x04\x028\x02\xbe\xff\xff\x01\x04\x00\x03\x08\xef\xff\xff\x02\x04\x028\x02\xbd\xff\xff\x02\x04\x00\xc8\x07*\xff\xff\x03\x04\x028\x02\xbc\xff\xff\x03\x04\x00\xff\x07\xf2\xff\xff\x04\x04\x028\x02\xbb\xff\xff\x04\x04\x00\xfb\x07\xf5\xff\xff\x05\x04\x028\x02\xba\xff\xff\x05\x04\x00\xfd\x07\xf2\xff\xff\x06\x04\x028\x02\xb9\xff\xff\x06\x04\x00\x01\x08\xec\xff\xff\xfe\x0c\x83)\x07\x01\x00\x00\x08\x00\x00\x1a\x00\x1f\xff\xff\xfe\x0c\x83)\x07\x02\x008\x08\x00\x00\xe8\x03\x15\xff\xff\xfe\x0c\x83)\x07\x03\x00\x00\x08\x00\x00\x08\x00/\xff\xff\xfe\x0c\x83)\x07\x04\x00\x00\x08\x00\x00,\x00\n\xff\xff\xfe\x0c\x83)\x07\x05\x00\x00\x08\x00\x00\x1a\x00\x1b\xff\xff\xfe\x0c\x83)\x07\x06\x00\x00\x08\x00\x00\x08\x00,\xff\xff\x01\x04\x028\x02\xbe\xff\xff\x01\x04\x00\x03\x08\xef\xff\xff\x02\x04\x028\x02\xbd\xff\xff\x02\x04\x00\xc8\x07*\xff\xff\x03\x04\x028\x02\xbc\xff\xff\x03\x04\x00\xff\x07\xf2\xff\xff\x04\x04\x028\x02\xbb\xff\xff\x04\x04\x00\xfb\x07\xf5\xff\xff\x05\x04\x028\x02\xba\xff\xff\x05\x04\x00\xfd\x07\xf2\xff\xff\x06\x04\x028\x02\xb9\xff\xff\x06\x04\x00\x01\x08\xec\xfe\xfe\x0e \xff\xe6\x01\xec\xff\xf8\x00+\x00\x1a\xff\xf8\xfa'

Could you please provide more info how t read this data?

Ubuntu not reading or writing commands (Not supported)

Describe the bug
WIth Ubuntu 18, the commands to send angles or set lights are not working with MyCobot 320Pi.

To Reproduce
Steps to reproduce the behavior:

  1. git clone this repository
  2. python3 setup.py install
  3. Port /dev/ttyACM0 appears
  4. Modified the basic.py to use /dev/ttyACM0 with baud rate 115100
  5. python3 basic.py
  6. The robot does not move and does not change lights. The program runs until completion.

Expected behavior
The robot should move and change lights.

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu 18 and Ubuntu 20
  • Browser: none
  • Version: None

Smartphone (please complete the following information):
None

Additional context
Add any other context about the problem here.

Using colon does not copy an array with latest Numpy

Describe the bug
In file demo/myCobot_280_demo/280_draw_gcode.py, the function process_gcode uses colon to copy a Numpy array, which only creates a view in latest Numpy (1.26.4)

Toy Example To Reproduce
Steps to reproduce the behavior:

import numpy as np
if __name__ == '__main__':
    data_coords = []
    last_coords = np.zeros(shape=(6,))
    for i in range(10):
        coords = last_coords[:]  # Copy the previous valid coordinates
        coords[0] += 1
        last_coords = coords
        data_coords.append(coords)  # Add coordinates to list and save
    print(data_coords)

Result:

[array([10.,  0.,  0.,  0.,  0.,  0.]), array([10.,  0.,  0.,  0.,  0.,  0.]), array([10.,  0.,  0.,  0.,  0.,  0.]), array([10.,  0.,  0.,  0.,  0.,  0.]), array([10.,  0.,  0.,  0.,  0.,  0.]), array([10.,  0.,  0.,  0.,  0.,  0.]), array([10.,  0.,  0.,  0.,  0.,  0.]), array([10.,  0.,  0.,  0.,  0.,  0.]), array([10.,  0.,  0.,  0.,  0.,  0.]), array([10.,  0.,  0.,  0.,  0.,  0.])]

Setting Up WiFi using myCobot 280 M5

Hello,

I am trying to set up my 280 M5 to connect to WiFi using the set_ssid_pwd() function on my Windows computer. I am afraid I cannot find any instructions on how to do this on your GitBook or any documentation. I derived the usage below based on your coding comments.

from pymycobot.mycobot import MyCobot
import time

print("   Activating Cobot...")
mc = MyCobot('COM3', 115200)
mc.power_on()
time.sleep(5)
print("   Cobot is now active.")


mc.set_ssid_pwd("wifi_ssid", "wifi_password")

print(mc.get_ssid_pwd()) 

This is using pymycobot version 2.8.1 and miniRobot version 2.0.
Is this correct? If so, the get_ssid_pwd() function is printing an empty list, and the WiFi credentials are not being sent to the cobot.

Output:

   Activating Cobot...
   Cobot is now active.
[]

Update 7/28/2022:
I have only gotten this to work once, but the cobot was still unable to connect to WiFi. All other attempts to set up a WiFi connect have still failed. See the debug output below.

   Activating Cobot...
11:23:13.740 DEBU [pymycobot.generate] _write: [254, 254, 2, 18, 250]
11:23:13.750 DEBU [pymycobot.generate] _write: [254, 254, 2, 16, 250]
11:23:18.759 DEBU [pymycobot.generate] _write: [254, 254, 2, 32, 250]
11:23:18.780 DEBU [pymycobot.generate] _write: [254, 254, 2, 176, 250]
11:23:18.781 DEBU [pymycobot.generate] _write: b"'wifi_ssid'(wifi_password)"
11:23:18.782 DEBU [pymycobot.generate] _write: [254, 254, 2, 177, 250]
   Cobot is now active.
11:23:18.883 DEBU [pymycobot.generate] _write: [254, 254, 2, 17, 250]
[]

pwm cannot set Hz

Issue
pymycobot' PWM function cannot set Hz.
So I cannot use my servo for my self-made grip.
My servo needs 50Hz.
By my analysis, PWM 's frequency is fixed in about 1.8KHz.

To Reproduce
run python script below

from pymycobot.mycobot import MyCobot
GPIO_Pin_No=23
PWM_channel_No=0
PWM_Duty_Cycle=128 # 50%
mc = MyCobot('/dev/ttyUSB0')
mc.set_pwm_mode( GPIO_Pin_No, PWM_channel_No)
mc.set_pwm_output(PWM_channel_No , PWM_Duty_Cycle)

Expected behavior
for example,

from pymycobot.mycobot import MyCobot
GPIO_Pin_No=23
PWM_channel_No=0
PWM_Duty_Cycle=128 # 50%
PWM_Freq=50 # Hz
mc = MyCobot('/dev/ttyUSB0')
mc.set_pwm_mode( GPIO_Pin_No, PWM_channel_No)
mc.set_pwm_output( PWM_channel_No , PWM_Duty_Cycle , PWM_Freq)

pwm

pymycobot on windows

Hi, Thanks for very nice tutorials.
I would like to use myCobot python on my Windows system.

In your tutorial, declaring the usb device which is connected to myCobot as shown below.
The following tutorial is based on linux system.

`
from pymycobot.mycobot import MyCobot
from pymycobot.genre import Angle

mycobot = MyCobot('/dev/ttyUSB0')
mycobot.send_angle(Angle.J2.value, 10, 50)
`

My question is that what argument I should input in as a device name in Windows system.
mycobot = MyCobot('[device name]')

Thanks for very much.

Is is it possible to write images to the Basic screen?

Would it be possible to write an image to the screen with the python API? Or does that require flashing the device?

Also, it is possible for me to write a custom flash programs if I want to customize what the buttons do and what the screen shows?

Fresh Ubuntu 20 installation in RPi can't communicate with Atom

Describe the bug
I have installed Ubuntu 20 on a new SD card for the RPi of mycobotpi. I have installed pymycobot package with pip as well. But I'm not able to communicate with the robot and can't execute any motion.

I'm wondering what are the steps required when making a fresh Ubuntu installation on the RPi. Are there any packages that need to be installed? Where can I find more documentation regarding this.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
    To Reproduce
    Steps to reproduce the behavior:
  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]

  • OS: [e.g. iOS8.1]

  • Browser [e.g. chrome, safari]

  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

dh parameters

May I have the dh parameters of the arm?
I would like to work on trajectory generation.

read_angles: Off by a factor of 6?

Describe the bug
When getting angles in degrees, it appears that joint angles are off by a factor of 6.

To Reproduce

  • Using minimycobotflasher:
    • On Basic board, install Transponder v1.0
    • On Atom board, install AtomMain v2.3
  • Install this package (based on upstream ec708f3)
  • Print out angles; example demo: https://github.com/eacousineau/pymycobot/blob/e4db088b/demo/print_angles.py
  • Move J5 to home (0 degrees). It should print out near 0 degrees.
  • Move J5 to positive or negative 90 degrees. Unscaled, will print out about 15 degrees. Scaling by 6, prints out about 90 degrees.
  • Move J5 to either hardstop; unscaled, will print out wrong value; scaling by 6, prints out about +/-170

Expected behavior
It prints the correct values by default?

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Ubuntu 18.04
  • Browser: N/A
  • Version: N/A

Smartphone (please complete the following information):
N/A

Additional context
N/A

pip install with python2.7 faild

Describe the bug

$ pip install -e .
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Obtaining file:///home/nakano/python_ws/pymycobot
    ERROR: Command errored out with exit status 1:
     command: /home/nakano/python_ws/.venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/nakano/python_ws/pymycobot/setup.py'"'"'; __file__='"'"'/home/nakano/python_ws/pymycobot/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-OgVc7V
         cwd: /home/nakano/python_ws/pymycobot/
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/nakano/python_ws/pymycobot/setup.py", line 12, in <module>
        import pymycobot
      File "pymycobot/__init__.py", line 7, in <module>
        from pymycobot.mycobot import MyCobot
      File "pymycobot/mycobot.py", line 7, in <module>
        import serial
    ImportError: No module named serial
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

To Reproduce
Steps to reproduce the behavior:

  1. clone this repository
  2. cd ./pymycobot/
  3. pip install -e .
  4. See error

Expected behavior
installed pymycobot without error

Screenshots
Screenshot from 2021-09-20 18-26-37

Debugging

Description of bug
I need to capture the data send to robot controller while running communication/program in "debugging mode".

There is great possibility to capture data from controller (using ex. mycobot.get_angles() ) but there is no possibility to see what is send:
angles = [0, 20, 0, 0, 0, 0]
mycobot.send_angles(angles, 50)

Is the simple way to capture this data (while running command: mycobot.send_angles (...) ?

get_angles always returns a fixed value

Hi,

I am using the MyCobot 280 Jetson Nano robot arm. I have initialized the interface in Python with the following commands:

from pymycobot.mycobot import MyCobot
mc = MyCobot('/dev/ttyTHS1',1000000)

When I run mc.get_angles(), the returned value is always: [180.08, 180.08, -180.08, 180.08, 180.08, 180.08]

Even after rotating various joints, mc.get_angles always returns: [180.08, 180.08, -180.08, 180.08, 180.08, 180.08]

Please let me know how this can be fixed.

MyCobot 280 M5, is_power_on() return -1. None API works

Describe the bug
A clear and concise description of what the bug is.
I bought M5 version from Amazon yesterday.

  1. Installed the Driver in Windows 11.
  2. Installed pymycobot latest version.

To Reproduce
Steps to reproduce the behavior:

In [1]: from pymycobot.mycobot import MyCobot

In [2]: mc = MyCobot("COM6", 115200, debug=True)

In [3]: mc.power_on()
16:01:39.361 DEBU [pymycobot.generate] _write: ['0xfe', '0xfe', '0x2', '0x10', '0xfa']

In [4]: mc.is_power_on()
16:01:48.574 DEBU [pymycobot.generate] _write: ['0xfe', '0xfe', '0x2', '0x12', '0xfa']
16:01:48.681 DEBU [pymycobot.generate] _read: None
Out[4]: -1

In [5]:

In [5]: mc.get_angles_coords()
16:02:02.048 DEBU [pymycobot.generate] _write: ['0xfe', '0xfe', '0x2', '0xd5', '0xfa']
16:02:02.156 DEBU [pymycobot.generate] _read: None
Out[5]: []

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
  • Version 11

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
The LED light on the Atom is green, in the base, I see a red light flash

get_angles return empty

Describe the bug
Similar to #19, but this worked for the first time but then it stopped return data after that. Restart mycobot doesn't fix the issue.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '~/pymycobot/demo'
  2. python3 basic.py
  3. Enter all data like input of usb, baud and debug mode. After that, get_angles() should return data, not empty.
  4. See error

rpi@raspberrypi:~/pymycobot/demo $ python3 basic.py 

--------------------------------------------
| This file will test basic option method: |
|     set_led_color()                      |
|     send_angles()                        |
|     get_angles()                         |
|     send_angle()                         |
|     send_radians()                       |
|     get_radians()                        |
|     send_coords()                        |
|     get_coords()                         |
|     send_coord()                         |
--------------------------------------------
          

1 : /dev/ttyUSB0 - CP2104 USB to UART Bridge Controller - CP2104 USB to UART Bridge Controller
2 : /dev/ttyAMA0 - ttyAMA0

Please input 1 - 2 to choice:1
/dev/ttyUSB0

Please input baud(default:115200):115200
115200

Wether DEBUG mode[Y/n]:n

Start check basic options

::set_color() ==> color 255 255 0

::send_angles() ==> angles [0, 0, 0, 0, 0, 0], speed 100

::get_angles() ==> degrees: []

::send_angle() ==> angle: joint1, degree: 90, speed: 50

::send_radians() ==> set radians [1, 1, 1, 1, 1, 1], speed 100

::get_radians() ==> radians: []

::send_coords() ==> send coords [160, 160, 160, 0, 0, 0], speed 70, mode 0

::get_coords() ==> coords []

::send_coord() ==> send coord id: X, coord value: -40, speed: 70

::set_free_mode()

=== check end ===

Expected behavior
It should return the value of degree data

pymycobot::get_angles may fail depending on current angle condition

Describe the bug
get_angles() may fail.

To Reproduce
changes angles using pymycobot API.
and then call get_angles().
It will empty array as result.

Desktop (please complete the following information):
Python 3.8.7

Additional context
I looked into this issue and found strange behavior as following.
When host acquires angles, host receives response from MyCobot contains servo's response and M5atom response.
Servo's response terms with check sum and it is 0xfe.
Response from M5stom starts with 0xfe, 0xfe two bytes.
At this time. DataProcessor::_process_received() makes mistake on finding header of response of M5atom.
I quick fixed by taking a look data in after header if it is same as 'genre'. If it is not same, it continues from next byte sequence.

version() returns an empty list

Describe the bug
version() returns an empty list.

To Reproduce

$ ipython
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec  6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from pymycobot import MyCobot

In [2]: mc = MyCobot("COM13", debug=True)

In [3]: mc.version()
03:03:51.402 DEBU [pymycobot.generate] _write: [254, 254, 2, 0, 250]
03:03:51.473 DEBU [pymycobot.generate] _read: no data can be read
Out[3]: []

Expected behavior

The VERSION in common.py should be 0x01, not 0x00. If you change VERSION to 0x01, version() returns the wrong reply [1] for myCobot. It should be 1 for myCobot.

In [1]: from pymycobot import MyCobot

In [2]: mc = MyCobot("COM13", debug=True)

In [3]: mc.version()
03:19:13.736 DEBU [pymycobot.generate] _write: [254, 254, 2, 1, 250]
03:19:13.798 DEBU [pymycobot.generate] _read: b'\xfe\xfe\x03\x01\x01\xfa'
Out[3]: 1

Desktop (please complete the following information):

  • OS: Windows 11
  • Python: 3.10.1
  • pymycobot: 2.7.4
  • myCobot: myCobot 280 M5
    • AtomMain: 4.1
    • minirobot: 1.0

The mycobot adaptive gripper is always closed and gets stuck with set_gripper_value()

Describe the bug
Both set_gripper_value(0, speed) and set_gripper_value(496, speed) close the mycobot adaptive gripper, then the gripper gets stuck. It seems to be occured for any value of set_gripper_value().

To Reproduce

  1. Initialize the gripper once(open to maximum)
  2. Connect to the gripper with mycobot = MyCobot("COM13")
  3. Call mycobot.set_gripper_value(0, 100) # minimum value
  4. The gripper is closed and gets stuck ...
  5. Power off and on
  6. Connect to the gripper with mycobot = MyCobot("COM13")
  7. Call mycobot.set_gripper_value(496, 100) #maximum value
  8. The gripper is closed and gets stack ...

Expected behavior
Though I don't know the meaning of the value of set_gripper_value(), I expect the following behavior:

  • The gripper is closed to maximum with set_gripper_value(0, 100).
  • The gripper is opened to maximum with set_gripper_value(496, 100).

Desktop

  • Windows 10 Home
  • Python 3.9.2
  • pymycobot 2.2.1

MyCobot

  • AtomMain 2.5
  • MyCobot Adaptive Gripper (white)

Additional context
If set_gripper_ini() sets the initial position to 248, shoud be the range of the value in set_gripper_value() from 0 to 248 ?

Gripper does not keep closed

Describe the bug
The gripper does not keep closed (a servo motor does not keep running), and, it drops an object in the gripper.

To Reproduce
Steps to reproduce the behavior:

  1. Burn firmware using MyStudio
  • On Basic board: minirobot v0.4
  • On Atom board: AtomMain v2.8 (I also tried latest version and older version currently available, but none of these worked)
  1. Install this package
  2. Use Transponder
  3. Calibrate the gripper by calling set_gripper_ini() after I fully open the gripper.
  4. Execute the following script
from pymycobot.mycobot import MyCobot
mc = MyCobot('/dev/ttyUSB0')
mc.set_gripper_state(1, 70)
  1. A gripper keep closed for some seconds (sometimes around 30~40s, or even around 10s), but eventually it repeats loosing and closing (you can check how it behaves in the attached movie ).. which results in releasing an object that the gripper grasps.

Expected behavior
The gripper should keep closed all the time. That is, a servo motor should keep running to grasp an object.....otherwise it releases the object.

Screenshots

649316017.417200.mp4

Desktop (please complete the following information):

  • Ubuntu
  • 18.04

Exception in Tkinter Callback During myCobot 280 Pi Calibration

Description

I am encountering an issue with my myCobot 280 Pi during the calibration process. The error occurs when running the rasp_mycobot_test_gui.py script. The script fails with a Tkinter callback exception. This issue is preventing me from completing the calibration process.

Steps to Reproduce

  1. Ran the rasp_mycobot_test_gui.py script on a Raspberry Pi connected to myCobot 280 Pi.
  2. Selected the appropriate serial port (/dev/ttyAMA0) and baud rate (115200 or 1000000). // I tried to use both
  3. Attempted to calibrate the robot arm by clicking the "Start Calibration" button.

docs.elephantrobotics.com/docs/gitbook-en/4-BasicApplication/4.2-firmwares_intro/4.2.2-calibration/4.2.2.2-micro_CPU.html

Expected Behavior

The calibration process should start, and the robot arm should respond accordingly without any errors.

Actual Behavior

An exception is thrown in the Tkinter callback when the calibration function is invoked. The detailed error message is as follows:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.8/tkinter/__init__.py", line 1892, in __call__
    return self.func(*args)
  File "rasp_mycobot_test_gui.py", line 216, in calibration_mycobot
    self.mycobot.send_angle(self.calibration_num, 0, 0)
  File "/home/user/.local/lib/python3.8/site-packages/pymycobot/generate.py", line 246, in send_angle
    self.calibration_parameters(class_name=self.classname, id=id, angle=degree, speed=speed)
  File "/home/user/.local/lib/python3.8/site-packages/pymycobot/error.py", line 295, in calibration_parameters
    public_check(parameter_list, kwargs, robot_limit, class_name, MyCobotDataException)
  File "/home/user/.local/lib/python3.8/site-packages/pymycobot/error.py", line 108, in public_check
    raise exception_class("speed value not right! should be 1 ~ 100, the received speed is 0")
pymycobot.error.MyCobotDataException: speed value not right! should be 1 ~ 100, the received speed is 0

WhatsApp Image 2024-01-19 at 15 32 21

Environment

  • myCobot 280 Pi
  • Raspberry Pi
  • Atom v6.5

get_joint_[min|max]_value() returns wrong value for all joints

Describe the bug
get_joint_[min|max]_value() returns wrong value for all joints.

To Reproduce

$ ipython
Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.20.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from pymycobot.mycobot import MyCobot
In [2]: from pymycobot.genre import Angle
In [3]: mycobot = MyCobot("COM13")
In [4]: for angle in Angle:
   ...:     print(angle.name, mycobot.get_joint_min_angle(angle.value), mycobot.get_joint_max_angle(angle.value))
J1 -15.5 15.5
J2 -16.5 16.5
J3 -16.5 16.5
J4 -16.5 16.5
J5 -17.5 17.5
J6 175.0 -216.08

Expected behavior

Acconding to User Manual V 2021.02.04(p.13), the return values shoud be the following:

J1 -165.0 165.0
J2 -165.0 165.0
J3 -165.0 165.0
J4 -165.0 165.0
J5 -165.0 165.0
J6 -175.0 175.0

Desktop (please complete the following information):

  • Windows 10 Home
  • Python 3.9.2
  • pymycobot 2.2.1

MyCobot

  • AtomMain 2.5
  • MyCobot Adaptive Gripper (white)

Additional context
MyCobot has been calibrated with the Calibration app in myStudio v0.0.5.

Unnecessary fix for is_servo_enable() in v2.5.8

Describe the bug
The fix 4b4a144 is unneccesary. You have to fix the reply of is_servo_enable() from AtomMain v3.2 instead.

To Reproduce
AtomMain v3.2 replies the unnecessary joint number(6) for is_servo_enable(6).

Sending:  fe fe 03 50 06 fa
Received: fe fe 04 50 06 01 fa

Expected behavior

Sending:  fe fe 03 50 06 fa
Received: fe fe 03 50 01 fa

Other commands that specify a joint number do not include it in their reply.

Desktop:

  • myCobot-280(M5stack ver.)
    • AtomMain v3.2
    • minirobot v0.4
  • OS: Windows 11
    • Python v3.9.6
    • pymycobot v2.5.8

Python process dies when calling get_radians()

Atom : v2.4
pymycobot : v.2.1.2

Python process dies when calling get_radians(). For example, when I run test.py in your repository, the process dies.

::get_radians()
Traceback (most recent call last):
  File "./test.py", line 115, in <module>
    test(mycobot)
  File "./test.py", line 70, in test
    print('==> radians: {}\n'.format(mycobot.get_radians()))
  File "/home/nish/.local/lib/python2.7/site-packages/pymycobot/mycobot.py", line 163, in get_radians
    angles = self.__mesg(Command.GET_ANGLES, has_reply=True)
  File "/home/nish/.local/lib/python2.7/site-packages/pymycobot/mycobot.py", line 94, in __mesg
    res = self._process_recived(data, genre)
  File "/home/nish/.local/lib/python2.7/site-packages/pymycobot/common.py", line 135, in _process_recived
    res.append(self._decode_int16(a))
  File "/home/nish/.local/lib/python2.7/site-packages/pymycobot/common.py", line 63, in _decode_int16
    return struct.unpack('>h', data)[0]
struct.error: unpack requires a string argument of length 2

jog_coord not work

Describe the bug
jog_coord() command not work in myCobot Pi

To Reproduce
Steps to reproduce the behavior:
from pymycobot.mycobot import MyCobot
from pymycobot.genre import Coord
from pymycobot.genre import Angle
from pymycobot import PI_PORT, PI_BAUD
import time
mc = MyCobot(PI_PORT, PI_BAUD)
mc.power_on()
mc.jog_coord(1,1,50)
time.sleep(1.5)

Expected behavior
my cobot move

Desktop (please complete the following information):

  • myCobotPi
  • OS: Raspbian GNU/LINUX 10 (buster)
    pymycobot 2.5.9
    python 2.7.16

Additional context
Add any other context about the problem here.
Using jog_angle command can move mycobot

unnecessary debug print

Describe the bug
When I run pymycobot, unnecessary debug message appears on terminal.

����"L.j�L��
12
����"L.j�L��
12
����"L.j�L��
12
����"L.j�L��
12
����"L.j�L��
12
����"L.j�L��
12
����"L.j�L��

To Reproduce
Steps to reproduce the behavior:

  1. Update pymycobot to 2.2.0
  2. Call get_radians() and send_radians()

Expected behavior
No debug message on terminal.

Desktop (please complete the following information):

  • OS: Ubuntu18.04
  • Version pymycobot 2.2.0, AtomMain2.5

Additional context
I found some print in your python script. Please remove it or add debug_enable argument.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.