TriPed-Robot / trip_kinematics

Python package for inverse kinematic calculations of hybrid serial parallel robots

Home Page:https://trip-kinematics.readthedocs.io/en/main/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Group init stuck in infinite loop

liquidcronos opened this issue · comments

The following code snippet gets the init function of the KinematicGroup stuck:

import trip_kinematics as trip

first_joint = trip.Transformation(
    'q1', values={'rz': 0}, state_variables=['rz'])
first_link = trip.Transformation('l1', values={'tx': 1}, parent=first_joint)
second_joint = trip.Transformation(
    'q2', values={'rz': 0}, state_variables=['rz'], parent=first_link)
second_link = trip.Transformation('l1', values={'tx': 1}, parent=second_joint)


def get_noisy_from_true_value(state):
    return {'q1': state['q1']['rz'],
            'q2': state['q2']['rz']}


def set_noisy_to_true_value(state):
    return {'q1': {'rz': state['q1']}, 'q2': {'ry': state['q2']}}


noisy_model = trip.KinematicGroup('noisy_model',
                                  [first_joint, first_link,
                                      second_joint, second_link],
                                  actuated_state={'q1': 0, 'q2': 0},
                                  actuated_to_virtual=set_noisy_to_true_value,
                                  virtual_to_actuated=get_noisy_from_true_value)

When interrupting the code execution the following terminal output appears:

File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\trip_kinematics\KinematicGroup.py", line 139, in __init__
    self._chain_keys.append(current_key)
KeyboardInterrupt

This suggests that the bug is caused within the while loop in line 134.

changing the names of the actuated state to be different than the names of the transformations does not solve this problem

The error seems to be caused by multiple transformations having the same name, leading to a infinte loop while ordering