A Unity-based real-time control system for RobUST cable-driven robotic platform. This framework provides Soft real-time deterministic motor control, multi-sensor integration, and tension planning for cable actuation.
Unlike typical Unity projects where each MonoBehaviour operates independently with its own Update() loop, this framework implements a centralized control architecture for more (soft) deterministic real-time robotic control. The system uses a single main control loop with dedicated driver threads for hardware interfaces.
Unity Scripts are always located in Assets/Scripts. These scripts can be attached to specific game objects in the Unity Scene. A basic Unity Scene for this project is implemented with a default MainCamera, an empty RobotSystem GameObject, and 3 tracker visuals for the robot frame, end-effector, and user center of mass.
| Script | Function |
|---|---|
RobotController.cs |
Main control loop coordinating all subsystems |
LabviewTcpCommunicator.cs |
TCP interface to LabVIEW motor controllers |
TrackerManager.cs |
HTC Vive tracker interface via OpenVR |
ForcePlateManager.cs |
Vicon force plate integration via .NET SDK |
CableTensionPlanner.cs |
Quadratic programming solver for cable tensions |
RobotVisualizer.cs |
Unity scene visualization updates |
DataStructures.cs |
Shared data types and utilities |
The framework employs three main driver scripts (LabviewTcpCommunicator, TrackerManager, ForcePlateManager) designed as standalone, reusable components. Each driver:
- Runs in its own thread with high-precision timing using Unity's
System.Diagnostics.Stopwatch - Maintains pseudo-deterministic sampling frequencies
- Uses data locks for thread-safe communication with the main control loop
- Can be integrated into other robotic projects without modification
Manages communication with the low-level motor controller running on a PXIe system:
- Frequency: 500 Hz TCP transmission
- Configuration: Motor indices set during initialization
- Interface:
UpdateTensionSetpoint(double[] setpoints)for real-time updates - Protocol: Sends motor index and tension setpoint pairs via TCP
- Port: 8052 (configurable)
Interfaces with HTC Vive tracking system for pose estimation:
- Frequency: 90 Hz (limited by HTC hardware)
- API: OpenVR for direct access to tracker transformation matrices
- Configuration: Supports 3 trackers (frame reference, end-effector, center of mass)
- Setup: Automatically discovers connected trackers and displays serial numbers for configuration
- Coordinate System: Uses HTC Vive tracker orientation guidelines
Integrates with Vicon force measurement systems:
- Status: Have to test in live mode on RobUST
- Interface: Vicon DataStream SDK via Unity Vicon Plugin
- Architecture: Utilizies
ServerPushmode meaning Vicon Box triggers timing
Solves the cable tension optimization problem using quadratic programming:
- Solver: Alglib Convex QP implementation (dense IPM)
- Objective: achieve desired wrench while minimizing parasitic wrench and maintaining minimum cable tensions
- Configuration Parameters:
- Number of cables
- Chest anteroposterior distance
- Chest mediolateral distance
- Belt size (small/medium/large)
- Primary Function:
CalculateTensions(Matrix4x4 endEffectorPose, Vector3 desiredForce, Vector3 desiredTorque, Matrix4x4 robotFramePose)
Handles Unity scene updates and coordinate frame transformations for visualization only:
- Coordinate Conversion: Right-handed tracker data to left-handed Unity coordinate system
- Initialization: Captures single frame tracker snapshot for reference positioning
- Camera Setup: Positions Unity camera relative to frame tracker for optimal viewing
- Unity Hub with Unity Editor installed
- Steam account with SteamVR
- HTC Vive base stations and headset
- 3 HTC Vive trackers
- Clone Repository
- Open Project in Unity
- Launch Unity Hub
- Select "Open Project"
- Navigate to and select the "Darren RobUST Controller" folder
- Load Scene
- Open the "Robot Controller Scene" in Unity
- Configure SteamVR
- Install SteamVR through Steam
- Connect and power on base stations and headset
- Pair the 3 Vive trackers using "Pair Controller" in SteamVR
- Verify tracker status icons are lit in SteamVR interface
- Configure Tracker Serial Numbers
- Run the project once to see discovered tracker serial numbers in console
- Copy serial numbers to appropriate variables in TrackerManager:
- Frame tracker serial
- End-effector tracker serial
- Center of mass tracker serial
- Open Preferred Vicon Software
Testing Without Hardware For development and testing without the full LabVIEW motor control system: Simulate Local TCP Listener
ncat -l 8052This will display incoming motor commands for verification of communication protocols.
- Unity: 2021.3 LTS or newer recommended
- SteamVR: Latest version through Steam
- OpenVR: Included with SteamVR installation
- Vicon Unity Plugin 1.3
.unitypackage - Vicon System compatible with ViconDataStreamSDK
- Alglib: Included for quadratic programming solver ---> Plugins Folder
- Ensure all trackers are awake before starting
- Frame tracker position is captured once during initialization and used as reference
- System requires SteamVR to be running and trackers connected before Unity execution
- Motor indices must be configured before runtime - no dynamic motor discovery supported