Merge branch 'Add-New-Modules' of https://git.uwaterloo.ca/capstone-group2/ui into Add-New-Modules

This commit is contained in:
Christen
2026-03-03 19:28:47 -05:00
434 changed files with 3671 additions and 49577 deletions

View File

@@ -10,14 +10,15 @@ public abstract class ModuleBase : MonoBehaviour
public void SendToControlLibrary(string moduleType, float currentAngle)
{
int angleRounded = Mathf.RoundToInt(currentAngle);
var json = "";
if (moduleType.Contains("Servo"))
if (moduleType.Contains("Servo") || moduleType == "Gripper")
{
json = JsonUtility.ToJson(new ServoCommand
{
ModuleId = moduleID,
Type = moduleType,
TargetAngle = currentAngle
TargetAngle = angleRounded
});
}
else if (moduleType == "DC")
@@ -31,7 +32,7 @@ public abstract class ModuleBase : MonoBehaviour
{
ModuleId = moduleID,
Type = moduleType,
RotateByDegrees = Math.Abs(currentAngle),
RotateByDegrees = Math.Abs(angleRounded),
Direction = direction
});
}
@@ -40,7 +41,7 @@ public abstract class ModuleBase : MonoBehaviour
{
return;
}
if (0 != ControlLibrary.send_angle_control(Int32.Parse(moduleID), (int)currentAngle))
if (0 != ControlLibrary.send_angle_control(Int32.Parse(moduleID), angleRounded))
{
Debug.Log("Control library exited with error");
}