Modular robotic systems consist of multiple modules that can be transformed into different configurations with respect to different needs. Different from robots with fixed geometry or configurations, the kinematics model of a modular robotic system can alter as the robot reconfigures itself. Since modular robotic systems are usually highly redundant for versatility, developing a generic approach for control and motion planning is difficult, especially when multiple motion goals are coupled. A new framework in terms of control and motion planning is developed. The problem is formulated as a linearly constrained quadratic program (QP) that can be solved efficiently. Some constraints can be incorporated into this QP, including a novel way to approximate environment obstacles. This solution can be used directly for real-time applications and it is validated and demonstrated on the CKBot and SMORES-EP modular robot platforms.