Obstacle Avoidance of Swarms Using Pinning Control