From 4e8e16d712249f26e74b3c97ab42764f4fef100b Mon Sep 17 00:00:00 2001 From: Griffin Teller Date: Sun, 16 Aug 2020 11:07:38 -0700 Subject: [PATCH] Added logging and doubled max values --- Assets/Prefab/Part/Play/BasicTire.prefab | 4 +-- Assets/Scripts/Main/UserScriptInterpreter.cs | 36 ++++++++++++-------- awconnection/Tests/Scratchpad.py | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Assets/Prefab/Part/Play/BasicTire.prefab b/Assets/Prefab/Part/Play/BasicTire.prefab index 0559c64..fc366fe 100644 --- a/Assets/Prefab/Part/Play/BasicTire.prefab +++ b/Assets/Prefab/Part/Play/BasicTire.prefab @@ -348,8 +348,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: attachedTireComponent: {fileID: 0} - maxPower: 7500 - maxMotorTorque: 3000 + maxPower: 15000 + maxMotorTorque: 7500 maxAngularVelocity: 100 maxBrakeTorque: 500 rotationalFriction: 0.05 diff --git a/Assets/Scripts/Main/UserScriptInterpreter.cs b/Assets/Scripts/Main/UserScriptInterpreter.cs index cbd07bb..3d76b62 100644 --- a/Assets/Scripts/Main/UserScriptInterpreter.cs +++ b/Assets/Scripts/Main/UserScriptInterpreter.cs @@ -275,24 +275,30 @@ private void Tire(List remainingCommand) var keyword = remainingCommand[0]; remainingCommand.RemoveAt(0); - switch (keyword) + try { - case "power": - - _actionHandler.SetTirePower(remainingCommand[0], (float) double.Parse(remainingCommand[1])); - break; - - case "steering": - - _actionHandler.SetTireSteering(remainingCommand[0], (float) double.Parse(remainingCommand[1])); - break; - - case "brake": + switch (keyword) + { + case "power": - _actionHandler.SetTireBrake(remainingCommand[0], (float) double.Parse(remainingCommand[1])); - break; + _actionHandler.SetTirePower(remainingCommand[0], (float) double.Parse(remainingCommand[1])); + break; + + case "steering": + + _actionHandler.SetTireSteering(remainingCommand[0], (float) double.Parse(remainingCommand[1])); + break; + + case "brake": + + _actionHandler.SetTireBrake(remainingCommand[0], (float) double.Parse(remainingCommand[1])); + break; + } + } + catch (FormatException e) + { + Debug.LogError("Format exception! String was: " + remainingCommand[1]); } - } } } \ No newline at end of file diff --git a/awconnection/Tests/Scratchpad.py b/awconnection/Tests/Scratchpad.py index c4e5f03..d4cd56d 100644 --- a/awconnection/Tests/Scratchpad.py +++ b/awconnection/Tests/Scratchpad.py @@ -3,7 +3,7 @@ r = RobotConnection() r.connect() -power = 0 +power = 3000 steering = 0 brake = 0