Phone Controller
ConnectivityThe PhoneController block turns any smartphone into a wireless 3-axis simulation joystick. When placed on the canvas, it renders a pairing QR code; scanning it with a mobile browser opens an on-screen touch joystick (or tilt controller) along with an independent horizontal yaw slider.
The phone streams normalized control signals across X, Y, and Yaw axes () at approximately 30 Hz over a low-latency WebRTC peer-to-peer data channel. Its X and Y ports match the interface of Joystick2D, making it a drop-in wireless replacement for interactive vehicle and robotics demos.
Mathematical Model
The mobile device transmits 3-axis normalized control vectors:
A deadband threshold suppresses resting thumb jitter:
Signals are reconstructed continuously across simulation solver steps with playout buffer latency s:
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| ← Out | x |
X | number | Output |
| ← Out | y |
Y | number | Output |
| ← Out | yaw |
Yaw | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
playoutDelay |
Playout Delay (ms) | number | 80 |
Network jitter buffer. Lower = more responsive control, higher = smoother signal on flaky connections. |
interpolation |
Interpolation | select | linear |
How to reconstruct the control signal between received joystick packets. |
outputLabels |
Output Labels | vector | x,y,yaw |
Usage Examples
Example 1: Wireless Quadcopter Attitude Flight Control
Steering a simulated drone flight model. Connecting x to a roll angle setpoint, y to a pitch setpoint, and yaw to heading rate, feeding through attitude PIDs to a Gimbal3D visualization sink. The drone responds directly to thumb movements on the phone.
Example 2: Mobile Tilt Steering for Mobile Robotics
Controlling a differential-drive ground robot. Enabling the phone's tilt mode maps device orientation into left/right steering and forward/reverse speed commands, allowing intuitive physical vehicle navigation.
Remarks & Best Practices
- Three Independent Control Axes: Exposes X (left/right, ), Y (backward/forward, ), and Yaw (horizontal slider, ) on three dedicated output ports.
- Zero-Install WebRTC Pairing: Operates directly in standard mobile browsers without requiring native mobile app installations.
- Dual Touch and Tilt Modes: The phone interface toggles seamlessly between touch thumbpad and device accelerometer tilt steering.
- Hardware Simulation Gating: In hardware-in-the-loop templates, simulation execution is gated until the phone establishes a WebRTC connection.
Related Components
- Joystick2D: On-canvas mouse-driven 2D joystick.
- RemoteSensor: Ingests raw phone accelerometer, gyroscope, and orientation sensors.
- Gimbal3D: Real-time 3D flight attitude visualization sink.
- Slider: Single-axis continuous variable input.