Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ crashlytics-build.properties
.DS_Store
Thumbs.db
Desktop.ini

.amazonq/
# Python
.venv/
.venv_step/
Expand Down
12 changes: 9 additions & 3 deletions CoreSim/src/RobotTwin.CoreSim/Host/RealtimeHardening.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,22 @@ private static void TrySetAffinity(long affinityMask)
#if NET5_0_OR_GREATER
if (OperatingSystem.IsWindows())
{
typeof(Process).GetProperty("ProcessorAffinity")?.SetValue(process, affinityMask1);
#pragma warning disable CA1416 // Platform compatibility
process.ProcessorAffinity = affinityMask1;
#pragma warning restore CA1416
}
else if (OperatingSystem.IsLinux())
{
typeof(Process).GetProperty("ProcessorAffinity")?.SetValue(process, affinityMask1);
#pragma warning disable CA1416 // Platform compatibility
process.ProcessorAffinity = affinityMask1;
#pragma warning restore CA1416
}
#else
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
typeof(Process).GetProperty("ProcessorAffinity")?.SetValue(process, affinityMask1);
#pragma warning disable CA1416 // Platform compatibility
process.ProcessorAffinity = affinityMask1;
#pragma warning restore CA1416
}
#endif
}
Expand Down
12 changes: 12 additions & 0 deletions CoreSim/src/RobotTwin.CoreSim/Specs/AssemblySpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class AssemblySpec
{
public List<AssemblyPartSpec> Parts { get; set; } = new List<AssemblyPartSpec>();
public List<AssemblyWireSpec> Wires { get; set; } = new List<AssemblyWireSpec>();
public List<BreadboardSpec> Breadboards { get; set; } = new List<BreadboardSpec>();
}

public class AssemblyPartSpec
Expand Down Expand Up @@ -33,6 +34,17 @@ public class AssemblyWireSpec
public double Damping { get; set; } = 0.2;
}

public class BreadboardSpec
{
public string Id { get; set; } = string.Empty;
public int PinCount { get; set; } = 400;
public int Columns { get; set; } = 10;
public int Rows { get; set; } = 40;
public double Pitch { get; set; } = 0.00254;
public Vec3 Position { get; set; } = new Vec3();
public Vec3 Rotation { get; set; } = new Vec3();
public Vec3 Scale { get; set; } = new Vec3 { X = 1, Y = 1, Z = 1 };
}
public struct Vec3
{
public double X { get; set; }
Expand Down
Binary file modified RobotWin/Assets/Plugins/RobotTwin.CoreSim.dll
Binary file not shown.
54 changes: 54 additions & 0 deletions RobotWin/Assets/Scripts/UI/RobotStudio/RobotStudioBreadboard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using UnityEngine;

namespace RobotTwin.UI
{
public class RobotStudioBreadboard : MonoBehaviour
{
public string Id;
public int PinCount;
public int Columns;
public int Rows;
public float Pitch;
public float Thickness;
public float Margin;
public float Width;
public float Depth;
public Renderer BoardRenderer;

// Owned resources created at runtime (e.g., texture/material for the base).
// These are not Unity asset references and must be cleaned up to avoid leaks.
public Material OwnedMaterial;
public Texture2D OwnedTexture;

public float TopSurfaceY => Thickness * 0.5f;

private void OnDestroy()
{
// If we authored the shared material/texture at runtime, we own lifetime.
if (BoardRenderer != null && OwnedMaterial != null && BoardRenderer.sharedMaterial == OwnedMaterial)
{
BoardRenderer.sharedMaterial = null;
}

DestroyOwnedResource(OwnedMaterial);
OwnedMaterial = null;

DestroyOwnedResource(OwnedTexture);
OwnedTexture = null;
}

private static void DestroyOwnedResource(Object resource)
{
if (resource == null) return;

if (Application.isPlaying)
{
Destroy(resource);
}
else
{
DestroyImmediate(resource);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading