Dynamic diagrammatic representations for reasoning and motion control