mirror of
https://github.com/soconnor0919/hristudio.git
synced 2026-09-23 04:20:16 -04:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user