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

ServoJ speed limit errors #94

Open
colin-r-schultz opened this issue Sep 7, 2023 · 4 comments
Open

ServoJ speed limit errors #94

colin-r-schultz opened this issue Sep 7, 2023 · 4 comments

Comments

@colin-r-schultz
Copy link

While using SevoJ mode, we frequently encounter C24 speed limit errors. We believe these occur when the TCP exceeds 1000mm/s.
This response to #88 suggests that the TCP speed limit should only apply to cartesian motions, not ServoJ. The speed limit does not apply in position control mode, online planning mode, or velocity control mode. Could you please confirm the intended behavior?

@penglongxiang
Copy link

Hi, in the answer from #88 the Cartesian speed limit is not applicable for Joint motion in mode 0, of which the trajectory is planned by our internal controller. Since Servo Mode is special, if the command from user is not well interpolated, the execution may not be safe, so we still added the Cartesian speed check under Servo Mode, would you please download the log immediately after you reproduce the overspeed error in servoJ operation for us to diagnose? Thank you.

@colin-r-schultz
Copy link
Author

XI130308B22L24_2023-09-08_10-26-45.tar.gz

I can replicate the speed error with the following script:

import time
import numpy as np
from xarm.wrapper import XArmAPI

SPEED = 2.0  # rad/s

start = np.deg2rad([-90, 27, -69, 0, 41, 3.7])
api = XArmAPI("192.168.250.232", is_radian=True)
print("enabling")
api.motion_enable(enable=True)
time.sleep(1)
print("setting mode 0")
api.set_mode(0)
api.set_state(0)
time.sleep(1)
api.set_servo_angle(angle=start, wait=True)

# set servo j control mode
print("setting mode 1")
api.set_mode(1)
api.set_state(0)
time.sleep(1)
_, init_joints = api.get_servo_angle()
_, pos = api.get_position()
radius = np.linalg.norm(pos[0:2])  # radius in xy plane
print("radius:", radius)

start_t = time.perf_counter()
while (t := time.perf_counter() - start_t) < 0.8:
    pos = init_joints.copy()
    pos[0] += SPEED * t
    api.set_servo_angle_j(pos)
    time.sleep(0.005)

We put the end effector at around 550mm from the base, then move joint 0 at 2 rad/s to surpass the speed of 1000mm/s. It is strange that this motion is allowed using mode 0, mode 4 or mode 6.

@penglongxiang
Copy link

Thanks for the log and script, indeed the C24 error occurs because of the command linear velocity exceeds 1000mm/s at your start configuration. As 550mm * 2 rad/s = 1100 mm/s. And this restriction applies in Mode 1 because of the safety consideration as I mentioned in previous reply, the trajectory is not generated by our algorithm and we would force a linear speed limit to this mode even for joint motion. We will re-evaluate this logic in the future to see if there is a better option or design.

@MinnaZhong
Copy link

MinnaZhong commented Apr 7, 2024

Hey guys,

We added a new parameter to solve this problem, the user now can specify their own TCP speed limit for servoJ mode.

  1. The firmware and ufactoryStudio version should be ≥2.3.0.
    For your reference: https://docs.ufactory.cc/support_articles/faq/how-to-update-the-firmware-and-ufactory-studio-of-robotic-arm
  2. Please use set_linear_spd_limit_factor to set your TCP speed limits for servoJ mode.
    factor×1000 = linear speed limit, the default value is 1.2×1000=1200mm/s
    If you want this setting to take effect even after restarting the arm, please call save_conf() to save this config.
    image

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