xArm-Developer / xArm-Python-SDK

Python SDK for UFACTORY robots, 850, xArm5/6/7, and Lite6.
https://www.ufactory.cc
BSD 3-Clause "New" or "Revised" License
163 stars 105 forks source link

Query for Functionalities #118

Open 101Priyansh opened 2 weeks ago

101Priyansh commented 2 weeks ago

I want to make the end-effector reach at a certain point with a certain desired velocity(Goal: x,y with 0.3m/s) . Is there a readily available code in the python sdk for the same? where I do not need to write a PD controller.

Thank you.

penglongxiang commented 2 weeks ago

Sorry I guess there is no single function available to reach a specified position at non-zero velocity. Currently we have position command (reach target at zero velocity) and velocity control mode (keep moving at a target velocity with no position target).

If you have external planner or algorithm that can achieve your desired function, you may use servo_cartesian() function in mode 1 to update the trajectory at a fixed servo frequency. Check the example here.

101Priyansh commented 1 week ago

Hello,

I actually tried the code that you suggested, apparently I am unable to see any changes for the speed parameter for the function: arm.set_servo_cartesian(mvpose, speed=100, mvacc=2000).

I have a couple of queries;

  1. The behavior of the function: _arm.set_vccartesian() is different when being called inside and outside a loop. (It works when outside the loop and reaches the desired velocity, but when inside the loop(~100hz) it seems it is unable to achieve the velocity at all.) Attached image for reference. Screenshot (1) Screenshot (2) Screenshot (3) Screenshot (4)

  2. Is there a way to control the acceleration directly?

  3. Is there a way to get the velocity of the end-effector directly?

Thank you.

penglongxiang commented 1 week ago

Hi @101Priyansh, The speed and acceleration parameter of set_servo_cartesian() are not effective, they are reserved parameters, actual speed will be controlled by caller and the position will be executed immediately upon command reception.

  1. Since velocity control is actively adjusting upon received target velocity vector. It turns out set_vc_cartesian() will accelerate slower if the same command are received in a loop, actually it will reach the target, but not as quick as sending the same command just once. We will tackle this situation in future firmware update. You can try adjusting Cartesian jerk and acceleration by set_tcp_jerk() and set_tcp_maxacc() to see if using larger values can accelerate faster.
  2. There is no direct way of controlling the acceleration actively, only setting a maximum allowed acceleration by set_tcp_maxacc().
  3. You may check this real-time reporting doc and a sample interpreting code here.