Skip to content

Refactor RayPerception and add RayPerception2D #1793

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

Merged
merged 7 commits into from
Mar 13, 2019

Conversation

awjuliani
Copy link
Contributor

No description provided.

@awjuliani awjuliani requested a review from vincentpierre March 6, 2019 19:27
@@ -28,7 +28,7 @@ public class BananaAgent : Agent
public Material frozenMaterial;
public GameObject myLaser;
public bool contribute;
private RayPerception rayPer;
private RayPerception3D rayPer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to break people's existing code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every major release involves breaking changes.

return degree * Mathf.PI / 180f;
}
}
public class RayPerception : MonoBehaviour {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be abstract ? Can this be made into an interface ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It should be abstract. It is not an interface because it includes static helper methods, and a declarations for variables.

/// <param name="rayDistance">Radius of rays</param>
/// <param name="rayAngles">Angles of rays (starting from (1,0) on unit circle).</param>
/// <param name="detectableObjects">List of tags which correspond to object types agent can see</param>
public List<float> Perceive(float rayDistance,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this have a unit test ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

/// <param name="detectableObjects">List of tags which correspond to object types agent can see</param>
/// <param name="startOffset">Starting height offset of ray from center of agent.</param>
/// <param name="endOffset">Ending height offset of ray from center of agent.</param>
public override List<float> Perceive(float rayDistance,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this have a unit-test too ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@Unity-Technologies Unity-Technologies deleted a comment Mar 13, 2019
@Unity-Technologies Unity-Technologies deleted a comment Mar 13, 2019
@Unity-Technologies Unity-Technologies deleted a comment Mar 13, 2019
@Unity-Technologies Unity-Technologies deleted a comment Mar 13, 2019
@Unity-Technologies Unity-Technologies deleted a comment Mar 13, 2019
@Unity-Technologies Unity-Technologies deleted a comment Mar 13, 2019
@awjuliani awjuliani merged commit fabc14f into develop Mar 13, 2019
@awjuliani awjuliani deleted the develop-rayperception branch March 13, 2019 20:03
LeSphax pushed a commit to LeSphax/ml-agents-1 that referenced this pull request May 3, 2020
* Fix typos

* Use abstract class for rayperception

* Created RayPerception2D. (Unity-Technologies#1721)

* Incorporate RayPerception2D

* Fix typo

* Make abstract class

* Add tests
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants