Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

MTRN4110 22T2 Phase A Task Description

2022

1. Overview of the Course Project:

The main project of MTRN4110 22T2 is a simulation-based project adapted from theMicromouse competition.Webotswill be used as the simulation platform throughout the project. You will design a mobile robot and implement a controller and a vision program to negotiate a maze autonomously in Webots. The project will contribute 60% to your final mark in this course.

The project consists of four sequential phases which are connected, but attempting one phase is not dependent on the completion of another:

•    Phase A: Driving and Perception (Week 1-3, 14%, individual)

•    Phase B: Path Planning (Week 4-6, 14%, individual)

•    Phase C: Computer Vision (Week 7-9, 14%, individual)

Phase D: Integration and Improvement (Week 10-12, 18%, group)

This document will describe the tasks of Phase A.

2. Overview of Phase A – Driving and Perception:

Phase A aims to build a mobile robots driving and perception modules for the final maze-solving

demonstration. You must complete the tasks of this phase by 13:00 Monday, Week 4 (20 June).

2.1. Expectations:

By the end of Phase A, you are expected to have:

•    installedWebots R2021bon your computer properly;

•    completed Webotstutorials(minimum - 1, 2, 4, recommended - 3, 5, 6);

•    understood how to run simulations with robots and sensors in Webots;

•    been able to create a controller for a robot that can execute a given motion plan;

•    been able to detect surrounding objects using onboard sensors of a robot; and

•    been able to output results in the specified format.

2.2. Learning Outcomes Associated with this Assignment:

LO1: Apply relevant theoretical knowledge pertaining to mobile robots, including     locomotion, perception and localisation using onboard sensors, navigation and path planning, for practical problem-solving

LO3: Demonstrate practical skills in mechatronics design, fabrication, and implementation

3.  Phase A Task Description:

At the beginning of this phase, you will be given a Webots world file containing a five by nine maze and an E-puck robot. An example world file is shown in Fig. 1, where the robot is placed at the         centre of the top-left corner of the maze and heading towards the south of the view (throughout   the course project, we will refer to the top, bottom, left, and right of the maze as North, South,       West, and East, respectively).

N

4

0

1

W 2 E

3

4

S

Fig. 1. An example maze layout and an E-puck robot

You must create and implement a controller for the robot, which should complete the following tasks once started.

3.1. Read in a sequence of motion plan from a text file and display it in the console

You will be given a text file named MotionPlan.txt” containing a sequence of motion commands, e.g.,

Fig. 2. An example motion plan

The motion sequence starts with three characters specifying the initial location and heading of the robot. In the example shown above, the sequence starts with

where the first character (0) stands for the index of the row (0 - 4), the second (0) for the             column (0 - 8), and the third (S) for the heading of the robot (N, E, S, W). The top-left corner cell always has an index of (0, 0) for the row and column.

Following the three characters is a sequence of motions represented by a string composed of     three characters (F, L, R), where F stands for Forward for one step”, L for Turn left for 90 deg”, and R for Turn right for 90 deg” .

In the example shown above, a sequence that directs the robot from the initial location to the centre of the maze will be (you can validate it by yourself)

In summary, the sequence of motions in the text file will be like the following:

The text file given to you will have no spaces, newlines, or characters other than those                 mentioned above. Also, note that the initial location and heading will always match the starting state of the robot in the world file given to you, and the motion sequence is always valid (you    don’t need to check the correctness of the motion sequence or change the robot’s initial state).

Your program should read in the motion plan and display the exact string in the console once the simulation is started.

If you find difficulty implementing reading information from a text file, you can choose to hard-  code the motion sequence into your program and forfeit the marks associated with it. In this       case, you must define a variable to store the motion sequence at the beginning of your program (so that a tutor can replace it when assessing your work). You should also explicitly indicate you are hard-coding the motion sequence in the Header Comment of your program. Failing to do so would affect the assessment of your submission (incurring a 5% penalty, as if one-day late).

In the Header Comment, you should also indicate the platform (Windows/MacOS/Linux) you used to develop your code so that a tutor can test your submission on your original platform.

Fig. 3. Explicitly indicate hard-coding in the Header Comment of your program

3.2. Display the initial location and heading of the robot and the existence of the

surrounding walls, and write the information into a CSV file

