本文整理汇总了C#中IState.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IState.ToString方法的具体用法?C# IState.ToString怎么用?C# IState.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IState
的用法示例。
在下文中一共展示了IState.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update()
{
if (isServer)
{
currentState = currentState.OnStateUpdate();
CURRENT_STATE = currentState.ToString();
}
}
示例2: GoalsSatisfied
internal bool GoalsSatisfied(Pair<Set<CompoundTerm>, Set<Term>> simpleAndFsmGoals, IState state)
{
if (typeof(SimpleState) == state.GetType())
{
//currently not yet implemented
return true;
}
else if (typeof(FsmState) == state.GetType())
{
FsmState fsmState =(FsmState)state;
Console.WriteLine("Comparing FsmState: " + state.ToString() + " to " + simpleAndFsmGoals.Second);
if (fsmState.AutomatonStates.IsSupersetOf(simpleAndFsmGoals.Second))
return true;
}
else if (typeof(PairState) == state.GetType()) {
PairState pairState = (PairState)state;
return GoalsSatisfied(simpleAndFsmGoals, pairState.First) && GoalsSatisfied(simpleAndFsmGoals, pairState.Second);
}
return false;
}
示例3: Update
// Update is called once per frame
void Update ()
{
currentState = currentState.OnStateUpdate();
CURRENT_STATE = currentState.ToString();
}
示例4: LogOriginStateOperation
private static void LogOriginStateOperation(string operation, int origin, IState state)
{
Debug.Write($"{origin.ToString().PadRight(50)}{state.ToString().PadRight(50)}{operation}");
}
示例5: Plan
//.........这里部分代码省略.........
{
// notify
ArbiterOutput.Output("Turn with Saudi L1 Level failed");
// get an intersection plan without this interconnect
IntersectionPlan testPlan = CoreCommon.Navigation.PlanIntersectionWithoutInterconnect(
waies.exitWaypoint,
CoreCommon.RoadNetwork.ArbiterWaypoints[CoreCommon.Mission.MissionCheckpoints.Peek().WaypointId],
waies.desired);
// check that the plan exists
if (!testPlan.BestOption.ToInterconnect.Equals(waies.desired) &&
testPlan.BestRouteTime < double.MaxValue - 1.0)
{
// get the desired interconnect
ArbiterInterconnect reset = testPlan.BestOption.ToInterconnect;
#region Check that the reset interconnect is feasible
// test the reset interconnect
TurnBehavior testResetTurnBehavior = this.DefaultTurnBehavior(reset);
// set to ignore all vehicles
testResetTurnBehavior.VehiclesToIgnore = new List<int>(new int[] { -1 });
// check if we have completed
CompletionReport turnResetCompletionReport;
bool completedResetTest = CoreCommon.Communications.TestExecute(testResetTurnBehavior, out turnResetCompletionReport);
// check to see if this is feasible
if (completedResetTest && turnResetCompletionReport is SuccessCompletionReport && reset.Blockage.ProbabilityExists < 0.95)
{
// notify
ArbiterOutput.Output("Found clear interconnect: " + reset.ToString() + " adding blockage to current interconnect: " + waies.desired.ToString());
// set the interconnect as being blocked
CoreCommon.Navigation.AddInterconnectBlockage(waies.desired);
// reset all
waies.desired = reset;
waies.turnTestState = TurnTestState.Completed;
waies.saudi = SAUDILevel.None;
waies.useTurnBounds = true;
IntersectionMonitor.ResetDesired(reset);
}
#endregion
#region No Lane Bounds
// otherwise try without lane bounds
else
{
// notify
ArbiterOutput.Output("Had to fallout to using no turn bounds");
// up the saudi level, set as turn failed and no other option
waies.saudi = SAUDILevel.L1;
waies.turnTestState = TurnTestState.Completed;
waies.useTurnBounds = false;
}
#endregion
}
#region No Lane Bounds
示例6: Update
private void Update()
{
currentState = currentState.Update();
DEBUG_CurrentState = currentState.ToString();
}
示例7: Plan
/// <summary>
/// Plans what maneuer we should take next
/// </summary>
/// <param name="planningState"></param>
/// <param name="navigationalPlan"></param>
/// <param name="vehicleState"></param>
/// <param name="vehicles"></param>
/// <param name="obstacles"></param>
/// <param name="blockage"></param>
/// <returns></returns>
public Maneuver Plan(IState planningState, RoadPlan navigationalPlan, VehicleState vehicleState,
SceneEstimatorTrackedClusterCollection vehicles, SceneEstimatorUntrackedClusterCollection obstacles,
List<ITacticalBlockage> blockages, double vehicleSpeed)
{
// assign vehicles to their lanes
this.roadMonitor.Assign(vehicles);
// navigation tasks
this.taskReasoning.navigationPlan = navigationalPlan;
#region Stay in lane
// maneuver given we are in a lane
if (planningState is StayInLaneState)
{
// get state
StayInLaneState sils = (StayInLaneState)planningState;
// check reasoning if needs to be different
if (this.forwardReasoning == null || !this.forwardReasoning.Lane.Equals(sils.Lane))
{
if (sils.Lane.LaneOnLeft == null)
this.leftLateralReasoning = new LateralReasoning(null, SideObstacleSide.Driver);
else if (sils.Lane.LaneOnLeft.Way.Equals(sils.Lane.Way))
this.leftLateralReasoning = new LateralReasoning(sils.Lane.LaneOnLeft, SideObstacleSide.Driver);
else
this.leftLateralReasoning = new OpposingLateralReasoning(sils.Lane.LaneOnLeft, SideObstacleSide.Driver);
if (sils.Lane.LaneOnRight == null)
this.rightLateralReasoning = new LateralReasoning(null, SideObstacleSide.Passenger);
else if (sils.Lane.LaneOnRight.Way.Equals(sils.Lane.Way))
this.rightLateralReasoning = new LateralReasoning(sils.Lane.LaneOnRight, SideObstacleSide.Passenger);
else
this.rightLateralReasoning = new OpposingLateralReasoning(sils.Lane.LaneOnRight, SideObstacleSide.Passenger);
this.forwardReasoning = new ForwardReasoning(this.leftLateralReasoning, this.rightLateralReasoning, sils.Lane);
}
// populate navigation with road plan
taskReasoning.SetRoadPlan(navigationalPlan, sils.Lane);
// as penalties for lane changes already taken into account, can just look at
// best lane plan to figure out what to do
TypeOfTasks bestTask = taskReasoning.Best;
// get the forward lane plan
Maneuver forwardManeuver = forwardReasoning.ForwardManeuver(sils.Lane, vehicleState, navigationalPlan, blockages, sils.WaypointsToIgnore);
// get the secondary
Maneuver? secondaryManeuver = forwardReasoning.AdvancedSecondary(sils.Lane, vehicleState, navigationalPlan, blockages, sils.WaypointsToIgnore, bestTask); //forwardReasoning.SecondaryManeuver(sils.Lane, vehicleState, navigationalPlan, blockages, sils.WaypointsToIgnore, bestTask);
// check behavior type for uturn
if (secondaryManeuver.HasValue && secondaryManeuver.Value.PrimaryBehavior is UTurnBehavior)
return secondaryManeuver.Value;
// check if we wish to change lanes here
if (bestTask != TypeOfTasks.Straight)
{
// parameters
LaneChangeParameters parameters;
secondaryManeuver = this.forwardReasoning.AdvancedDesiredLaneChangeManeuver(sils.Lane, bestTask == TypeOfTasks.Left ? true : false, navigationalPlan.BestPlan.laneWaypointOfInterest.PointOfInterest,
navigationalPlan, vehicleState, blockages, sils.WaypointsToIgnore, new LaneChangeInformation(LaneChangeReason.Navigation, this.forwardReasoning.ForwardMonitor.ForwardVehicle.CurrentVehicle), secondaryManeuver, out parameters);
}
// final maneuver
Maneuver finalManeuver = secondaryManeuver.HasValue ? secondaryManeuver.Value : forwardManeuver;
// set opposing vehicle flag
if (false && this.leftLateralReasoning != null && this.leftLateralReasoning is OpposingLateralReasoning && finalManeuver.PrimaryBehavior is StayInLaneBehavior)
{
StayInLaneBehavior silb = (StayInLaneBehavior)finalManeuver.PrimaryBehavior;
OpposingLateralReasoning olr = (OpposingLateralReasoning)this.leftLateralReasoning;
olr.ForwardMonitor.ForwardVehicle.Update(olr.lane, vehicleState);
if (olr.ForwardMonitor.ForwardVehicle.CurrentVehicle != null)
{
ForwardVehicleTrackingControl fvtc = olr.ForwardMonitor.ForwardVehicle.GetControl(olr.lane, vehicleState);
BehaviorDecorator[] bds = new BehaviorDecorator[finalManeuver.PrimaryBehavior.Decorators.Count];
finalManeuver.PrimaryBehavior.Decorators.CopyTo(bds);
finalManeuver.PrimaryBehavior.Decorators = new List<BehaviorDecorator>(bds);
silb.Decorators.Add(new OpposingLaneDecorator(fvtc.xSeparation, olr.ForwardMonitor.ForwardVehicle.CurrentVehicle.Speed));
ArbiterOutput.Output("Added Opposing Lane Decorator: " + fvtc.xSeparation.ToString("F2") + "m, " + olr.ForwardMonitor.ForwardVehicle.CurrentVehicle.Speed.ToString("f2") + "m/s");
}
finalManeuver.PrimaryBehavior = silb;
}
// return the final
return finalManeuver;
}
#endregion
//.........这里部分代码省略.........
示例8: ToInts
public static int[] ToInts(IState s)
{
return s.ToString().ToCharArray().Select(x => Convert.ToInt32(x) - 0x30).ToArray();
}