feat(nao6): add SSH-based posture actions (wake_up, rest, stand, sit, crouch)

- Update plugin with sshCommand payloadMapping type
- Add server-side SSH command execution in robot-communication.ts
- Add client-side SSH command execution in wizard-ros-service.ts
- Update API route to handle executeSSH action
This commit is contained in:
2026-04-01 19:37:28 -04:00
parent 6243b62d3b
commit 27f633fb4b
3 changed files with 151 additions and 5 deletions
+30
View File
@@ -718,11 +718,18 @@ export class WizardRosService extends EventEmitter {
transformFn?: string;
service?: string;
args?: Record<string, unknown>;
sshCommand?: string;
};
},
parameters: Record<string, unknown>,
actionId?: string,
): Promise<void> {
// SSH command actions
if (config.payloadMapping.type === "ssh" && config.payloadMapping.sshCommand) {
await this.executeSSHCommand(config.payloadMapping.sshCommand);
return;
}
// Service-call actions — no topic publish involved
if (config.payloadMapping.type === "service") {
const service = config.payloadMapping.service ?? config.topic;
@@ -1068,6 +1075,29 @@ export class WizardRosService extends EventEmitter {
console.log(`[WizardROS] Animation completed: ${animation}`);
}
/**
* Execute an arbitrary SSH command via the API
*/
private async executeSSHCommand(command: string): Promise<void> {
console.log(`[WizardROS] Executing SSH command: ${command}`);
const response = await fetch("/api/robots/command", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
action: "executeSSH",
command,
}),
});
if (!response.ok) {
const error = await response.text();
throw new Error(`SSH command failed: ${error}`);
}
console.log(`[WizardROS] SSH command completed: ${command}`);
}
/**
* Set Autonomous Life state with fallbacks
*/