Gait is an important research content of hexapod robots. To better improve the motion performance of hexapod robots, many researchers have adopted some high-cost sensors or complex gait control algorithms. This paper studies the straight gait of a small electric hexapod robot with a low cost, which can be used in daily life. The strategy of “increasing duty factor” is put forward in the gait planning, which aims to reduce foot sliding and attitude fluctuation in robot motion. The straight gaits of the robot include tripod gait, quadrangular gait, and pentagonal gait, which can be described conveniently by discretization and a time sequence diagram. In order to facilitate the user to control the robot to achieve all kinds of motion, an online gait transformation algorithm based on the adjustment of foot positions is proposed. In addition, according to the feedback of the actual attitude information, a yaw angle correction algorithm based on kinematics analysis and PD controller is designed to reduce the motion error of the robot. The experiments show that the designed gait planning scheme and control algorithm are effective, and the robot can achieve the expected motion. The RMSE of the row, pitch, and yaw angle was reduced by 35%, 25%, and 12%, respectively, using the “increasing duty factor” strategy, and the yaw angle was limited in the range −3°~3° using the yaw angle correction algorithm. Finally, the comparison with related works and the limitations are discussed.