control code for robot