Robot Control - Master/Slave Architecture

{robots.length} robots, {robotsWithMaster} with masters, {robotsWithSlaves} with slaves
{#if error}
{error}
{/if}

Create Robot

{#each robots as robot (robot.id)}

{robot.id}

Status: {getConnectionStatusText(robot)} {#if robot.controlState.lastCommandSource !== "none"} • Last: {robot.controlState.lastCommandSource} {/if} {#if robot.isCalibrated} • Calibrated {/if}
Masters (Control Sources) {#if robot.controlState.hasActiveMaster} - Connected: {robot.controlState.masterName} {:else} - None Connected {/if}
{#if robot.controlState.hasActiveMaster} {/if}
Slaves (Execution Targets) - {robot.connectedSlaves.length} Connected / {robot.slaves.length} Total
{#if robot.slaves.length > 0}
Connected Slaves: {#each robot.slaves as slave}
{slave.name} ({slave.id})
{/each}
{/if}
{#if robot.connectedSlaves.some(slave => slave.name.includes("USB"))}
USB Robot Calibration
{#if !robot.isCalibrated}
1. Manually position your robot to match the digital twin's rest pose
2. Click "Calibrate" when positioned correctly
{:else}
✓ Robot calibrated at {robot.calibrationState.calibrationTime?.toLocaleTimeString()}
{/if}
{/if} {#if robot.manualControlEnabled}
Manual Control ({robot.activeJoints.length} active joints)
{#each robot.activeJoints as joint}
{joint.name}
{joint.virtualValue.toFixed(0)}° {#if joint.realValue !== undefined} Real: {joint.realValue.toFixed(0)}° {:else} N/A {/if}
{ const target = e.target as HTMLInputElement; robot.updateJointValue(joint.name, parseFloat(target.value)); }} class="joint-slider" />
{/each} {#if robot.activeJoints.length === 0}
No active joints
{/if}
{:else}
🎮 Master Control Active
Robot is controlled by: {robot.controlState.masterName}
Manual controls are disabled. Disconnect master to regain manual control.
{/if}
{/each} {#if robots.length === 0}
No robots created yet. Create one above to get started with the master-slave architecture.
{/if}
{#if showRobotSelectionModal}

Select Server Robot

This will connect your local robot "{pendingLocalRobot?.id}" as a slave to receive commands from the selected server robot.
{/if}