diff --git a/U3D_DrivingSystem/Assets/EVP5/Scripts/VehicleController.cs b/U3D_DrivingSystem/Assets/EVP5/Scripts/VehicleController.cs index 12a71f7a..f2eec2a3 100644 --- a/U3D_DrivingSystem/Assets/EVP5/Scripts/VehicleController.cs +++ b/U3D_DrivingSystem/Assets/EVP5/Scripts/VehicleController.cs @@ -627,7 +627,10 @@ public class VehicleController : MonoBehaviour float forwardSpeed = m_speed * steeringLimitRatio * speedFactor; float maxEspAngle = Mathf.Asin(Mathf.Clamp01(3.0f / forwardSpeed)) * Mathf.Rad2Deg; float steerAngleLimit = Mathf.Min(maxSteerAngle, Mathf.Max(maxEspAngle, Mathf.Abs(m_speedAngle))); + + inputSteerAngle = Mathf.Clamp(inputSteerAngle, -steerAngleLimit, +steerAngleLimit); + //Debug.Log(inputSteerAngle); } float assistedSteerAngle = 0.0f; @@ -638,7 +641,7 @@ public class VehicleController : MonoBehaviour - // Debug.Log(m_steerAngle); + // Debug.Log(m_steerAngle); } diff --git a/U3D_DrivingSystem/Assets/Scenes/main_.unity b/U3D_DrivingSystem/Assets/Scenes/main_.unity index e9ee32fd..14a0d766 100644 --- a/U3D_DrivingSystem/Assets/Scenes/main_.unity +++ b/U3D_DrivingSystem/Assets/Scenes/main_.unity @@ -46746,7 +46746,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &463649141 Transform: m_ObjectHideFlags: 0 @@ -161849,7 +161849,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &1482950187 Transform: m_ObjectHideFlags: 0 @@ -222314,6 +222314,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 11410574, guid: 4292160a5e1fde347934ac660b2c5d30, type: 3} + propertyPath: degreesOfRotation + value: 1100 + objectReference: {fileID: 0} - target: {fileID: 15384928, guid: 4292160a5e1fde347934ac660b2c5d30, type: 3} propertyPath: m_ConnectedAnchor.x value: -0.394989 diff --git a/U3D_DrivingSystem/Assets/Scenes/menu.unity b/U3D_DrivingSystem/Assets/Scenes/menu.unity index 874b9fd6..1514e4c4 100644 --- a/U3D_DrivingSystem/Assets/Scenes/menu.unity +++ b/U3D_DrivingSystem/Assets/Scenes/menu.unity @@ -358,7 +358,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &76095179 RectTransform: m_ObjectHideFlags: 0 @@ -973,7 +973,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &570311457 RectTransform: m_ObjectHideFlags: 0 @@ -1106,7 +1106,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &574599288 RectTransform: m_ObjectHideFlags: 0 @@ -1509,7 +1509,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &748011624 RectTransform: m_ObjectHideFlags: 0 @@ -1642,7 +1642,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &867050206 RectTransform: m_ObjectHideFlags: 0 @@ -4057,7 +4057,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &1952163225 RectTransform: m_ObjectHideFlags: 0 diff --git a/U3D_DrivingSystem/Assets/Script/CarGearControl.cs b/U3D_DrivingSystem/Assets/Script/CarGearControl.cs index cfa635e4..c771be48 100644 --- a/U3D_DrivingSystem/Assets/Script/CarGearControl.cs +++ b/U3D_DrivingSystem/Assets/Script/CarGearControl.cs @@ -24,8 +24,8 @@ namespace Script private CarStatusData carData; - float minValue = -900f; // 范围的最小值 - float maxValue = 900; // 范围的最大值 + float minValue = -1500f; // 范围的最小值 + float maxValue = 1500; // 范围的最大值 public CarInfoManager carInfoManager; private ModbusTcpClient client; @@ -66,14 +66,14 @@ namespace Script } - // public void HHHHHH() - // { - // client.SendModbusRequest12(); - // } - // void OnDestroy() - // { - // client.CloseConnection(); - // } + public void HHHHHH() + { + client.SendModbusRequest12(); + } + void OnDestroy() + { + client.CloseConnection(); + } async Task ModBusQueue() { @@ -82,14 +82,14 @@ namespace Script // Debug.Log(client.modbusQueue.Count); // if (client.modbusQueue.Count > 0) // { - // Debug.Log(client.modbusQueue.Count); + // // Debug.Log(client.modbusQueue.Count); // // carData = client.modbusQueue.Dequeue(); if (ModbusTcpClient.modbusTcpClient.modbusQueue.Count > 0) { // Debug.Log(ModbusTcpClient.modbusTcpClient.modbusQueue.Count); - + carData = ModbusTcpClient.modbusTcpClient.modbusQueue.Dequeue(); diff --git a/U3D_DrivingSystem/Assets/Script/ModbusTcpClient.cs b/U3D_DrivingSystem/Assets/Script/ModbusTcpClient.cs index 5f271f1f..983eb599 100644 --- a/U3D_DrivingSystem/Assets/Script/ModbusTcpClient.cs +++ b/U3D_DrivingSystem/Assets/Script/ModbusTcpClient.cs @@ -168,7 +168,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为喇叭按下 @@ -200,7 +200,7 @@ namespace ModbusManager carStatusData.WiperStatus = dataValue; break; case 9://00是未开灯,1是示廓灯,2是近光远光。。没有找到远光信号。 - Debug.Log($"灯光状态: {dataValue}"); + // Debug.Log($"灯光状态: {dataValue}"); carStatusData.LightStatus = dataValue; break; case 10://00是未开转向灯,1是左转向灯,2是右转向灯