fix: Update ROS topics and robot configuration

ROS Topic Fixes:
- wizard-ros-service.ts: Use correct ROS topics (/cmd_vel, /joint_angles, /speech)
- ros-bridge.ts: Update subscriptions to match naoqi_driver topics
- Fixes action execution (movement, speech, head control)

Robot Configuration:
- robots.ts: Use NAO_IP/NAO_ROBOT_IP env vars instead of hardcoded 'nao.local'
- robots.ts: Use NAO_PASSWORD env var for SSH authentication
- Improves Docker integration with NAO6

Wizard Interface:
- useWizardRos.ts: Enhanced wizard interface for robot control
- WizardInterface.tsx: Updated wizard controls
- Add comprehensive event listeners for robot actions
This commit is contained in:
2026-03-21 17:58:29 -04:00
parent 18e5aab4a5
commit 3f87588fea
8 changed files with 247 additions and 32 deletions

View File

@@ -15,6 +15,10 @@ export interface UseWizardRosOptions {
onError?: (error: unknown) => void;
onActionCompleted?: (execution: RobotActionExecution) => void;
onActionFailed?: (execution: RobotActionExecution) => void;
onSystemAction?: (
actionId: string,
parameters: Record<string, unknown>,
) => Promise<void>;
}
export interface UseWizardRosReturn {
@@ -289,6 +293,65 @@ export function useWizardRos(
throw new Error("Not connected to ROS bridge");
}
// Handle system actions that bypass ROS 2 bridge (e.g. emotional speech via SSH)
if (
actionId === "say_with_emotion" ||
actionId === "say_text_with_emotion" ||
actionId === "wake_up" ||
actionId === "rest"
) {
console.log(`[useWizardRos] Intercepting system action: ${actionId}`);
const executionId = `sys_${Date.now()}`;
// Create a synthetic execution record
const execution: RobotActionExecution = {
id: executionId,
pluginName,
actionId,
parameters,
status: "executing",
startTime: new Date(),
};
// Trigger started event
service.emit("action_started", execution);
try {
if (options.onSystemAction) {
await options.onSystemAction(actionId, parameters);
} else {
console.warn(
"[useWizardRos] No onSystemAction handler provided for system action",
);
// Fallback to builtin ROS action if no system handler
return service.executeRobotAction(
pluginName,
actionId,
parameters,
actionConfig,
);
}
const completedExecution: RobotActionExecution = {
...execution,
status: "completed",
endTime: new Date(),
};
service.emit("action_completed", completedExecution);
return completedExecution;
} catch (error) {
const failedExecution: RobotActionExecution = {
...execution,
status: "failed",
endTime: new Date(),
error: error instanceof Error ? error.message : "System action failed",
};
service.emit("action_failed", failedExecution);
throw error;
}
}
return service.executeRobotAction(
pluginName,
actionId,