Comments (10)
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.
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.
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.
In pymycobot , it will filler out communication messages between Basic and Atom , only read Get_angles()
from pymycobot.
When you get empty array, have you check Atom's status ? Is it 'yes' or 'no' ? and have you chosen ' minirobot -> transponder ' ?
from pymycobot.
Maybe you can upload your code which you used to control mycobot , we'd like to test it with your code , thanks ~
from pymycobot.
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.
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.
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:
- I also tried with MyCobot280 M5, but this bug never happened (the list never be empty).
- If I comment out
https://github.com/tongtybj/mycobot_ros/blob/interface_bug_mycobot320pro_m5/mycobot_communication/scripts/mycobot_interface.py#L77-L78, this bug is also disappeared for MyCobot Pro 320 M5.
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.
get_angles()returns an empty array on the client while working with myCobot 280pi.
from pymycobot.
Related Issues (20)
- Real-Time Synchronization of movement HOT 6
- read_angles: Off by a factor of 6? HOT 3
- Gripper does not keep closed HOT 2
- get_encoders() returns empty array HOT 12
- get_encoder() should return one scalar value HOT 1
- Unnecessary fix for is_servo_enable() in v2.5.8 HOT 3
- jog_coord not work HOT 2
- pip install with python2.7 faild HOT 1
- Connect with MyCobotPro 320 M5 via Ethernet HOT 1
- version() returns an empty list HOT 1
- Debugging HOT 1
- Format for Sending and Receiving Command Frames not correct HOT 2
- Setting Up WiFi using myCobot 280 M5 HOT 1
- get_angles return empty HOT 13
- Fresh Ubuntu 20 installation in RPi can't communicate with Atom HOT 3
- Ubuntu not reading or writing commands (Not supported) HOT 1
- get_angles always returns a fixed value HOT 1
- MyCobot 280 M5, is_power_on() return -1. None API works HOT 1
- Exception in Tkinter Callback During myCobot 280 Pi Calibration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymycobot.