Lab 3: Navigation & Obstacle Avoidance Solution

$30.00

Description

Design objectives

  1. Design a system that allows the robot to drive to a specified set of coordinates, known as waypoints, while avoiding any obstacles in its path.

  1. Implement the design using previous implementations of the Odometer.

  1. Evaluate the design and ensure it can navigate effectively around a field.

Design requirements

The following design requirements must be met:

  • The robot must navigate through a series of specified points using the minimal distance.

  • A list of waypoints must be provided in one location in the code.

  • The robot must use the grid system found on the play floor, where the origin is the starting corner of a tile.

  • Waypoints will be given with respect to the tile grid system. For example, (1, 0) will be located 30.48 cm to the right of the origin (0, 0). Note: waypoints can contain negative integers.

  • When turning to a waypoint, the robot must use the minimal angle needed to turn to it.

  • In encountering an obstacle, the robot must avoid it and resume driving to the next waypoint.

  • In avoiding an obstacle, the robot must continue to detect if there is another obstacle along its way and react accordingly.

© Instructor and Teaching Assistant generated course materials (e.g., handouts, notes, summaries, assignments, exam questions, etc.) are protected by law and may not be copied or distributed in any form or in any medium without explicit permission of the instructor. Note that infringements of copyright can be subject to follow up by the University under the Code of Student Conduct and Disciplinary Procedures.

1/6

ECSE211 Design Principles & Methods Updated:

Demonstration (30 points)

The design must satisfy the requirements by completing the demonstration outlined below.

Design presentation (10 points)

Before demoing the design, your group will be asked some questions for less than 5 minutes. You will present your design and answer questions designed to test your individual understanding of the lab concepts. Each person will be graded individually.

You must present your workflow, an overview of the hardware design, and an overview of the software functionality. Visualizing software with graphics such as flow charts is valuable.

Simple Navigation (10 points)

Starting from the (1, 1) point on the 4×4 tile grid, the robot must travel through 5 waypoints. The TA will specify the waypoints during the demo (see FAQ). You will add them to your code and upload your solution to the robot. An example is shown below in Figure 1 using a minimal angle needed to turn at each waypoint. A maximal angle turn must be avoided (see FAQ).

  • 5 points are given for turning using a minimal angle at all the waypoints. 0 points are given if the robot turns using a maximal (not minimal) angle at one or more waypoints.

  • 5 points are given for reaching the last waypoint within an error tolerance of 2 cm using a Euclidean distance measure. The Euclidean distance error ϵ is defined by the formula shown below, where XD and YD represent the destination waypoint, and XF and YF represent the final position of the robot. Penalties are defined below.

=√( − ) +( − )

Hence, the following point grid is used:

[0, 2] cm

5 points

(2,

4] cm

2.5 points

(4,

) cm

0 points

(2, 3)

(3, 2)

(2, 2)

(1, 1)

(3, 1)

(0, 0)

Figure 1. Example robot path 1 (labelled).

© Instructor and Teaching Assistant generated course materials (e.g., handouts, notes, summaries, assignments, exam questions, etc.) are protected by law and may not be copied or distributed in any form or in any medium without explicit permission of the instructor. Note that infringements of copyright can be subject to follow up by the University under the Code of Student Conduct and Disciplinary Procedures.

2/6

ECSE211 Design Principles & Methods Updated:

Navigation with Obstacle Avoidance (10 points)

Starting from the (1, 1) point on the 4×4 tile grid, the robot must travel through the provided waypoints from the previous section. Note that you are not allowed to reupload your code between the two demos! At most two obstacles will be placed ANYWHERE along the robot’s trajectory, but not on a waypoint. The robot must avoid the obstacle during navigation without touching it.

  • 5 points are awarded for completely avoiding obstacle(s).

  • 5 points are awarded for reaching the final waypoint within an error tolerance of 2 cm using a Euclidean distance measure as in the previous demo. Hence, the following table is used:

[0, 2] cm

5 points

(2,

4] cm

2.5 points

(4,

) cm

0 points

Provided materials

Sample code

No sample code is provided for this lab. Instead, follow the guidelines given below. Create a

Navigation class that has at least the following methods:

  • void travelTo(double x, double y)

This method causes the robot to travel to the absolute field location (x, y), specified in tile points. This method should continuously call turnTo(double theta) and then set the motor

speed to forward (straight). This will make sure that your heading is updated until you reach your exact goal. This method will poll the odometer for information.

  • void turnTo(double theta)

This method causes the robot to turn (on point) to the absolute heading theta. This method should turn a MINIMAL angle to its target.

  • boolean isNavigating()

This method returns true if another thread has called travelTo() or turnTo() and the method has yet to return; false otherwise.

Physical material

In the lab, there will be floors with the grid available, and blocks that will make up the obstacles.

© Instructor and Teaching Assistant generated course materials (e.g., handouts, notes, summaries, assignments, exam questions, etc.) are protected by law and may not be copied or distributed in any form or in any medium without explicit permission of the instructor. Note that infringements of copyright can be subject to follow up by the University under the Code of Student Conduct and Disciplinary Procedures.

3/6

ECSE211 Design Principles & Methods Updated:

