In this paper, the shape of the medical robot which can move in the colon is suggested for its gate control. In this system, the current shape information plays a sensing role in order to control the gate of robot in the colon. In order to find current shape of robot, we construct sensor network system which composed of several electronic compass units. This unit makes use of chip which includes pair of 3 axis accelerometer and 3 axis magnetometer. From this signals, orientation is evaluated after filtering noise. Then, based on the kinematic chain model, the shape of the flexible robot is calculated using orientation information. The resulting trajectory shows that this method cans percept shape of flexible robot well.