添加单车底盘仿真平台并完善运动控制与夹臂功能
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
using MyParking.Simulation.Core;
|
||||
|
||||
namespace MyParking.Simulation.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// 内置离线测试动作;新增带特性的方法后网页会自动生成按钮。
|
||||
/// </summary>
|
||||
public static class BuiltInSimulationActions
|
||||
{
|
||||
[SimulationAction(
|
||||
"mode-normal",
|
||||
"正常",
|
||||
"舵轮模式",
|
||||
10)]
|
||||
public static bool NormalMode(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
return vehicle.SetMode("Normal");
|
||||
}
|
||||
|
||||
[SimulationAction(
|
||||
"mode-crab-left",
|
||||
"左蟹行",
|
||||
"舵轮模式",
|
||||
20)]
|
||||
public static bool CrabLeftMode(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
return vehicle.SetMode("CrabLeft");
|
||||
}
|
||||
|
||||
[SimulationAction(
|
||||
"mode-crab-right",
|
||||
"右蟹行",
|
||||
"舵轮模式",
|
||||
30)]
|
||||
public static bool CrabRightMode(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
return vehicle.SetMode("CrabRight");
|
||||
}
|
||||
|
||||
[SimulationAction(
|
||||
"mode-spin",
|
||||
"自转",
|
||||
"舵轮模式",
|
||||
40)]
|
||||
public static bool SpinMode(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
return vehicle.SetMode("Spin");
|
||||
}
|
||||
|
||||
[SimulationAction(
|
||||
"forward",
|
||||
"前进",
|
||||
"运动测试",
|
||||
10)]
|
||||
public static bool Forward(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
return vehicle.Move(1.0);
|
||||
}
|
||||
|
||||
[SimulationAction(
|
||||
"turn-left",
|
||||
"左转",
|
||||
"运动测试",
|
||||
20)]
|
||||
public static bool TurnLeft(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
return vehicle.Turn(1.0);
|
||||
}
|
||||
|
||||
[SimulationAction(
|
||||
"stop",
|
||||
"停止",
|
||||
"运动测试",
|
||||
30)]
|
||||
public static bool Stop(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
vehicle.Stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
[SimulationAction(
|
||||
"turn-right",
|
||||
"右转",
|
||||
"运动测试",
|
||||
40)]
|
||||
public static bool TurnRight(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
return vehicle.Turn(-1.0);
|
||||
}
|
||||
|
||||
[SimulationAction(
|
||||
"backward",
|
||||
"后退",
|
||||
"运动测试",
|
||||
50)]
|
||||
public static bool Backward(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
return vehicle.Move(-1.0);
|
||||
}
|
||||
|
||||
[SimulationAction(
|
||||
"reset",
|
||||
"单车复位",
|
||||
"维护",
|
||||
10)]
|
||||
public static bool Reset(
|
||||
SimulationVehicle vehicle)
|
||||
{
|
||||
vehicle.Reset();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user