Most humanoid robots have highly complicated structure and design of robots that are very similar to
human is extremely difficult. In this paper, modelling of a general and comprehensive algorithm for control
of humanoid robots is presented using Colored Petri Nets. For keeping dynamic balance of the robot,
combination of Gyroscope and Accelerometer sensors are used in algorithm. Image processing is used to
identify two fundamental issues: first, detection of target or an object which robot must follow; second,
detecting surface of the ground so that walking robot could maintain its balance just like a human and
shows its best performance. Presented model gives high-level view of humanoid robot's operations.