Skip to content

[MLA-1223] Backport Heuristic fixes #4176

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 2 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ public override void OnActionReceived(float[] vectorAction)

public override void Heuristic(float[] actionsOut)
{
actionsOut[0] = 0f;
actionsOut[1] = 0f;
actionsOut[2] = 0f;
if (Input.GetKey(KeyCode.D))
{
actionsOut[2] = 2f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public override void OnActionReceived(float[] vectorAction)

public override void Heuristic(float[] actionsOut)
{
Array.Clear(actionsOut, 0, actionsOut.Length);
//forward
if (Input.GetKey(KeyCode.W))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ public override void OnActionReceived(float[] vectorAction)

public override void Heuristic(float[] actionsOut)
{
System.Array.Clear(actionsOut, 0, actionsOut.Length);
if (Input.GetKey(KeyCode.D))
{
actionsOut[1] = 2f;
Expand Down
2 changes: 2 additions & 0 deletions com.unity.ml-agents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to
- Fixed an issue where RayPerceptionSensor would raise an exception when the
list of tags was empty, or a tag in the list was invalid (unknown, null, or
empty string). (#4155)
#### ml-agents / ml-agents-envs / gym-unity (Python)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to update this on master too.

- Fixed issue with FoodCollector, Soccer, and WallJump when playing with keyboard. (#4147, #4174)

## [1.0.2] - 2020-06-04
### Minor Changes
Expand Down
2 changes: 2 additions & 0 deletions com.unity.ml-agents/Runtime/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ public virtual void Initialize() {}
///
/// Your heuristic implementation can use any decision making logic you specify. Assign decision
/// values to the float[] array, <paramref name="actionsOut"/>, passed to your function as a parameter.
/// The same array will be reused between steps. It is up to the user to initialize
/// the values on each call, for example by calling `Array.Clear(actionsOut, 0, actionsOut.Length);`.
/// Add values to the array at the same indexes as they are used in your
/// <seealso cref="OnActionReceived(float[])"/> function, which receives this array and
/// implements the corresponding agent behavior. See [Actions] for more information
Expand Down