Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching Frames of Reference - Absolute Position of Joints #57

Open
caio-freitas opened this issue Jan 5, 2024 · 5 comments
Open

Matching Frames of Reference - Absolute Position of Joints #57

caio-freitas opened this issue Jan 5, 2024 · 5 comments
Assignees

Comments

@caio-freitas
Copy link
Owner

The absolute joint positions being used now in the graph_dataset.py are being calculated with forward kinematics from the franka panda robot. However, they don't necessary match the absolute position given by the Objects in the scene (are likely to be expressed in different frames of reference). This is particularly bad for the transport environment, where the positions are calculated for 2 different manipulators, and the transformation between the base links would be relevant.

One idea (very work-intensive) is to get these absolute positions from the mujoco environment somehow, reusing the datasets with the Robomimic playback_human_demonstration. Another quick fix is to find out the transformations for base link in these environments and add them when training.

@caio-freitas caio-freitas self-assigned this Jan 5, 2024
@caio-freitas
Copy link
Owner Author

@caio-freitas caio-freitas linked a pull request Jan 5, 2024 that will close this issue
@caio-freitas
Copy link
Owner Author

caio-freitas commented Jan 9, 2024

The whole mujoco model file can be get by playing back the dataset files and getting the env.get_state()["model"]. There all positions and orientations of objects in the Mujoco environment can be found.

For the lift dataset, name="robot0_base" pos="-0.56 0 0.912" (no quat defined, must be not rotated)

@caio-freitas
Copy link
Owner Author

For the Square, it's the same transform

@caio-freitas
Copy link
Owner Author

For the Transport, it's
robot0_base
pos="0 -0.81 0.912" quat="0.707107 0 0 0.707107"

robot1_base
pos="0 0.81 0.912" quat="0.707107 0 0 -0.707107"

@caio-freitas
Copy link
Owner Author

caio-freitas commented Apr 3, 2024

The function

def get_pos_from_xml(xml):
    '''
    Get position of robot base link from xml file
    '''
    filtered_lines = []
    lines = xml.split("\n")
    filtered_lines = [line for line in lines if "robot" in line and "pos=" in line and "link" in line]
    # extract positions from the filtered lines
    positions = []
    for line in filtered_lines:
        position = line.split("pos=")[1].split(" ")[:3]
        positions.append(position)
    return positions

Gets the joint positions from the XML file. They are, however, not absolute. The forward tree must be calculated from the transformations (with quaternions and positions) from baseline to EEF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant