-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add keypoints mode, and fix order of operations in add_tee
#13
Add keypoints mode, and fix order of operations in add_tee
#13
Conversation
body.position = position | ||
body.angle = angle | ||
body.position = position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I have empirically determined that this is correct, I'd much rather understand it and add a comment explaining what's going on before merging this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly, the rotation is made around a point that is different from the one used for the position. Therefore, rotating the object changes its position. Having the code in this order makes more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I did some testing and it seemed that setting the position moves the bodies in the object frame, whereas setting the angle rotates the object frame in the world frame (consistent with you explanation). But, it was really weird... because I couldn't always get it to work that way.
I'm not sure I have the appetite to fully resolve this right now though... but if someone else has problems in the future, they will have to figure it out.
is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
def get_keypoints(block_shapes): | ||
"""Get a (8, 2) numpy array with the T keypoints. | ||
|
||
The T is composed of two rectangles each with 4 keypoints. | ||
|
||
0───────────1 | ||
│ │ | ||
3───4───5───2 | ||
│ │ | ||
│ │ | ||
│ │ | ||
│ │ | ||
7───6 | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what an artist 🧑🎨
@qgallouedec Thanks. Yeah it is accessed in our dataset conversion script where we have to reconstruct the environment in order to access reward and now the keypoints. Since some prior methods are exposed and accessed for the same reason, I'm happy to leave it out of this PR if you are.
Done. |
Sure! Gym v1 is alpha anyway, we still have plenty of time to migrate |
This PR does two mostly disconnected things:
Adds an observation mode where keypoints and agent position are returned, as an alternative to
pixels_agent_pos
which returns an image and the agent position. This sort of keypoints-only environment allows us to circumvent using image encoders in the policy, which makes for a more agile experimentation setting.Fixes the order of angle and position setting in
add_tee
.You visualize the keypoints with this script:
The reason 2 (fix order of ops in add_tee) is here, is because when generating the keypoints-only dataset using this script I found out that the keypoints weren't aligned with the tee. In fact, I also discovered that the reward calculation was incorrect, for the same reason. By switching the order of ops, I was able to rectify both issues.