Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RoboDK not working properly
#1
Hi,

I recently got the license for RoboDK and I wanted to control a KUKA arm using keyboard. I am using the provided sample
Code:
# This macro allows moving a robot using the keyboard
# Note: This works on console mode only, you must run the PY file separately
#
# More information about the RoboDK API here:
# https://robodk.com/doc/en/RoboDK-API.html
# Type help("robolink") or help("robodk") for more information

from robolink import *    # API to communicate with RoboDK
from robodk import *      # basic matrix operations
RDK = Robolink()

# Arrow keys program example

# get a robot
robot = RDK.Item('', ITEM_TYPE_ROBOT)
if not robot.Valid():
   print("No robot in the station. Load a robot first, then run this program.")
   pause(5)
   raise Exception("No robot in the station!")

print('Using robot: %s' % robot.Name())
print('Use the arrows (left, right, up, down), Q and A keys to move the robot')
print('Note: This works on console mode only, you must run the PY file separately')

# define the move increment
move_speed = 10

import msvcrt
while True:  
   key = ord(msvcrt.getch())
   move_direction = [0,0,0]
   print(key)
   if key == 75:
       print('arrow left (Y-)')
       move_direction = [0,-1,0]
   elif key == 77:
       print('arrow right (Y+)')
       move_direction = [0,1,0]
   elif key == 72:
       print('arrow up (X-)')
       move_direction = [-1,0,0]
   elif key == 80:
       print('arrow down (X+)')
       move_direction = [1,0,0]
   elif key == chr(113):
       print('Q (Z+)')
       move_direction = [0,0,10]
   elif key == 97:
       print('A (Z-)')
       move_direction = [0,0,-1]

   # make sure that a movement direction is specified
   if norm(move_direction) <= 0:
       continue

   # calculate the movement in mm according to the movement speed
   xyz_move = mult3(move_direction, move_speed)

   # get the robot joints
   robot_joints = robot.Joints()

   # get the robot position from the joints (calculate forward kinematics)
   robot_position = robot.SolveFK(robot_joints)

   # get the robot configuration (robot joint state)
   robot_config = robot.JointsConfig(robot_joints)

   # calculate the new robot position
   new_robot_position = transl(xyz_move)*robot_position

   # calculate the new robot joints
   new_robot_joints = robot.SolveIK(new_robot_position)
   if len(new_robot_joints.tolist()) < 6:
       print("No robot solution!! The new position is too far, out of reach or close to a singularity")
       continue

   # calculate the robot configuration for the new joints
   new_robot_config = robot.JointsConfig(new_robot_joints)

   if robot_config[0] != new_robot_config[0] or robot_config[1] != new_robot_config[1] or robot_config[2] != new_robot_config[2]:
       print("Warning!! Robot configuration changed!! This will lead to unextected movements!")
       print(robot_config)
       print(new_robot_config)

   # move the robot joints to the new position
   robot.MoveJ(new_robot_joints)
   #robot.MoveL(new_robot_joints)
But the robot is not responsive to the keyboard press. If I give a specific value to 'key' and then run the program, the robot jerks. But it always goes back to its starting position. I am using KUKA-LBR-iiwa-14-R820. Is this an issue with the code? I tried with other robots too but had the same experience.

I tried this example from the python API documentation. I still got the same problem. Robot just jerks and thats it.
Code:
from robolink import *                  # import the robolink library        
RDK = Robolink()                        # connect to the RoboDK API (RoboDK starts if it has not started
robot  = RDK.Item('', ITEM_TYPE_ROBOT)  # Retrieve the robot

x_move = 2
y_move = 3
z_move = -1

# get the current robot joints
robot_joints = robot.Joints()

# get the robot position from the joints (calculate forward kinematics)
robot_position = robot.SolveFK(robot_joints)

# get the robot configuration (robot joint state)
robot_config = robot.JointsConfig(robot_joints)

# calculate the new robot position
new_robot_position = transl([x_move,y_move,z_move])*robot_position

# calculate the new robot joints
new_robot_joints = robot.SolveIK(new_robot_position)
if len(new_robot_joints.tolist()) < 6:
   print("No robot solution!! The new position is too far, out of reach or close to a singularity")
   continue

# calculate the robot configuration for the new joints
new_robot_config = robot.JointsConfig(new_robot_joints)

if robot_config[0] != new_robot_config[0] or robot_config[1] != new_robot_config[1] or robot_config[2] != new_robot_config[2]:
   print("Warning! Robot configuration changed: this may lead to unextected movements!")
   print(robot_config)
   print(new_robot_config)

# move the robot to the new position
robot.MoveJ(new_robot_joints)
#robot.MoveL(new_robot_joints)
#2
Ok, guys. I tried it on another computer and I was working. But the 2nd computer doesn't have a license and its on trail period.  I want to run this on my own computer not the 2nd one, so what should I do? Will my license key be still valid if I re-install the software? please advise.
#3
Hi avpai1992,

If you have a standard professional license you can transfer it without any problem. Those are network licenses and are not linked to a specific computer.
If you have a standalone license (computer specific), let me know. Only a little portion of our licenses are computer specific.

It's the same thing if you reinstall RoboDK. The license will still be valid.

Have a good day.
Jeremy
#4
Hi Jeremy,

I think I have got the computer specific license. I requested the Robodk team to let me try the software for a couple of months as I am a college student. So, I was given a 4 months educational institution license, which I believe is computer specific. I re-installed the software ( even python) but I am still having the same issue(Seen in the below gif). @Jeremy and @Albert, any ideas??

   
#5
To know if you have a computer specific license or a standard network license, just click on "Help -> License". You will know if you have a Network or Standalone license.

If it's a network one, you just have to copy the alphanumerical code from one PC to the other.

Also, considering your actual problem, have you tried to completely uninstall RDK from your computer and installing a fresh version from our website? (Copy and past the license code before doing so.)

Jeremy
#6
Hi, I tried uninstalling and re-installing but the problem still persists. I tried the software on 3 laptops and 2 computer but it worked only on one computer. Rest of them had the same problem,I don't know why. I have a network license, so I guess I will transfer this to another computer. As I won't always have access to that computer,I would like to know the reason for this bug.
#7
RoboDK does not support the robot driver for the KUKA IIWA robots. More information about robot drivers here:
https://robodk.com/doc/en/Robot-Drivers....iverCustom

This issue is not related to the license type. I'm sorry for this confusion.

On the other hand, you should not have any issues running your programs offline using KUKA Sunrise programming (Java robot program files).
#8
Hi @Albert,

Sorry for the confusion, I don't want to control an actual KUKA arm. I just wanted to try the offline programming simulation.
#9
In that case, can you provide the RDK project file?
You should not have any issues generating JAVA Sunrise for the KUKA IIWA robot.
#10
Hi Guys,

For the moment I have decided to use the working computer to run the offline-keyboard simulation. I will try to look into whats causing the error and keep you guys posted. I have another minor issue, which I have started a new topic on.  Thank you guys.
  




Users browsing this thread:
2 Guest(s)