-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added bumper & velocity publisher, control noise. Improved results ou…
…tput. Changed score balance. - Added bumper publisher and velocity publisher. Velocity publisher has noise. - Added noise to control. No more perfect localization. - Improved results.txt output including info for seed, time, and score. - Obstacles: none from 8x to 15x, hard from 0.4x to 0.1x. - Noise: none from 8x to 10x.
- Loading branch information
1 parent
6cbef72
commit 44ccd66
Showing
13 changed files
with
217 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using UnityEngine; | ||
|
||
namespace RosSharp.RosBridgeClient.MessageTypes.Std | ||
{ | ||
public class BumperPublisher : UnityPublisher<Bool> | ||
{ | ||
private Bool message; | ||
protected override void Start() | ||
{ | ||
base.Start(); | ||
message = new Bool(); | ||
} | ||
|
||
private void OnTriggerEnter(Collider other) { | ||
message.data = true; | ||
Publish(message); | ||
} | ||
|
||
private void OnTriggerExit(Collider other) { | ||
message.data = false; | ||
Publish(message); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using UnityEngine; | ||
|
||
namespace RosSharp.RosBridgeClient.MessageTypes.Std | ||
{ | ||
[RequireComponent(typeof(AckermannController))] | ||
public class VelocityPublisher : UnityPublisher<Float32> | ||
{ | ||
private Float32 message; | ||
|
||
private float velocityNoiseStdDev = 0.1f; | ||
|
||
private float previousScanTime = 5; | ||
private float updatePeriod = 0.05f; | ||
private AckermannController c; | ||
|
||
protected override void Start() | ||
{ | ||
base.Start(); | ||
c = GetComponent<AckermannController>(); | ||
message = new Float32(); | ||
|
||
switch (ConfigLoader.competition.NoiseLevel) { | ||
case ConfigLoader.CompetitionConfig.NoiseLevels.none: | ||
velocityNoiseStdDev *= 0; | ||
break; | ||
case ConfigLoader.CompetitionConfig.NoiseLevels.reduced: | ||
velocityNoiseStdDev *= 0.5f; | ||
break; | ||
} | ||
} | ||
|
||
private void FixedUpdate() | ||
{ | ||
if (UnityEngine.Time.realtimeSinceStartup >= previousScanTime + updatePeriod) | ||
{ | ||
WriteMessage(); | ||
previousScanTime = UnityEngine.Time.realtimeSinceStartup; | ||
} | ||
} | ||
|
||
private void WriteMessage() { | ||
message.data = Mathf.Round((c.Power + SimUtils.getRandNormal(0, velocityNoiseStdDev) * c.Power / 4.0f) * 1000f) / 1000f; | ||
Publish(message); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.