MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply TodayThis Challenge is to solve Question E, Driving the Rover, of the USC ACM Fall 2012 Contest.

The Rover is sent a Series of commands. Your task is to emulate the Rover response to the sequence and determine its "final position", [x,y]. The "final position" is the Rover location 1 second after the final command.

Initial conditions are Rover Stopped and Facing +Y. Commands are processed at 1 second intervals

Commands and their attributes: FORWARD: Starts rolling forward at 1 cm/s BACKWARDS: Roll backwards at 1 cm/s FASTER: Increase forward speed by 1 cm/s up to 5 cm/s SLOWER: Decrease forward speed by 1 cm/s down to 0 cm/s. At 0 cm/s Rover is "Stopped" STOP: Halts rover movement RIGHT: Turn rover 90 degrees to the right LEFT: Turn the rover 90 degrees to the left NOOP: No change in anything

Commands FORWARD, BACKWARDS, RIGHT, LEFT only take effect if the rover is stopped. A moving rover ignores these commands.

Commands FASTER and SLOWER only take effect if the rover is moving forward.

**Input: [Cell array of Rover Commands]**

**Output: [x, y ]**; Final Position 1 second after last command;

The full USC data file

**Example:**

**Input: {'FORWARD' 'RIGHT' 'STOP' 'RIGHT' 'FORWARD' 'FASTER'}**

**Output: [3 2]** as the first RIGHT is ignored

A Contest Drive solution. Time to Solve: 9 minutes. Start.

This is predecessor to the Martian Pits Challenge.

20 correct solutions
25 incorrect solutions

Last solution submitted on Dec 22, 2014

1 player likes this solution

1 Comment