add state machine for caterpillar