Esempio n. 1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Target"))
     {
         // if (!robotArmAgent.HasTarget()) {
         //     robotArmAgent.SetTarget(other.transform);
         // }
         if (area.IsTrainingArea())
         {
             if (academy.resetParameters["staycount"] == 0f)
             {
                 AddReward(5f);
                 AddReward(-1f * Mathf.Abs(wheelVehicle.Speed));
                 Debug.Log("SUCCESS");
                 ResultLogger.AddSuccess();
                 ResultLogger.LogRatio();
                 Done();
             }
             else
             {
                 AddReward(1f);
             }
         }
         if (OnTargetEnter != null)
         {
             OnTargetEnter.Invoke(other.transform);
         }
     }
 }
Esempio n. 2
0
 private void SetupEvents()
 {
     // called when the target object stays in the container
     container.OnGoalStay = () => {
         if (brain != NoTargetBrain)
         {
             // check if not holding object anymore
             if (!robotArm.IsHoldingObject())
             {
                 AddReward(4f);
                 Debug.Log("Drop Success with: " + GetCumulativeReward());
                 // for debugging (counts successes)
                 ResultLogger.AddSuccess();
                 ResultLogger.LogRatio();
                 // invoke callback for success
                 if (OnTargetDroppedSuccessfully != null)
                 {
                     OnTargetDroppedSuccessfully.Invoke(target);
                 }
                 container.OnGoalStay = null;
                 target = null;
                 if (DoneOnDrop)
                 {
                     Done();
                 }
             }
         }
     };
 }
Esempio n. 3
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.CompareTag("Target"))
     {
         // just test stay if training
         if (area.IsTrainingArea())
         {
             if (academy.resetParameters["staycount"] != 0f)
             {
                 staycounter++;
                 if (staycounter > academy.resetParameters["staycount"])
                 {
                     staycounter = -5000;
                     AddReward(5f);
                     AddReward(-1f * Mathf.Abs(wheelVehicle.Speed));
                     Debug.Log("SUCCESS");
                     ResultLogger.AddSuccess();
                     ResultLogger.LogRatio();
                     Done();
                 }
             }
         }
     }
 }