elephantrobotics / pymycobot

This is a python API for ElephantRobotics product.
MIT License
125 stars 55 forks source link

MyArmM `get_joints_min` and `get_joints_max` don't match the values in `calibration_parameters`, leading to `ValueError`s #104

Closed apockill closed 2 weeks ago

apockill commented 3 weeks ago

Describe the bug In order to control MyArmM using MyArmC, I need to copy joint angles from MyArmC to MyArmM.

I need to know what the min and max values are, so I can clamp the values to the correct values, before sending them to set_joint_angle. However, it's impossible to do so right now because calibration_parameters has different values than reported by get_joints_min and get_joints_max.

This change is introduced in https://github.com/elephantrobotics/pymycobot/pull/103/files#diff-edb1753620e8370d80dd9ab73dff12930bbf15bac171ea5b08ca00af41f248e6R355

Where the PR sets

"angles_min": [-170, -83, -90, -155, -91, -153, -118],
"angles_max": [170, 83, 84, 153, 88, 153, 2],

However, if you call get_joints_min and get_joints_max, you get:

mover.get_joints_max()=[172.0, 90.0, 91.0, 148.0, 84.0, 146.0, 0.0]
mover.get_joints_min()=[-168.0, -77.0, -86.0, -159.0, -95.0, -161.0, -118.0]

These values are different, leading to ValueErrors when teleoperating the MyArm pair.

This is using v1.1 firmware on both MyArmC and MyArmM.

anla-xu commented 3 weeks ago

Please provide the software version, which can be queried using the following interfaces: get_robot_firmware_version, get_robot_modified_version

apockill commented 2 weeks ago

Absolutely.

Here are the versions of the MyArmC:

Python Version: 3
Robot Firmware Version: 1.1
Robot Modified Version: 4
Tool Firmware Version: 1.1
Tool Modified Version: 0

and the MyArmM:

Python Version: 3
Robot Firmware Version: 1.1
Robot Modified Version: 1
Tool Firmware Version: None
Tool Modified Version: None

I got these by using:

def print_robot_info(robot: MyArmM | MyArmC) -> None:
    logger.info(f"Python Version: {robot.check_python_version()}")
    logger.info(f"Robot Firmware Version: {robot.get_robot_firmware_version()}")
    logger.info(f"Robot Modified Version: {robot.get_robot_modified_version()}")
    logger.info(f"Tool Firmware Version: {robot.get_robot_tool_firmware_version()}")
    logger.info(f"Tool Modified Version: {robot.get_robot_tool_modified_version()}")
anla-xu commented 2 weeks ago

The main control software version seems to be incorrect. Please use myStudio to re-burn the latest picoMain firmware. The correct get_robot_modified_version should be 7

apockill commented 2 weeks ago

Perfect, this solved it. Thank you!