You should display the step that the robot is executing. In the initial state, the message should be (using three digits): Step: 000.

After showing the retrieved motion plan, the next step is to parse the information and print the initial location and heading of the robot in the console: Row: 0, Column: 0, Heading: S.

Besides, you should detect any walls in the robot’s front, left, and right. Only the walls surrounding the cell where the robot is located should be considered.

The E-puck robot has some onboard sensors installed by default. In addition, the robot is added with three Distance Sensors and one Inertial Unit Sensor under the  node. You can  use any or all of these four sensors together with E-puck’s onboard sensors for the tasks. No other sensors should be added to the robot.

Show the existence of the left, front, and right walls. If a wall is detected, print Y; otherwise,     print N. In the example of Fig 1, the detected walls should be : Left Wall: N, Front Wall: N, Right

In summary, you should display the following exact message at the initial stage :

You should also write this information into a CSV file named as MotionExecution.csv” which is stored in the same folder as MotionPlan.txt” . The items should be delimited by commas.

At this step, the CSV file should look like this:

or this if you open it with Notepad:

3.3. Drive the robot following the motion plan

Drive the robot according to the parsed motion plan step by step.


If the motion step to be executed is F’, move the robot Forward for one cell.

Fig. 4. Move forward for one cell

If the motion step to be executed is L’, turn the robot 90 deg to its Left.

Fig. 5. Turn left for 90 deg

If the motion to be executed step is R’, turn the robot 90 deg to its Right.

Fig. 6. Turn right for 90 deg

The robot should keep clear of the walls when moving. A penalty will be incurred if the robot hits any walls.

3.4. Display the location and heading of the robot, and the existence of the

surrounding walls after each motion step, and write the information into the CSV file

Once the robot completes a step, you should show in the console the new location and heading of the robot and the left, front, and right walls of the new cell that the robot stands in.

For example, at the end of the second step, the robot moves to the following location with its heading towards EAST:

Fig. 7. Example robot location and heading

You should show the following exact message in the console :

In addition, you should add this information to MotionExecution.csv”:

3.5. Repeat tasks 3.3 and 3.4 until all the motion commands are executed

Repeat tasks 3.3 and 3.4 until all the motion commands are executed. Print a message “Motion plan executed!” after the robot completes all the motions.

If the motion plan is:

when all the motion commands are executed, the robot should have reached the following state :

Fig. 8. Robot reaching the centre after execution of all motion commands And messages printed in the console should be :

Fig. 9. Messages displayed after execution of all motion commands

Note that each message should have a prefix [z1234567_MTRN4110_PhaseA]” where       z1234567 is replaced with your zID. Your messages should look exactly the same as shown above.

And MotionExecution.csvshould be exactly like the following:

Fig 10. Content of CSV after execution of all motion commands

3.6. Task summary:

Task

Description

1

Read in a sequence of motion plan from a text file and display it in the console

2

Display the initial location and heading of the robot, and the existence of the surrounding walls, and write the information into a CSV file

3

Drive the robot following the motion plan

4

Display the location and heading of the robot, and the existence of the surrounding walls after each motion step, and write the information into the CSV file

5

Repeat tasks 3.3 and 3.4 until all the motion commands are executed

4.  Specifications and Hints:

4.1. Specifications:

Maze:

1.    You should installWebotsR2021b; otherwise, there will be some incompatibility issues.

2.    At the beginning of Phase A, you will be given the same maze layout as shown in the example.

3.    The initial location and heading of the robot will also be the same as illustrated.

4.    This setup is for your practice. For assessment, you may be tested with a different (but similar) maze layout.

5.    You are expected to test your program with various mazes and motion sequences,         including edge cases. Failing to do so may cause poor performance in some test cases.

6.    The initial location and heading of the robot may also be different and could be at any cell of the maze.

7.    The initial location of the robot will always be at the centre of a cell.

8.    The initial heading of the robot will always be towards one of the four directions (North, East, South, West).

9.    The first three characters in the motion plan given to you will always match the world file.

10. The motion sequence may also be different from the example, but should always be valid (no collision with walls if executed correctly).

11. The maze will always be five by nine, and the four borders are always closed.

12. The distance between neighbouring cells is always 0.165 m.

