Real-time Role Coordination for Ambient Intelligence