Implementation instructions

  1. Adjust the parameters of your controller, if any, to minimize the distance between the desired destination and the final position of the robot. Simultaneously, you should aim to minimize the number of oscillations made by the robot around its destination before stopping.

  1. Write a program to travel through a set of waypoints. For example, Figure 2 shown below follows (3, 2), (2, 2), (2, 3), and (3, 1) in order.

  1. Modify your code to use the ultrasonic sensor to detect an obstacle (i.e. a block) and avoid collisions with it. You may mount the ultrasonic sensor as you wish, and may use the wall follower code if desired. Additionally, you may create another class to perform this function.

  1. Modify the program to avoid any obstacles encountered along the robot’s path. For example, if the robot was travelling from (1, 3) to (3, 1), it should avoid the obstacle along the path and still reach (3, 1) as shown in Figure 3 below.

(2, 3)

(2, 2)

(1, 1)

(3, 2)

(3, 1)

(1, 1)

(1, 3)

(3, 1)

Figure 2. Example robot path 1. Figure 3. Example robot path 2.

© Instructor and Teaching Assistant generated course materials (e.g., handouts, notes, summaries, assignments, exam questions, etc.) are protected by law and may not be copied or distributed in any form or in any medium without explicit permission of the instructor. Note that infringements of copyright can be subject to follow up by the University under the Code of Student Conduct and Disciplinary Procedures.

4/6

ECSE211 Design Principles & Methods Updated:

Report Requirements

The following sections must be included in your report. Answer all questions in the lab report and copy them into your report. For more information, refer to ECSE211SubmissionInstructions.pdf. Always provide justifications and explanations for all your answers.

Section 1: Design Evaluation

You should concisely explain the overall design of your software and hardware. You must present your workflow, an overview of the hardware design, and an overview of the software functionality. You must briefly talk about your design choices before arriving at your final design. Visualizing hardware and software with graphics (i.e. flowcharts, class diagrams) must be shown.

Section 2: Test Data

This section describes what data must be collected to evaluate your design requirements. Collect the data using the methodology described below and present it in your report in a formatted table.

Navigation test (10 independent trials)

  1. Program the robot to travel to waypoints (3, 2), (2, 2), (2, 3), and (3, 1) as in Figure 2.

  1. Note down the destination waypoint (XD,YD) in cm.

  1. Place the robot on the origin of a grid tile.

  1. Ensure there are no obstacles in the robot’s path.

  1. Run the program to drive the robot through the waypoints specified in Step 1.

  1. Record (XF,YF) which is the final position of the robot.

Section 3: Test Analysis

  • Compute the Euclidean error distance ϵ between (XF,YF) and (XD,YD) for each trial in a table.

  • Compute the mean and sample standard deviation for error ϵ computed in the Navigation test. Be sure to use the show general formulas and sample calculations.

Section 4: Observations and Conclusions

Answer the following questions:

  • Are the errors you observed due to the odometer or navigator? What are the main sources?

  • How accurately does the navigation controller move the robot to its destination?

  • How quickly does it settle (i.e. stop oscillating) on its destination?

  • How would increasing the speed of the robot affect the accuracy of your navigation?

Section 5: Further Improvements

What steps can be taken to reduce the errors you discussed above? Identify at least one hardware and one software solution. Provide explanations as to why they would work.

© Instructor and Teaching Assistant generated course materials (e.g., handouts, notes, summaries, assignments, exam questions, etc.) are protected by law and may not be copied or distributed in any form or in any medium without explicit permission of the instructor. Note that infringements of copyright can be subject to follow up by the University under the Code of Student Conduct and Disciplinary Procedures.

5/6

ECSE211 Design Principles & Methods Updated:

Frequently asked questions (FAQ)

  1. What is a minimal angle?

Referring to the (1, 1) waypoint in Figure 1, its minimal turning angle is approximately 60° clockwise, as opposed to a maximal turning angle of 300° counterclockwise.

  1. What is meant by “design presentation”?

Before a lab demo, you and your partner will briefly present your design. This can include a basic visualization of how your code functions, such as a flow chart. You will then be asked a series of questions. These could be related to the lab tutorial or relevant lectures. For this part, a grade of 10 signifies full understanding, 5 signifies satisfactory understanding, while 0 shows no understanding at all. Note that memorized answers are discouraged and both partners should be responsible for understanding the design and their associated code, even if one of them did not write all of it.

  1. Which maps will be used for this lab’s demo?

Your robot must navigate using one of the following maps starting from the point (1, 1): Map 1: (1, 3), (2 ,2), (3, 3), (3, 2), (2, 1)

Map 2: (2, 2), (1, 3), (3, 3), (3, 2), (2, 1)

Map 3: (2, 1), (3, 2), (3, 3), (1, 3), (2, 2)

Map 4: (1, 2), (2, 3), (2, 1), (3, 2), (3, 3)

© Instructor and Teaching Assistant generated course materials (e.g., handouts, notes, summaries, assignments, exam questions, etc.) are protected by law and may not be copied or distributed in any form or in any medium without explicit permission of the instructor. Note that infringements of copyright can be subject to follow up by the University under the Code of Student Conduct and Disciplinary Procedures.

6/6