RoboDK Forum
Delay between input and executed kuka movements- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: Delay between input and executed kuka movements (/Thread-Delay-between-input-and-executed-kuka-movements)



Delay between input and executed kuka movements-Kees12Programming-04-05-2023

I am trying to real-time control a kuka using a spacemouse. I can move the kuka using the mouse, but i get delays, over 1s! I am wondering why, and how i can fix this. All of this is done in the simulation, so i expect extra delay when executing it on the robotic arm, which would make this even worse.

code:
from robolink import *
from robodk import *
import pyspacemouse

RDK = Robolink()

kuka = RDK.Item('', ITEM_TYPE_ROBOT)
RDK.setSimulationSpeed(1)
kuka.setSpeed(speed_linear=10, speed_joints=10, accel_joints=1, accel_linear=1)

mouse = pyspacemouse.open()

move_speed = 1

while 1:
data = mouse.read()
xyzinputs = [round(data.y, 1), round(-1*data.x, 1), 0]

if norm(xyzinputs) <= 0:
continue

xyz_move = mult3(xyzinputs, move_speed)

joints = kuka.Joints()

位置=库卡。SolveFK (joints)

config = kuka.JointsConfig(joints)

new_position = transl(xyz_move) * position

new_joints = kuka.SolveIK(new_position)
if len(new_joints.tolist()) < 6:
print('no solution')
continue

new_config = kuka.JointsConfig(new_joints)

kuka.MoveJ(new_joints)


----

it's based on an example that uses keyboard inputs.
I have not worked with roboDK in combination with Python before, so I might be missing something obvious.
Could it have something to do with the advance that Kuka uses to precalculate movements? and this seems to work from PTP, moving just tiny steps at a time, but would there be a way to continually move?


RE: Delay between input and executed kuka movements-Sam-04-06-2023

You can find a similar example with an Xbox Controller here:https://github.com/RoboDK/Plug-In-Interface/blob/master/PluginAppLoader/Apps/GameController/GameController.py

The move steps are incremental, we do not use the joystick for proportional speed.
However, you can increase the move step.