This commit is contained in:
yzx 2024-01-02 21:07:44 +08:00
parent 8c5178c17c
commit 3fc0900f23
14 changed files with 1997 additions and 45 deletions

View File

@ -691426,7 +691426,7 @@ PrefabInstance:
- target: {fileID: 2815687268591738351, guid: 299ef976ddfafad4daa8e07b81465542,
type: 3}
propertyPath: m_RootOrder
value: 13
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2815687268591738351, guid: 299ef976ddfafad4daa8e07b81465542,
type: 3}

View File

@ -133,7 +133,6 @@ GameObject:
m_Component:
- component: {fileID: 466370289}
- component: {fileID: 466370290}
- component: {fileID: 466370291}
m_Layer: 0
m_Name: APP
m_TagString: Untagged
@ -167,18 +166,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: beb73c429dba468f8a8c37893d1204b8, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &466370291
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 466370288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 374ccbdc1a0c8d8478a9e49fd1215a18, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &634617318
GameObject:
m_ObjectHideFlags: 0

View File

@ -15,9 +15,8 @@ namespace Script
{
public GameObject ui3d;
public GameObject ui2d;
private VehicleController vehicleController;
private VehicleStandardInput vehicleStandardInput;
@ -64,12 +63,12 @@ namespace Script
private bool dianhuo = false;
void Start()
void Start()
{
vehicleController = GetComponent<VehicleController>();
vehicleStandardInput = GetComponent<VehicleStandardInput>();
// StartModbus();
StartModbus();
ModBusQueue();
}
@ -100,20 +99,21 @@ namespace Script
{
while (true)
{
// Debug.Log(client.modbusQueue.Count);
// if (client.modbusQueue.Count > 0)
// {
// // Debug.Log(client.modbusQueue.Count);
//
// carData = client.modbusQueue.Dequeue();
try
{
if (ModbusTcpClient.modbusTcpClient.modbusQueue.Count > 0)
// Debug.Log(client.modbusQueue.Count);
if (client.modbusQueue.Count > 0)
{
// Debug.Log(ModbusTcpClient.modbusTcpClient.modbusQueue.Count);
// Debug.Log(client.modbusQueue.Count);
carData = ModbusTcpClient.modbusTcpClient.modbusQueue.Dequeue();
carData = client.modbusQueue.Dequeue();
// if (ModbusTcpClient.modbusTcpClient.modbusQueue.Count > 0)
// {
// // Debug.Log(ModbusTcpClient.modbusTcpClient.modbusQueue.Count);
//
// carData = ModbusTcpClient.modbusTcpClient.modbusQueue.Dequeue();
//方向盘
@ -371,15 +371,13 @@ namespace Script
}
}
}
}
catch (Exception e)
{
// Console.WriteLine(e);
// throw;
}
await Task.Delay(TimeSpan.FromSeconds(.1));
}
}
@ -393,7 +391,7 @@ namespace Script
{
thirdPerson.SetActive(false);
firstPerson.SetActive(true);
ui3d.SetActive(true);
ui2d.SetActive(false);
}
@ -401,8 +399,8 @@ namespace Script
{
thirdPerson.SetActive(true);
firstPerson.SetActive(false);
ui3d.SetActive(false);
ui2d.SetActive(true);
}

View File

@ -195,7 +195,14 @@ public class CarInfoManager : MonoBehaviour
private void OnDestroy()
{
cancellationTokenSource.Cancel();
cancellationTokenSource = null;
try
{
cancellationTokenSource.Cancel();
cancellationTokenSource = null;
}
catch (Exception e)
{
Debug.Log(e.Message);
}
}
}

View File

@ -44,7 +44,7 @@ namespace ModbusManager
private void Start()
{
StartModbus();
// StartModbus();
}
@ -169,7 +169,7 @@ namespace ModbusManager
carStatusData.IgnitionSwitch = dataValue;
break;
case 1://左打方向盘为负数右打方向盘为正数打方向盘打死一圈半数值1500。
// Debug.Log($"方向盘数据: {(short)dataValue}");
Debug.Log($"方向盘数据: {(short)dataValue}");
carStatusData.SteeringWheelAngle = (short)dataValue;
break;
case 2://01为喇叭按下
@ -181,7 +181,7 @@ namespace ModbusManager
carStatusData.BrakePedalPosition = dataValue;
break;
case 4://0-100,踩到底为100
Debug.Log($"油门踏板数据: {dataValue}");
// Debug.Log($"油门踏板数据: {dataValue}");
carStatusData.AcceleratorPedalPosition = dataValue;
break;
case 5://0-100,踩到底为100

