mirror of
https://github.com/BotChain-Robots/ui.git
synced 2026-07-08 15:07:22 +02:00
Fully added gripper, distance, IMU, and display modules
This commit is contained in:
19
Assets/DistanceSensorModule.cs
Normal file
19
Assets/DistanceSensorModule.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
public class DistanceSensorModule : ModuleBase
|
||||
{
|
||||
public bool objectDetected;
|
||||
public float distanceMeters;
|
||||
public string[] infoLines = new string[0];
|
||||
|
||||
void Update()
|
||||
{
|
||||
// Replace with your ControlLibrary call pattern
|
||||
// var reading = ControlLibrary.get_distance(...)
|
||||
|
||||
if (!objectDetected)
|
||||
infoLines = new[] {"Object: Not detected" };
|
||||
else
|
||||
infoLines = new[] { "Object: Detected", $"Distance: {distanceMeters:F2} m" };
|
||||
}
|
||||
|
||||
public string[] GetInfoLines() => infoLines;
|
||||
}
|
||||
Reference in New Issue
Block a user