Reference no: EM132370773
Programming Assignment -
This assessment is relevant to the following Learning Outcomes:
1: Solve simple algorithmic computing problems using basic control structures and Object-Oriented Techniques.
2: Design and implement computer programs based on analysing and modelling requirements.
3: Identify and apply basic features of an Object-Oriented programming language through the use of standard Java (Java SE) language constructs and APIs.
4: Identify and apply good programming style based on established standards, practices and coding guidelines.
5: Devise and apply strategies to test the developed software.
Overview - This specification provides an overview of the problem and supplied code and also specifies the requirements for the Part A submission.
Make sure you CAREFULLY WATCH THE ASSIGNMENT RELATED DEMO VIDEOS on Canvas which show the default startup behaviour (when no code is added) as well as the correct output of a working solution with a diverse data set (mixed blockHeights[]/barHeights[] arrays). See section Description of the Supplied Videos later in this document for more details.
Next, don't panic about the apparent complexity! The code to do the graphical drawing of the robot environment is provided, and the use and understanding of the supplied interfaces is not required in detail until assignment part B.
The possible operations on the robot are specified by the supplied Robot and RobotMovement interfaces (Robot.java and RobotMovement.java). Some additional CONSTANTS you should use in your code are specified in the Control.java interface.
Assessment Criteria - As well as functional correctness (robot behaviour matches video requirements) you will also be assessed based on the following code quality requirements:
- Use meaningful / descriptive identifiers (eg variable and method names).
- Demonstrate understanding of local variables versus class attributes and prefer local scope where possible.
- Demonstrate the use of defined constants in Control.java (Rather than using magic numbers)
- Avoid code repetition. (THIS IS THE MOST IMPORTANT ONE!)
- Write small private methods to avoid code other than one or more method calls going in the RobotControl.control() method.
- Appropriate use of comments (but remember that easily understandable code is better than a comment).
- Include a comment at the top of RobotControl.java class stating your name and student number.
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:
- Blocks are placed in order from the supplied (hard coded) blockHeights array alternating between the left source column (Control.SRC1_COLUMN) and the right source column (Control.SRC2_COLUMN).
- 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).
- This initialisation is done AUTOMATICALLY by the supplied RobotImpl.jar
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 two source columns starting from the left column and alternating between the two columns. You will need to control the robot movement to do this.
- Block are dropped on bars starting at the left most bar (Control.FIRST_BAR_COLUMN) and progressing to the right most bar (Control.LAST_BAR_COLUMN).
- Once all bars have a block on them, the direction changes and blocks are placed from right to left (like a second row of "bricks"). This continues until all blocks have been placed.
- Blocks are lowered to the drop position using the raise()/lower() methods to move Arm3.
- If less bars than columns are supplied then blocks can still be placed on the empty column and should still be laid out as described above from Control.FIRST_BAR_COLUMN to Control.LAST_BAR_COLUMN.
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). 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.
HOW TO PROCEED -
Your task is to write code using loops and 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. This assignment does not require any of the Object-Oriented concepts 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 Robot interface (Robot.java).
Additionally, Control.java contains some constants you can use to avoid hard coding values and ensure correct operation.
As previously mentioned, the supplied RobotControl.java provides the example method: private void moveToWidth(int width)
This method uses the extend() method from Robot.java and serves as an example you can follow to keep your methods small, cohesive and useful.
Attachment:- Programming Assignment File.rar