feat: add read-only EM observation movement test
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using MultiWheelC.TrajectoryPlanning.CoarsePath;
|
||||
using MultiWheelC.TrajectoryPlanning.CoarsePath.Facade;
|
||||
@@ -14,6 +15,7 @@ internal static class TrajectoryObservationChecks
|
||||
{
|
||||
public static void Run()
|
||||
{
|
||||
VerifiesObservationSourceHasNoActuatorCalls();
|
||||
VerifiesStartGoalBoundsUseOnlyConfiguredPadding();
|
||||
RejectsObstacleOutsideConfiguredBounds();
|
||||
VerifiesLsAndStUsePublishedTrajectoryData();
|
||||
@@ -23,6 +25,30 @@ internal static class TrajectoryObservationChecks
|
||||
FreezesBootstrapVehicleForRollingRequests();
|
||||
}
|
||||
|
||||
private static void VerifiesObservationSourceHasNoActuatorCalls()
|
||||
{
|
||||
string sourceDirectory = Path.Combine(Directory.GetCurrentDirectory(), "ClumsyPilot",
|
||||
"ParkrobTrajplanner", "tarjplanner_movementtest");
|
||||
string movementTestSource = Path.Combine(sourceDirectory, "MovementTest.TrajectoryObservationTest.cs");
|
||||
Verification.True(File.Exists(movementTestSource), "observation MovementTest source exists");
|
||||
|
||||
string[] forbiddenTokens =
|
||||
{
|
||||
".SendXYThSpeed(", ".SendMotion(", ".SendTh(", ".AccumulateSpeed(",
|
||||
".ComputeWheelsGeometrically(", ".DriveStop(", ".PredefinedDriveStop("
|
||||
};
|
||||
string[] runtimeSources = Directory.GetFiles(sourceDirectory, "*.cs", SearchOption.TopDirectoryOnly);
|
||||
for (int sourceIndex = 0; sourceIndex < runtimeSources.Length; sourceIndex++)
|
||||
{
|
||||
string source = File.ReadAllText(runtimeSources[sourceIndex]);
|
||||
for (int tokenIndex = 0; tokenIndex < forbiddenTokens.Length; tokenIndex++)
|
||||
{
|
||||
Verification.True(source.IndexOf(forbiddenTokens[tokenIndex], StringComparison.Ordinal) < 0,
|
||||
"observation runtime source excludes actuator token " + forbiddenTokens[tokenIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void VerifiesStartGoalBoundsUseOnlyConfiguredPadding()
|
||||
{
|
||||
var settings = new TrajectoryObservationSettings
|
||||
|
||||
Reference in New Issue
Block a user