05 - A/D and Mechanics (Implementation)

Info

The preliminary requirements for this assignment:

  1. Git installed (see Dev > Git),
  2. Python installed (see Dev > Python),
  3. The group repository checked out (see Dev > Template),
  4. All prior assignments handed in.

In this assignment you’ll have to implement the missing parts for your robot and combine it with the other parts implemented earlier. This includes the implementation of a simple analogue-digital-converter for all data the color sensor outputs and the overall mechanics for moving the sensor and scrolling or driving over the bar code cards.

At this point you should already have an idea about how your robot will look in the end and which parts you need in order to solve the upcoming demonstration/exam.

Note

This assignment is not mandatory to be allowed to the exam. Still, it is recommended to solve this task until the specified date and ask questions during consultation time to get you ready for the demonstration/exam.
Soft deadline for submission: Friday, 10.01.2025, hard deadline on 12.01.2025, 23:59 // 11.59 pm (CET)

Basics - How to start

  • The Lego Set / Brick:
    • Work yourself through the Getting Started instructions (group task)
    • Read the information about our OS and the python libraries to use carefully
  • The Group Repository:
    • You’ll be given access to a specific repository for this task.
    • Decide intra-group on whose HammingCode implementation and whose StackMachine to use and add the implementation to your group repository.
      • Each group member should provide one of the classes!
    • For the implementation, the entry point is the file main.py. So, include all the other files necessary here.
Warning

Do not use the ev3dev2 library, PyBrick, any other Python environments or operating system images!
Everything you need is already included in our RoboLab OS image that you must use!

Task 1 (The Robot)

  1. Construct your robot with all parts needed.
    You’ll need several engines to move the sensor and scroll the bar code cards.
    Also, you’ll need a light or color sensor for detecting and reading the codeword.
  2. Implement the different movement algorithm using the template provided in ./robolab-template/src/robot.py.
    Experiment with different speed values for the motors and adjust it to your needs.

Task 2 (Hamming Decoder)

  1. Implement a routine which reads a line and stores the values received by the sensor in a data structure (e.g. Tuple, List).
  2. Decode the codeword using your class HammingCode and stored the opcode received for further processing.
    • Note that, in case the result is UNCORRECTABLE, you need to re-read the line and decode it again!
  3. Extend your routine with a command to scroll to the next line.
    You should be able to wait for and scroll to multiple other cards after processing the first one.
  4. We want to know what our robot is doing. So, for every codeword do the following (list incomplete):
    • Print (or use TTS) the 11-bit input (e.g. “Input: ( … )”)
    • Print (or use TTS) the 6-bit output (e.g. “Output: ( … )”)
    • Print (or use TTS) exception messages (e.g. input too short, uncorrectable code, …)
Note

In general, there are two options on how to process the bar code cards:

  • Read and decode all codewords and store the opcodes in a list
  • Read and decode a single codeword and execute it on the stack machine directly

Task 3 (Stack Machine)

  1. Extend your logic so that opcodes are handed to the stack machine to be processed.
    Test your fully implemented robot.
    • Make sure to check the state after each opcode and abort everything if an exception occurs.
  2. We want to know what the stack machine is executing. So, for every converted codeword do the following:
    • Print (or use TTS) the instruction shortcut (e.g. “Instruction: XYZ)
    • Print the top element of the stack if it has changed.
    • Print (or use TTS) exception messages (e.g. not enough items, invalid range, …)
Note

Make sure to replace the print() call for the SPEAK instruction with TTS!

Warning

Do not exchange source code with members of other groups! Keep it private!
We we do not tolerate plagiarism.
Plagiarism of any form will get you disqualified from the lab.