Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
4. Assessment details
To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm
movement loop which you will build upon to create the full solution.
NOTE: The primary requirements specifications are the supplied videos which show the EXACT behaviour you should reproduce.
However, some points worth noting about the displayed behaviour:
INITIALISATION:
After the init() method is called with valid array parameters the robot environment is AUTOMATICALLY configured as
follows by the supplied RobotImpl.jar
● Bars are placed in order from the supplied (hard coded) barHeights array from left to right (from
Control.FIRST_BAR_COLUMN to a maximum of Control.LAST_BAR_COLUMN).
● You can provide less bars than columns and the extra columns will be treated as a zero. You can also create gaps with zeros
in barHeights as with the default provided data.
● Blocks are placed in order from the supplied (hard coded) blockHeights array on top of bars (or at the bottom if no
bar) from left to right (from Control.FIRST_BAR_COLUMN to Control.LAST_BAR_COLUMN). Upon reaching
either column extreme the direction changes and blocks are stacked back in the other direction. This continues, including
further direction changes at the extremes, until all blocks have been placed.
● If less bars than columns are supplied or there are gaps due to zeros in barHeights then blocks are still be placed on the
empty column and are laid out as described above from Control.FIRST_BAR_COLUMN to
Control.LAST_BAR_COLUMN.
BLOCK PLACMENT:
You must reproduce this behaviour by calling methods on the Robot. Further hints are given in the section HOW TO PROCEED
below.
● Blocks are picked from the top of the bar/block stack in the same order they were placed during initialization, as described
above (left to right then changing direction at the extremes).
● Blocks are dropped in an alternating fashion on the two stacks (Control. STACK1_COLUMN and Control.
STACK2_COLUMN) starting with column 1.
● This continues until all blocks have been placed.
● Blocks are lowered to the drop position using the raise()/lower() methods to move Arm3.
HEIGHT OPTIMISATION (ARM1 movement):
Again, you must reproduce this behaviour by calling appropriate methods on the Robot.
● Arm 2 (the horizontal arm controlled by extend()/contract()) should always be at the lowest height to clear any
obstacles (i.e. the top of any column stack). This is achieved by using the up()/down() methods on Arm1.
● This is set before moving to make a pick (or after any drop) so that the arm can JUST clear any obstacles as it moves to the
target column.
● The height is then rechecked as soon as you make a pick taking into account the picked block and the additional clearance
it needs as it moves to the drop destination (the far left or right columns as marked in the Robot user interface).
HOW TO PROCEED
Your task is to write code using loops, selection/conditionals, arrays and methods to solve the problem, thereby writing an
algorithm. You will also need to create variables/data structures to keep track of the position of bars, blocks and the arm segments
so you can move and pick/drop as required. Arrays and primitive variables are sufficient for this purpose and you must not use any
other data structures such as Collections/Lists/Maps etc. since the purpose of this assignment is to test programming
fundamentals. This assignment does not require any of the more advanced Object-Oriented concepts such as
inheritance/polymorphism that will covered in assignment part B.
The simplest way to solve this is to build the behaviour with small methods, passing parameters as necessary to avoid code
repetition. If you try to do this with a single method, the loop nesting will get complex and you will lose marks! For example, rather
than nesting loops, place one loop in a method (as with the supplied extendToWidth()) and call that single method in a loop ..
much easier and cleaner!
The possible robot arm movement operations are specified and described by the supplied RobotMovement interface
(RobotMovement.java). Additionally, Control.java contains some constants you can use to avoid hard coding values and
ensure correct operation.