GithubHelp home page GithubHelp logo

Comments (10)

Eheech avatar Eheech commented on June 14, 2024

Would you mind uploading your codes ? We tried send_angles() and get_angles() multiple times , didn't have this issue , so if you don't mind, we'd like to test it with your code , thanks ~

from pymycobot.

SidKoe avatar SidKoe commented on June 14, 2024

I am not used to using GitHub so I attach changed code here.
Code I have changed is as below. It just DataProcessor::_process_received() only.
Changed lines is marked with command, "# CHANGED"
I also attach binary dump of transmitting data and comment following code. I hope it helps you to understand issue.

---- CODE:start ----
def _process_received(self, data, genre):
if not data:
return []

    data = bytearray(data)
    data_len = len(data)
    # Get valid header: 0xfe0xfe
    for idx in range(data_len - 1):
        if self._is_frame_header(data, idx):
            data_len = data[idx + 2] - 2
            if data_len > 0:
                cmd_id = data[idx + 3]   # CHANGED
                if cmd_id == genre:       # CHANGED
                    break                         # CHANGED
    else:
        return []

    data_len = data[idx + 2] - 2

    # compare send header and received header
    cmd_id = data[idx + 3]
    if cmd_id != genre:
        return []
    data_pos = idx + 4
    valid_data = data[data_pos : data_pos + data_len]

    # process valid data
    res = []
    if data_len == 12:
        for idx in range(0, len(valid_data), 2):
            one = valid_data[idx : idx + 2]
            res.append(self._decode_int16(one))
    elif data_len == 2:
        res.append(self._decode_int16(valid_data))
    else:
        res.append(self._decode_int8(valid_data))
    return res

---- CODE:end ----

Each line is divided by chunk of command or response.
Data start with servo related communication data and last chunk is response from M5atom, I thought.
Last servo response terms with check sum and it value is 0xfe.
Succeeding M5atom response start with 0xfe, 0xfe, header part.
Current code will take termination check sum code and first one byte of data as starting response of M5atom.
And pymycobot library will check command code at wrong data and fail parsing.
---- DATA:start ----
ff ff 01 04 02 38 02 be
ff ff 01 04 00 87 06 6d
ff ff 02 04 02 38 02 bd
ff ff 02 04 00 f1 03 05
ff ff 03 04 02 38 02 bc
ff ff 03 04 00 43 07 ad
ff ff 04 04 02 38 02 bb
ff ff 04 04 00 70 03 84
ff ff 05 04 02 38 02 ba
ff ff 05 04 00 11 08 dd
ff ff 06 04 02 38 02 b9
ff ff 06 04 00 f0 07 fe
fe fe 0e 20 0c f1 23 ab f9 8c 28 19 ff 6B 00 8c fa
---- DATA:end ----

from pymycobot.

SidKoe avatar SidKoe commented on June 14, 2024

P.S.
Well, I think you may repro more easier when you change angle of J6. I think last response is for J6 servo. Others may not cause this issue. If you have any question, please let me know.

from pymycobot.

Eheech avatar Eheech commented on June 14, 2024

In pymycobot , it will filler out communication messages between Basic and Atom , only read Get_angles()
image

from pymycobot.

Eheech avatar Eheech commented on June 14, 2024

When you get empty array, have you check Atom's status ? Is it 'yes' or 'no' ? and have you chosen ' minirobot -> transponder ' ?

from pymycobot.

Eheech avatar Eheech commented on June 14, 2024

Maybe you can upload your code which you used to control mycobot , we'd like to test it with your code , thanks ~

from pymycobot.

SidKoe avatar SidKoe commented on June 14, 2024

I have not yet checked Atom's status. I am not sure which API is available to see Atom's status. But even if this issue happened mycobot can be controlled from pymycobot API; changing angle of joints, focus on or off servos. I believe this issue is not problem of Atom or Base. It will be handling problem of received data in pymycobot or something.
I am using transponder and set various angles of all joints. Most cases it works fine; get_angles() returns list of angles of joints.
BTW, it is difficult to provide code controlling mycobot as it is, because it includes many functions for another project. I will try to arrange something to provide for this issue.

from pymycobot.

Eheech avatar Eheech commented on June 14, 2024

Are you using mycobot_280_M5 ? In transponder, press button A , it will return Atom's status in Basic.
You can use ' is_controller_connected() ' to check Atom's status , return data 1: connected 0: not connected -1: error .
And please update Atom and Basic's firmwares before you use mycobot .

from pymycobot.

tongtybj avatar tongtybj commented on June 14, 2024

Hi, I face the same with MyCobot Pro 320 M5.
My code is based on mycobot_ros.
The debug branch is https://github.com/tongtybj/mycobot_ros/tree/interface_bug_mycobot320pro_m5.

Code

You can try following command to check the bug:
roslaunch mycobot_communication mycobot_interface.launch

Then you can find following log result:

get angles: [-68.64, 129.37, -138.6, -36.65, 91.49, -0.35]
get angles: []
get angles: []
get angles: [-68.64, 129.37, -138.6, -36.65, 91.49, -0.35]
get angles: []
get angles: []
get angles: [-68.64, 129.37, -138.6, -36.65, 91.49, -0.35]
get angles: []
get angles: []
get angles: [-68.64, 129.37, -138.6, -36.65, 91.49, -0.35]
get angles: []
get angles: []
get angles: [-68.64, 129.37, -138.6, -36.65, 91.49, -0.35]
get angles: []
get angles: []
get angles: [-68.64, 129.37, -138.6, -36.65, 91.49, -0.35]
get angles: []
get angles: []
get angles: [-68.64, 129.37, -138.6, -36.65, 91.49, -0.35]
get angles: []
get angles: []
get angles: [-68.64, 129.37, -138.6, -36.65, 91.49, -0.35]
get angles: []
get angles: []
get angles: [-68.64, 129.37, -138.6, -36.65, 91.49, -0.35]
get angles: []
get angles: []

The related code is here:
https://github.com/tongtybj/mycobot_ros/blob/interface_bug_mycobot320pro_m5/mycobot_communication/scripts/mycobot_interface.py#L63-L64

Other tests:

Firmware version:

  • Mycobot Pro 320 M5: basic is v1.0; atom is v4.1
  • Mycobot 280 M5: basic is v1.0; atom is unknown

from pymycobot.

v-ghobadi avatar v-ghobadi commented on June 14, 2024

get_angles()returns an empty array on the client while working with myCobot 280pi.

from pymycobot.

Related Issues (20)

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.