View File

@ -30,16 +30,34 @@ public class SteeringWheelController : MonoBehaviour
private int NewValue = -1;
private bool ClutchPedalPositionBool = false;
private ModbusTcpClient client;
private void Awake()
{
Instance = this;
}
private void Start()
private async void Start()
{
StartModbus();
ModBusQueue();
}
async Task StartModbus()
{
client = new ModbusTcpClient();
await client.ConnectToServer();
while (true)
{
await client.SendModbusRequest();
await Task.Delay(TimeSpan.FromSeconds(.1));
}
}
private void OnDestroy()
{
client.CloseConnection();
}
// void Update()
// {
@ -71,9 +89,9 @@ public class SteeringWheelController : MonoBehaviour
while (true)
{
// Debug.Log(client.modbusQueue.Count);
if (ModbusTcpClient.modbusTcpClient.modbusQueue.Count > 0)
if (client.modbusQueue.Count > 0)
{
CarStatusData carData = ModbusTcpClient.modbusTcpClient.modbusQueue.Dequeue();
CarStatusData carData = client.modbusQueue.Dequeue();
if (carData.AcceleratorPedalPosition > 30)
{

View File

@ -0,0 +1,77 @@
Using pre-set license
Built from '2021.1/staging' branch; Version is '2021.1.24f1 (6667702a1e7c) revision 6711152'; Using compiler version '192528614'; Build Type 'Release'
OS: 'Windows 10 Pro; OS build 19044.1682; Version 2009; 64bit' Language: 'zh' Physical Memory: 16197 MB
BatchMode: 1, IsHumanControllingUs: 0, StartBugReporterOnCrash: 0, Is64bit: 1, IsPro: 0
COMMAND LINE ARGUMENTS:
D:\2021.1.24f1\Editor\Unity.exe
-adb2
-batchMode
-noUpm
-name
AssetImportWorker0
-projectPath
E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem
-logFile
Logs/AssetImportWorker0.log
-srvPort
54624
Successfully changed project path to: E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem
E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem
Using Asset Import Pipeline V2.
Refreshing native plugins compatible for Editor in 251.71 ms, found 8 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Initialize engine version: 2021.1.24f1 (6667702a1e7c)
[Subsystems] Discovering subsystems at path D:/2021.1.24f1/Editor/Data/Resources/UnitySubsystems
[Subsystems] Discovering subsystems at path E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem/Assets
GfxDevice: creating device client; threaded=0; jobified=0
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: NVIDIA GeForce GTX 1660 SUPER (ID=0x21c4)
Vendor: NVIDIA
VRAM: 5981 MB
Driver: 31.0.15.4617
Shader 'Custom/EVP Particles Alpha Blended Shadows': fallback shader 'Particles/Alpha Blended' not found
Initialize mono
Mono path[0] = 'D:/2021.1.24f1/Editor/Data/Managed'
Mono path[1] = 'D:/2021.1.24f1/Editor/Data/MonoBleedingEdge/lib/mono/unityjit'
Mono config path = 'D:/2021.1.24f1/Editor/Data/MonoBleedingEdge/etc'
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=127.0.0.1:56812
Begin MonoManager ReloadAssembly
Registering precompiled unity dll's ...
Register platform support module: D:/2021.1.24f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll
Registered in 0.000943 seconds.
Native extension for WindowsStandalone target not found
Refreshing native plugins compatible for Editor in 201.77 ms, found 8 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Mono: successfully reloaded assembly
- Completed reload, in 1.934 seconds
Domain Reload Profiling:
ReloadAssembly (1935ms)
BeginReloadAssembly (58ms)
ExecutionOrderSort (0ms)
DisableScriptedObjects (0ms)
BackupInstance (0ms)
ReleaseScriptingObjects (0ms)
CreateAndSetChildDomain (1ms)
EndReloadAssembly (622ms)
LoadAssemblies (57ms)
RebuildTransferFunctionScriptingTraits (0ms)
SetupTypeCache (166ms)
ReleaseScriptCaches (0ms)
RebuildScriptCaches (37ms)
SetupLoadedEditorAssemblies (369ms)
LogAssemblyErrors (0ms)
InitializePlatformSupportModulesInManaged (7ms)
SetLoadedEditorAssemblies (0ms)
RefreshPlugins (202ms)
BeforeProcessingInitializeOnLoad (2ms)
ProcessInitializeOnLoadAttributes (114ms)
ProcessInitializeOnLoadMethodAttributes (44ms)
AfterProcessingInitializeOnLoad (0ms)
EditorAssembliesLoaded (0ms)
ExecutionOrderSort2 (0ms)
AwakeInstancesAfterBackupRestoration (0ms)
Platform modules already initialized, skipping
Registering precompiled user dll's ...
Registered in 0.006615 seconds.

View File

@ -0,0 +1,77 @@
Using pre-set license
Built from '2021.1/staging' branch; Version is '2021.1.24f1 (6667702a1e7c) revision 6711152'; Using compiler version '192528614'; Build Type 'Release'
OS: 'Windows 10 Pro; OS build 19044.1682; Version 2009; 64bit' Language: 'zh' Physical Memory: 16197 MB
BatchMode: 1, IsHumanControllingUs: 0, StartBugReporterOnCrash: 0, Is64bit: 1, IsPro: 0
COMMAND LINE ARGUMENTS:
D:\2021.1.24f1\Editor\Unity.exe
-adb2
-batchMode
-noUpm
-name
AssetImportWorker1
-projectPath
E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem
-logFile
Logs/AssetImportWorker1.log
-srvPort
54624
Successfully changed project path to: E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem
E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem
Using Asset Import Pipeline V2.
Refreshing native plugins compatible for Editor in 229.77 ms, found 8 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Initialize engine version: 2021.1.24f1 (6667702a1e7c)
[Subsystems] Discovering subsystems at path D:/2021.1.24f1/Editor/Data/Resources/UnitySubsystems
[Subsystems] Discovering subsystems at path E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem/Assets
GfxDevice: creating device client; threaded=0; jobified=0
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: NVIDIA GeForce GTX 1660 SUPER (ID=0x21c4)
Vendor: NVIDIA
VRAM: 5981 MB
Driver: 31.0.15.4617
Shader 'Custom/EVP Particles Alpha Blended Shadows': fallback shader 'Particles/Alpha Blended' not found
Initialize mono
Mono path[0] = 'D:/2021.1.24f1/Editor/Data/Managed'
Mono path[1] = 'D:/2021.1.24f1/Editor/Data/MonoBleedingEdge/lib/mono/unityjit'
Mono config path = 'D:/2021.1.24f1/Editor/Data/MonoBleedingEdge/etc'
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=127.0.0.1:56060
Begin MonoManager ReloadAssembly
Registering precompiled unity dll's ...
Register platform support module: D:/2021.1.24f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll
Registered in 0.000956 seconds.
Native extension for WindowsStandalone target not found
Refreshing native plugins compatible for Editor in 205.35 ms, found 8 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Mono: successfully reloaded assembly
- Completed reload, in 1.250 seconds
Domain Reload Profiling:
ReloadAssembly (1250ms)
BeginReloadAssembly (60ms)
ExecutionOrderSort (0ms)
DisableScriptedObjects (0ms)
BackupInstance (0ms)
ReleaseScriptingObjects (0ms)
CreateAndSetChildDomain (1ms)
EndReloadAssembly (608ms)
LoadAssemblies (58ms)
RebuildTransferFunctionScriptingTraits (0ms)
SetupTypeCache (164ms)
ReleaseScriptCaches (0ms)
RebuildScriptCaches (35ms)
SetupLoadedEditorAssemblies (358ms)
LogAssemblyErrors (0ms)
InitializePlatformSupportModulesInManaged (7ms)
SetLoadedEditorAssemblies (0ms)
RefreshPlugins (205ms)
BeforeProcessingInitializeOnLoad (2ms)
ProcessInitializeOnLoadAttributes (111ms)
ProcessInitializeOnLoadMethodAttributes (32ms)
AfterProcessingInitializeOnLoad (0ms)
EditorAssembliesLoaded (0ms)
ExecutionOrderSort2 (0ms)
AwakeInstancesAfterBackupRestoration (0ms)
Platform modules already initialized, skipping
Registering precompiled user dll's ...
Registered in 0.006953 seconds.

View File

@ -0,0 +1,77 @@
Using pre-set license
Built from '2021.1/staging' branch; Version is '2021.1.24f1 (6667702a1e7c) revision 6711152'; Using compiler version '192528614'; Build Type 'Release'
OS: 'Windows 10 Pro; OS build 19044.1682; Version 2009; 64bit' Language: 'zh' Physical Memory: 16197 MB
BatchMode: 1, IsHumanControllingUs: 0, StartBugReporterOnCrash: 0, Is64bit: 1, IsPro: 0
COMMAND LINE ARGUMENTS:
D:\2021.1.24f1\Editor\Unity.exe
-adb2
-batchMode
-noUpm
-name
AssetImportWorker2
-projectPath
E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem
-logFile
Logs/AssetImportWorker2.log
-srvPort
54624
Successfully changed project path to: E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem
E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem
Using Asset Import Pipeline V2.
Refreshing native plugins compatible for Editor in 227.42 ms, found 8 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Initialize engine version: 2021.1.24f1 (6667702a1e7c)
[Subsystems] Discovering subsystems at path D:/2021.1.24f1/Editor/Data/Resources/UnitySubsystems
[Subsystems] Discovering subsystems at path E:/Unity Projects/GitLab/2023/H_SafeExperienceDrivingSystem/U3D_DrivingSystem/Assets
GfxDevice: creating device client; threaded=0; jobified=0
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: NVIDIA GeForce GTX 1660 SUPER (ID=0x21c4)
Vendor: NVIDIA
VRAM: 5981 MB
Driver: 31.0.15.4617
Shader 'Custom/EVP Particles Alpha Blended Shadows': fallback shader 'Particles/Alpha Blended' not found
Initialize mono
Mono path[0] = 'D:/2021.1.24f1/Editor/Data/Managed'
Mono path[1] = 'D:/2021.1.24f1/Editor/Data/MonoBleedingEdge/lib/mono/unityjit'
Mono config path = 'D:/2021.1.24f1/Editor/Data/MonoBleedingEdge/etc'
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=127.0.0.1:56592
Begin MonoManager ReloadAssembly
Registering precompiled unity dll's ...
Register platform support module: D:/2021.1.24f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll
Registered in 0.001022 seconds.
Native extension for WindowsStandalone target not found
Refreshing native plugins compatible for Editor in 201.18 ms, found 8 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
Mono: successfully reloaded assembly
- Completed reload, in 1.247 seconds
Domain Reload Profiling:
ReloadAssembly (1247ms)
BeginReloadAssembly (61ms)
ExecutionOrderSort (0ms)
DisableScriptedObjects (0ms)
BackupInstance (0ms)
ReleaseScriptingObjects (0ms)
CreateAndSetChildDomain (1ms)
EndReloadAssembly (618ms)
LoadAssemblies (60ms)
RebuildTransferFunctionScriptingTraits (0ms)
SetupTypeCache (171ms)
ReleaseScriptCaches (0ms)
RebuildScriptCaches (39ms)
SetupLoadedEditorAssemblies (351ms)
LogAssemblyErrors (0ms)
InitializePlatformSupportModulesInManaged (8ms)
SetLoadedEditorAssemblies (0ms)
RefreshPlugins (201ms)
BeforeProcessingInitializeOnLoad (2ms)
ProcessInitializeOnLoadAttributes (108ms)
ProcessInitializeOnLoadMethodAttributes (32ms)
AfterProcessingInitializeOnLoad (0ms)
EditorAssembliesLoaded (0ms)
ExecutionOrderSort2 (0ms)
AwakeInstancesAfterBackupRestoration (0ms)
Platform modules already initialized, skipping
Registering precompiled user dll's ...
Registered in 0.006728 seconds.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
Base path: 'D:/2021.1.24f1/Editor/Data', plugins path 'D:/2021.1.24f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler

View File

@ -18,10 +18,10 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c52151802563f22213229
flags: 0
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c4c0417050c6439262f2434
value: 22424703114646680e0b0227036c52111f19276439262f2434
flags: 0
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c52111f19276439262f2434
value: 22424703114646680e0b0227036c4c0417050c6439262f2434
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650