RTDE - get_inverse_kin()

Hi all,
I am using an RTDE interface in python created by RopeRobotics(Python 3 library to communicate with robot), though my question is more about general RTDE communication than the interface presented above.

I know how to send commands to robot that do not require numerical output such as force_mode, servoj, movel etc.
I know how to read the defined values inside the robot (list given in RTDE guide) for example:

Problem Description
The issue of mine is that I am trying to use the defined inside the robot get_invere_kin() function to obtain the TCP pose.
What I try to do is:

  1. Assign input_double_register_0-5 to store value of pose (x,y,z,Rx,Ry,Rz)
  2. Send those values as an input to get_inv_kin() defined inside the robot (prog =""")
  3. I don’t know how to collect the output of this function so that i can store it it in different registers which I can read on my PC. Any suggestions ?


Once you have your resulting joint angle in a variable within your script program:

angles = get_inverse_kin(pose)

Write the individual values back into RTDE output registers:


should work…


Is this what you meant? And then I use other function to readd the float registers

def get_inverse(self, pose, wait=True):
        if not self.robotConnector.RTDE.isRunning():
            self.__logger.error('RTDE need to be running to use get_inv_kin()')
            return False

    self.robotConnector.RTDE.setData('input_double_register_0', pose[0])
    self.robotConnector.RTDE.setData('input_double_register_1', pose[1])
    self.robotConnector.RTDE.setData('input_double_register_2', pose[2])
    self.robotConnector.RTDE.setData('input_double_register_3', pose[3])
    self.robotConnector.RTDE.setData('input_double_register_4', pose[4])
    self.robotConnector.RTDE.setData('input_double_register_5', pose[5])


    prog = '''def ur_inverse_kin():
        while True:
            global pose = [read_input_double_register(0),

            angles = get_inverse_kin(p{pose})
    programString = prog.format(**locals())

    if wait:

Yup looks like it should work to me. Have you tried it?

I had to write a functions that reads and writes to the registers in order to do it (because I use specific rtde package in python), I will try in next week (unfortunately i got access to the robot once a week only) and then I will post here if I succeeded or not

The RTDE interface is active in URSIM too, you shouldn’t need the real robot to test this.

Its been a while and I was experimenting more with it but without success, everytime I try to get the angles I get ‘None’ as output

This is what is the cause of it not working
This doesnt work, for some reason I cant call a variable that will hold a number inside the write_outpu_float_register(1,angles), it would work if i explicitly write write_output_float_register(1,2) but not with angles = 2
Any ideas why thats the case?

That is strange indeed. No obvious reason springs to mind just from looking at the code. Where are you seeing ‘None’?

For this type of problem, I’d recommend that you load the script into a program directly within Polyscope and execute it there. It’s a bit easier to debug that way as if there’s an issue with your code, you should see an error popup, where as you don’t get that running over the client interfaces.

Turns out it was an issue with indentation :crazy_face:
Here is a working final version.
Really appreciate your help, as always your guidance was able to help me solve the problem :grinning:

Glad to be of service :wink:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.