Motion Primitives and Planning for Robots with Closed Chain Systems and Changing Topologies