elephantrobotics / pymycobot

This is a python API for ElephantRobotics product.
MIT License
107 stars 54 forks source link

get_angles return empty #39

Open Kakcalu13 opened 1 year ago

Kakcalu13 commented 1 year ago

Describe the bug Similar to https://github.com/elephantrobotics/pymycobot/issues/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
anla-xu commented 1 year ago

@Kakcalu13 Is the mycobot you are using pi or M5

wildangunawan commented 1 year ago

Same issue using 280 Pi

Kakcalu13 commented 1 year ago

@Kakcalu13 Is the mycobot you are using pi or M5

@anla-xu 280 Pi

wildangunawan commented 1 year ago

I already send this concern to the tech dept (support at elephantrobotics dot com) email. Hopefully we get response soon.

xxl007 commented 1 year ago

I am having the same issue using the 320 Pi. Did you managed to resolve it? It would be useful if someone from elephantrobotics could address these issues.

anla-xu commented 1 year ago

1.What is the probability that this problem occurs? Occasionally or all the time? 2.Please provide the model of the machine with the problem and the software version used (like atom's firmware version)

wildangunawan commented 1 year ago

1.What is the probability that this problem occurs? Occasionally or all the time? 2.Please provide the model of the machine with the problem and the software version used (like atom's firmware version)

  1. All the time.
  2. myCobot 280 Pi 2020, need to check the software version but I think would be the latest one.
anla-xu commented 1 year ago

1.出现这个问题的概率是多少?偶尔还是一直? 2.请提供问题机器的型号和使用的软件版本(如atom的固件版本)

  1. 每时每刻。
  2. myCobot 280 Pi 2020,需要检查软件版本,但我认为应该是最新的。

Can other interfaces be used? For example get_coords, is_power_on, The baud rate of 280 Pi is 1000000. Is this how you initialized it?

from pymycobot import MyCobot

mc = MyCobot('/dev/ttyAMA0', 1000000)
wildangunawan commented 1 year ago

1.出现这个问题的概率是多少?偶尔还是一直? 2.请提供问题机器的型号和使用的软件版本(如atom的固件版本)

  1. 每时每刻。
  2. myCobot 280 Pi 2020,需要检查软件版本,但我认为应该是最新的。

Can other interfaces be used? For example get_coords, is_power_on, The baud rate of 280 Pi is 1000000. Is this how you initialized it?

from pymycobot import MyCobot

mc = MyCobot('/dev/ttyAMA0', 1000000)

Yes, others can be used but get_angles cannot. Considering we're playing with angles here, I think this is an important feature to have.

I initialized the myCobot using this

from pymycobot import MyCobot
from pymycobot import PI_PORT, PI_BAUD # For raspberry pi version of mycobot.
mc = MyCobot(PI_PORT, PI_BAUD)
anla-xu commented 1 year ago

1.出现这个问题的概率是多少?偶尔还是一直? 2.请提供问题机器的型号和使用的软件版本(如atom的固件版本)

  1. 每时每刻。
  2. myCobot 280 Pi 2020,需要检查软件版本,但我认为应该是最新的。

Can other interfaces be used? For example get_coords, is_power_on, The baud rate of 280 Pi is 1000000. Is this how you initialized it?

from pymycobot import MyCobot

mc = MyCobot('/dev/ttyAMA0', 1000000)

Yes, others can be used but get_angles cannot. Considering we're playing with angles here, I think this is an important feature to have.

I initialized the myCobot using this

from pymycobot import MyCobot
from pymycobot import PI_PORT, PI_BAUD # For raspberry pi version of mycobot.
mc = MyCobot(PI_PORT, PI_BAUD)

Please update pymycobot to the latest version, and add debug=True parameters during initialization to see if there is any data returned, please send me the running results

from pymycobot import MyCobot
from pymycobot import PI_PORT, PI_BAUD # For raspberry pi version of mycobot.
mc = MyCobot(PI_PORT, PI_BAUD, debug=True)
print(mc.get_angles())
v-ghobadi commented 8 months ago

get_angles() works in myCobot 280pi. But when myCobot 280pi is a server, doesn't work.

Kakcalu13 commented 3 months ago

I was going to make an issue about get_angles issue after upgraded my mycobot python. Turn out that I created this already lol

So, my mycobot is myCobot 280. For some reason, it doesn't return a list. My version is 29 (I printed it). See the simple code here:

mycobot = Arm()
arm = mycobot.connection_initialize()
default = [2048, 2048, 2048, 2048, 2048, 2048]
arm.set_encoders(default, 100)
print("version: ", arm.get_system_version())
print("list of encoders here: ", arm.get_encoders())
print("list of angles here: ", arm.get_angles())

which results output like this:

bwuk@robots:~/feagi-connector/embodiments/elephant_robotics/pure_python_mycobot$ python3 controller.py 
here:  /dev/ttyUSB0
16:45:03.069 DEBU [pymycobot.generate] _write: ['0xfe', '0xfe', '0xf', '0x3c', '0x8', '0x0', '0x8', '0x0', '0x8', '0x0', '0x8', '0x0', '0x8', '0x0', '0x8', '0x0', '0x64', '0xfa']
16:45:03.074 DEBU [pymycobot.generate] _write: ['0xfe', '0xfe', '0x2', '0x2', '0xfa']
16:45:03.084 DEBU [pymycobot.generate] _read: b'\xfe\xfe\x03\x02\x1d\xfa'
version:  [29]
16:45:03.084 DEBU [pymycobot.generate] _write: ['0xfe', '0xfe', '0x2', '0x3d', '0xfa']
16:45:03.194 DEBU [pymycobot.generate] _read: None
list of encoders here:  []
16:45:03.194 DEBU [pymycobot.generate] _write: ['0xfe', '0xfe', '0x2', '0x20', '0xfa']
16:45:03.303 DEBU [pymycobot.generate] _read: None
list of angles here:  []
16:45:03.303 DEBU [pymycobot.generate] _write: ['0xfe', '0xfe', '0x3', '0x56', '0x1', '0xfa']
16:45:03.310 DEBU [pymycobot.generate] _write: ['0xfe', '0xfe', '0x2', '0x14', '0xfa']
16:45:03.320 DEBU [pymycobot.generate] _read: b'\xfe\xfe\x0e \xff\xe6FX\xff\xf8\xcdn\x02\xb6\x00i\xfa'

The class of ARM code here:

class Arm:
    @staticmethod
    def connection_initialize(port='/dev/ttyUSB0'):
        """
        :param port: The default would be '/dev/ttyUSB0'. If the port is different, put a different port.
        :return:
        """
        print("here: ", port)
        return MyCobot(port, 115200, debug=True)
anla-xu commented 2 months ago

@Kakcalu13 Please provide the basic firmware, atom firmware and pymycobot version number you are using.

michelle-aa-robotics-photonics commented 2 weeks ago

I am also having this issue. I first was able to use the bot and extract the angles. Now I am not. The only change is that I updated myStudio and down Screenshot_20240701-160721 PXL_20240701_192839664 PXL_20240701_192923729 (1) PXL_20240701_193047574 MP PXL_20240701_193212721 loaded the latest Atom firmware. I did not flash that firmware, though, because if I press the "Flash" button I get "Please connect the machine before burning". I checked the firmware and I have version 5.1.