Dynamics and GA-Based Optimization of Rectilinear Snake Robot