13. The thickness of the walls is always 0.015m.

Robot:

14.  For Phase A, you must use the provided E-puck robot for the tasks and not modify the        robot. You will be asked to submit your controller only. Working on a modified robot during development could lead to incompatibility with the assessors world file and give you advantages over other students who comply with the constraints, and thus would incur a severe penalty (even getting zero marks).

15. Three Distance Sensors and one Inertial Unit sensor have been added to the    node. You can use any or all of these sensors together with E-puck’s onboard sensors for   the tasks. Note all four sensors have noise (expand the feature tree of the world file to see more details); you should carefully handle the noise when using the sensors.

16. You can modify the maze layout for your practice. But you will only submit your controller, which will be tested with the provided world file.

17. The characteristics of the E-puck robot can be foundhere. However, if you are using dead  reckoning, the wheel radius and axle length shown in the table may be inaccurate. You are recommended to tune these parameters using the calibration method introduced during   the lecture.

Implementation:

18. You must use C++ to implement the controller if you have taken MTRN2500 Computing for Mechatronic Engineers before.

19. You can choose to use C if you have not taken MTRN2500, but you need to get the lecturer’s approval before using it.

20.  For portability, you must use the built-in compilers for Windows or macOS.

o For macOS users, please open the Makefile of your controller and add the following line under the CFLAGS section (CFLAGS = -std=c++14).

o

21. The text file storing the motion sequence should be named MotionPlan.txt” . You should define a path variable at the beginning of your controller program indicating the path of  this text file, e.g.,

const std::string  MOTION_ PLAN_FILE_NAME = “ ../../ MotionPlan.txt”;

where ../../MotionPlan.txt will allow you to access the file if the folder structure specified in Section 5.1 is followed.

22. The CSV file storing the execution information should be named MotionExecution.csv” and stored in the same folder as MotionPlan.txt” . You should define a path variable at the          beginning of your controller program indicating the path of this CSV file, e.g.,

const std::string MOTION_ EXECUTION_ FILE_ NAME = “ ../../MotionExecution.csv”;

23. You should use 64 for the TIME_STEP, as used in the Webots Tutorials. No other values should be used.

24. You should make your code modular with good interfaces for the sake of integration in Phase D (refer to the draft specs released).

4.2. Hints:

1.    Consult the lecturer/demonstrators if you are unclear about anything.

2.    You can use standard printing functions for debugging in Webots. If you want to check the value of a variable during the simulation, you can print it to the console. If you want to see until which line the controller runs successfully, you can also add printing breakpoints at    certain steps.

3.    Try decreasing the robot’s speed if you use position control mode and the robot does not move to a position as specified.

4.    Make the robot stop for a while before reading the sensors to get robust wall detection.

5.    Try filtering the sensor readings to get more robust measurements.

6.    You should use forward slash / or double backward slash \\ instead of single backward slash \ to define the path of the file.

5. Assessment :

5.1. Submission of your work

During your development, your project folder should look like this:

z*******_MTRN4110_PhaseA

|--controllers


| | | | |

|--z*******_MTRN4110_PhaseA

|--build

|-- Makefile

|-- z*******_MTRN4110_PhaseA.cpp

|-- z*******_MTRN4110_PhaseA.exe


|--worlds

|         |--z*******_MTRN4110_PhaseA.wbt

|--MotionExecution.csv

|--MotionPlan.txt

You should zip (and only zip) your controllers” folder and name it as

z*******_PhaseA_controllers.zipwhere z******* is your zID. Submit this zip file to Moodle.

Your submission should only contain one controller, which is the finalised version. It is your responsibility to make sure your submission is self-contained and up-to-date.

As we have developed an automatic tool to do the plagiarism check on your code, it is CRUCIAL that you strictly follow the file structure specified above. Any violation in the submission format would incur a 5% penalty (as if one-day late), as that adds much more work to the assessors (we will still do the plagiarism check!).

5.2. Marking criteria :

This assignment will contribute 14% to your final mark.

You will be assessed five times with different setups. Among them, one test will be on the example given to you for practice. Your final mark will be calculated as the following:

markfinal = (markexample + marknewtest1 + marknewtest2 + marknewtest3 + marknewtest4) / 5

Each attempt will be assessed by using the following criteria.