When using the rtde_c.speedj() function, the initial acceleration of the first command does not meet expectations, resulting in a prolonged time to reach the desired speed.
Regardless of the desired speed value, it always takes a fixed amount of time (about 0.4s) to reach the desired speed.
My code is shown here:
import numpy as np
import time
import rtde_control
import rtde_receive
ur_ip = '192.168.253.10'
frequency = 500
rob_c = rtde_control.RTDEControlInterface(ur_ip, frequency)
rob_r = rtde_receive.RTDEReceiveInterface(ur_ip, frequency)
record_variable = ['timestamp', 'target_q', 'actual_q', 'target_qd', 'actual_qd', 'target_qdd']
rob_r.startFileRecording('data.csv', record_variable)
joint_start = rob_r.getActualQ()
rob_c.speedJ([0, 0, 0., 0, 0., 0.01], 2., 1./frequency)
time.sleep(0.5)
joint_middle = rob_r.getActualQ()
print('The joint difference:', joint_middle[5] - joint_start[5])
rob_c.speedJ([0, 0, 0., 0, 0., -0.01], 2., 1./frequency)
time.sleep(1.)
joint_end = rob_r.getActualQ()
print('The joint difference:', joint_end[5] - joint_middle[5])
rob_c.speedStop()
rob_r.stopFileRecording()
rob_c.stopScript()
and the result:
The joint difference: 0.0030684471130371094
The joint difference: -0.009823322296142578
Subsequent speed control commands work normally.