-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[MLA-1135] Physics sensors - optional reference body #4276
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
Changes from all commits
e3adeb6
7e75f12
8fd680a
95465af
657aa86
5d7f101
0b62125
fb24874
60c4ae7
03e0e3b
5e3829c
3e27b22
0243155
ce254bb
10755c3
6128991
cc14a68
6e6999c
2ab589b
f6c1a75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,17 +91,8 @@ public void CollectObservationBodyPart(BodyPart bp, VectorSensor sensor) | |
//GROUND CHECK | ||
sensor.AddObservation(bp.groundContact.touchingGround); // Is this bp touching the ground | ||
|
||
//Get velocities in the context of our orientation cube's space | ||
//Note: You can get these velocities in world space as well but it may not train as well. | ||
sensor.AddObservation(orientationCube.transform.InverseTransformDirection(bp.rb.velocity)); | ||
sensor.AddObservation(orientationCube.transform.InverseTransformDirection(bp.rb.angularVelocity)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No direct correspondence, but removing it didn't seem to hurt much. I also need to convince myself that you can just transform angular velocities like that. |
||
|
||
//Get position relative to hips in the context of our orientation cube's space | ||
sensor.AddObservation(orientationCube.transform.InverseTransformDirection(bp.rb.position - body.position)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corresponds to model space positions |
||
|
||
if (bp.rb.transform != body) | ||
{ | ||
sensor.AddObservation(bp.rb.transform.localRotation); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corresponds to local space rotations There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are these decisions that could have been made with the help of the tool @andrewcoh was talking about for saliency? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, I removed everything from CollectObservations that had an equivalent in the sensor. In general, we could turn everything on in the sensor, run the tool to see what's important, and then disable unimportant stuff. However:
|
||
sensor.AddObservation(bp.currentStrength / m_JdController.maxJointForceLimit); | ||
} | ||
} | ||
|
@@ -111,9 +102,6 @@ public void CollectObservationBodyPart(BodyPart bp, VectorSensor sensor) | |
/// </summary> | ||
public override void CollectObservations(VectorSensor sensor) | ||
{ | ||
//Add body rotation delta relative to orientation cube | ||
sensor.AddObservation(Quaternion.FromToRotation(body.forward, orientationCube.transform.forward)); | ||
|
||
//Add pos of target relative to orientation cube | ||
sensor.AddObservation(orientationCube.transform.InverseTransformPoint(target.transform.position)); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# ML-Agents Extensions | ||
|
||
This is a source-only package for new features based on ML-Agents. | ||
|
||
More details coming soon. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("Unity.ML-Agents.Extensions.EditorTests")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -54,17 +54,17 @@ public ArticulationBodyPoseExtractor(ArticulationBody rootBody) | |||
parentIndices[i] = bodyToIndex[parentArticBody]; | ||||
} | ||||
|
||||
SetParentIndices(parentIndices); | ||||
Setup(parentIndices); | ||||
} | ||||
|
||||
/// <inheritdoc/> | ||||
protected override Vector3 GetLinearVelocityAt(int index) | ||||
protected internal override Vector3 GetLinearVelocityAt(int index) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the internal addition? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wanted to be able to assert on it ml-agents/com.unity.ml-agents.extensions/Tests/Editor/Sensors/RigidBodyPoseExtractorTests.cs Line 67 in 7e75f12
|
||||
{ | ||||
return m_Bodies[index].velocity; | ||||
} | ||||
|
||||
/// <inheritdoc/> | ||||
protected override Pose GetPoseAt(int index) | ||||
protected internal override Pose GetPoseAt(int index) | ||||
{ | ||||
var body = m_Bodies[index]; | ||||
var go = body.gameObject; | ||||
|
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.
Corresponds to model space velocity