Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AtomMain 2.8.1 has broken Encoder Values #17

Open
peteh opened this issue May 29, 2021 · 8 comments
Open

AtomMain 2.8.1 has broken Encoder Values #17

peteh opened this issue May 29, 2021 · 8 comments

Comments

@peteh
Copy link

peteh commented May 29, 2021

In 2.8.1 Atom Main, the encoder values are not updating or just wrong.

The following code will not show correct encoder values:

for (int i = 0; i < 6; i++)
{
    angles.joint_angle[i] = m_mycobotBasic.getEncoder(i + 1);
}

It can also be reproduced by flashing the latest MainControl app into Basic and trying to record and replay a motion. The replaying will not work and move to random poses instead of the expected track.

The bug seems to have been introduced with 2.8.1. Version 2.8 is working properly.

@zlj-zz
Copy link
Collaborator

zlj-zz commented Jun 1, 2021

Please try Atom2.8

@peteh
Copy link
Author

peteh commented Jun 3, 2021

That is more reliable but also sometimes gives me -1 for encoder values.

I currently workaround it by trying to read the value up to 3 times which is more robust. However, this interferes with timing.

@zlj-zz
Copy link
Collaborator

zlj-zz commented Jun 3, 2021

The reason for -1 is that the serial port does not read the data, which may be read too fast. So that the serial port can't react.
If you are reading data continuously, you can skip them when you get [] or -1.

@peteh
Copy link
Author

peteh commented Jun 3, 2021

I'm technically using the code you're using for teaching in the MainControl application. This code has the same issue with Atom 2.8. It is not visible because some of the next measurements will have correct values and -1 are ignored when commanding.

How can I make sure that I do not send too fast?

BTW: I'm programming on the Basic controller directly adapting the MainControl application

@zlj-zz
Copy link
Collaborator

zlj-zz commented Jun 4, 2021

I am sorry, maybe I didn't find out. where you get the -1?

m_mycobotBasic.getEncoder(i + 1);

here?

@peteh
Copy link
Author

peteh commented Jun 4, 2021

Yes, this function seems to return -1.

@zlj-zz
Copy link
Collaborator

zlj-zz commented Jun 4, 2021

OK. The reason is that valid data cannot be read. I think you just need to skip -1.

API will only throw out the possible existence of wrong data, and the user will deal with this situation.😊

@eacousineau
Copy link
Contributor

Possibly relates elephantrobotics/pymycobot#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants