Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
a2b64de
Create lib . …
tiffanalin Dec 7, 2022
83bcc6b
Create components.md
tiffanalin Dec 7, 2022
f787521
Create README
tiffanalin Dec 7, 2022
e3c3cbb
Create ideation.md
tiffanalin Dec 7, 2022
f4860d5
Update ideation.md
tiffanalin Dec 7, 2022
1573ff9
Update ideation.md
tiffanalin Dec 7, 2022
107897d
Delete lib . …
tiffanalin Dec 7, 2022
3a916c9
Create README
tiffanalin Dec 7, 2022
1b50912
Create README
tiffanalin Dec 7, 2022
aaa342c
Create algorithm.md
tiffanalin Dec 7, 2022
c5d271d
Create something
tiffanalin Dec 7, 2022
192955c
Update ideation.md
tiffanalin Dec 7, 2022
1c6cd20
Create final_project.ino
tiffanalin Dec 10, 2022
7895b3c
Merge pull request #9 from tiffanalin/dev
tiffanalin Dec 10, 2022
851a393
Update final_project.ino
tiffanalin Dec 11, 2022
f81baac
Merge pull request #10 from tiffanalin/tiffany_edits
tiffanalin Dec 11, 2022
d1d548c
Update final_project.ino
tiffanalin Dec 25, 2022
89a2200
Merge pull request #12 from tiffanalin/tiffany_edits
tiffanalin Dec 25, 2022
17082b3
Update README
CryptoClemzilla Dec 26, 2022
700d568
Update final_project.ino
tiffanalin Jan 1, 2023
8e46eb5
Merge pull request #15 from tiffanalin/tiffany_edits
tiffanalin Jan 1, 2023
d6f68f4
Update README
CryptoClemzilla Jan 1, 2023
6319340
Update final_project.ino
CryptoClemzilla Jan 1, 2023
17be742
Update algorithm.md
tiffanalin Jan 2, 2023
8be2cbc
Update final_project.ino
tiffanalin Jan 2, 2023
077a7d2
Merge pull request #16 from tiffanalin/tiffany_edits
tiffanalin Jan 2, 2023
0edede6
Update README
tiffanalin Jan 2, 2023
18e85ee
Update final_project.ino
Romaric1331 Jan 2, 2023
6d84846
Add files via upload
CryptoClemzilla Jan 2, 2023
bbc5efb
Update final_project.ino
tiffanalin Jan 5, 2023
f82bf86
Merge pull request #19 from tiffanalin/tiffany_edits
tiffanalin Jan 5, 2023
7d71b40
Update final_project.ino
CryptoClemzilla Jan 5, 2023
4431f5b
Update final_project.ino
tiffanalin Jan 5, 2023
3609506
Merge pull request #20 from tiffanalin/tiffany_edits
tiffanalin Jan 5, 2023
a4316c0
Update final_project.ino
CryptoClemzilla Jan 5, 2023
54ce41a
Add files via upload
CryptoClemzilla Jan 5, 2023
e28c7e0
Update final_project.ino
CryptoClemzilla Jan 5, 2023
78a5193
Create hot_code
CryptoClemzilla Jan 5, 2023
234d30e
Update final_project.ino
tiffanalin Jan 5, 2023
84287d3
Create sketch_jan5c.ino
tiffanalin Jan 5, 2023
7e2c340
Update final_project.ino
tiffanalin Jan 11, 2023
9b24521
Merge branch 'dev' into tiffany_edits
tiffanalin Jan 11, 2023
9b4235a
Merge pull request #23 from tiffanalin/tiffany_edits
tiffanalin Jan 11, 2023
0883d82
Merge branch 'MakerLabCRI:main' into dev
tiffanalin Jan 11, 2023
52c6c50
Merge branch 'tiffany_edits' of https://github.com/tiffanalin/robotic…
tiffanalin Jan 11, 2023
9143895
Merge branch 'main' into tiffany_edits
tiffanalin Jan 11, 2023
7e71b46
Merge pull request #24 from tiffanalin/tiffany_edits
tiffanalin Jan 11, 2023
afb1a8b
Update sketch_jan5c.ino
tiffanalin Jan 11, 2023
21ce012
Merge branch 'tiffany_edits' of https://github.com/tiffanalin/robotic…
tiffanalin Jan 11, 2023
a833c50
Merge pull request #25 from tiffanalin/tiffany_edits
tiffanalin Jan 11, 2023
17d1758
Update final_project.ino
tiffanalin Jan 11, 2023
396b791
Merge pull request #26 from tiffanalin/tiffany_edits
tiffanalin Jan 11, 2023
95a8491
Delete sketch_jan5c directory
tiffanalin Jan 11, 2023
10e5ec9
Delete hot_code
tiffanalin Jan 11, 2023
62e29cd
Update algorithm.md
tiffanalin Jan 11, 2023
00a33d1
Update algorithm.md
tiffanalin Jan 11, 2023
554fb66
Delete src directory
tiffanalin Jan 11, 2023
8cf069e
Create src
tiffanalin Jan 11, 2023
be249cf
Delete src
tiffanalin Jan 11, 2023
641b2ea
Rename to src
tiffanalin Jan 11, 2023
667445b
Add files via upload
Romaric1331 Jan 14, 2023
70f0d57
Merge pull request #27 from tiffanalin/Robot-Demonstration
Romaric1331 Jan 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/algorithm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<b>Update 10 January 2023:</b>
Defined an array of coordinates that make up the path of the robot. As the program iterates through the array of coordinates with position information (robot is facing north, south, east, or west), the Zumo robot moves accordingly forward, left or right.

--------------------------------------------------------------------------------------------------------
tried to implement dijkstra, but difficult to put together code with our basic C++ skill level.

Changed tactic to use wavefront algorithm in pathplanning

Using wavefront:
- defined array 8x8, obstacle value = 255, goal value = 1, path = 0, robot location = 254
- defined start, goal, and robot locations
- if, using ultrasound sensor, sent pings to detect obstacles. if distance is less than a maximum distance of 200cm, an obstacle is recognized
- else if, not an obstacle and not the goal, add +1 to the value on the array
- continue to loop until goal is found
- if, goal, return the minimum path to goal for robot to travel.
29 changes: 29 additions & 0 deletions lib/ideation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Ideation Report ##

### Path Planning Arduino ###

#### Team: Tiffany, Clemence, Romaric

1. <i> Introduction : </i> We will have a robot plan a path through a grid-obstacle course, going from start to finish with avoiding unknown obstacles

2. <i> Market survey / Bibliography: </i> N/A

3. <i> How you will solve this problem: </i>
- We will use a pre-built Zumo Robot for our car. And, we will use ultrasonic sensors for detecting obstacles in the way of the car.
- We will learn about path finding algorithms and select an appropriate one to use to move our robot car through the grid obstacle course in the shortest path.
- We will also use the ultrasonic sensor to detect obstacles by calculating the distance between the car and the obstacle with differences in sound.

4. <i> Expected List of Features: </i>
- Ultrasonic sensor - detect obstacles
- Fun algorithm - Find shortest path from A to B

5. <i> List of equipment used: </i>
- Ultrasonic sensor
- Zumo Robot
- Power battery

6. <i> References:</i>
- [Growing With the Web - Pathfinding Algorithm](https://www.growingwiththeweb.com/2012/06/a-pathfinding-algorithm.html)
- [MIT fab - Path Planning](https://fab.cba.mit.edu/classes/865.21/topics/path_planning/robotic.html)
- [Miguel Grinberg - Building an Arduino Robot Part V - Avoiding Obstacles](https://blog.miguelgrinberg.com/post/building-an-arduino-robot-part-v-avoiding-obstacles )
- [Circuit Digest - Arduino Obstacle Avoiding Robot](https://circuitdigest.com/microcontroller-projects/arduino-obstacle-avoding-robot)
1 change: 1 addition & 0 deletions lib/images/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions lib/resources/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

Websites used:
https://www.freecodecamp.org/news/dijkstras-algorithm-explained-with-a-pseudocode-example/
https://www.societyofrobots.com/programming_wavefront.shtml

Understanding 2d arrays:
https://www.tutorialspoint.com/arduino/arduino_multi_dimensional_arrays.html

Number of paths on our grid:
https://towardsdatascience.com/understanding-combinatorics-number-of-paths-on-a-grid-bddf08e28384


Video tutorials watched:
https://www.youtube.com/watch?v=22yAt5zs5Zc
https://www.youtube.com/watch?v=p178eQpDI_E&t=8s


PPT/courses:
Binary file added lib/schematics/Robot-Team (1).pdf
Binary file not shown.
1 change: 1 addition & 0 deletions lib/schematics/components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added lib/videos/Path Finding Demonstration.mp4
Binary file not shown.
1 change: 1 addition & 0 deletions lib/videos/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

220 changes: 220 additions & 0 deletions src/final_project.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
/**
* Pololu Zumo Robot with Obstacle Avoidance
*
* by Clemence, Romaric & Tiffany
*
* This robot will travel from start to goal in a 8x8 grid while
* avoiding known obstacles placed on the grid.
*
*/

// import library
#include <ZumoShield.h>

//Zumo robot set-up
ZumoMotors motors;

//define constants
#define PATH_LEN 15
#define X 8
#define Y 8

//motor speeds and duration
#define TURN_SPEED 275
#define FORWARD_SPEED 200
#define FORWARD_DURATION 1600
#define TURN_LEFT_DURATION 250
#define TURN_RIGHT_DURATION 246

//define
char position;
//8x8 grid with obstacles = 1
int grid[X][Y]= {
{0,0,0,0,1,0,0,1},
{0,0,1,0,0,0,0,0},
{0,0,0,0,0,1,0,0},
{0,1,0,1,0,0,0,1},
{0,0,0,0,0,0,1,0},
{0,1,0,1,1,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,1,1,0,0,0},
};



void setup() {
// put your setup code here, to run once:
position = 'n';
Serial.begin(9600);
}

//robot path from start to goal
int path[PATH_LEN][2] = {
{0,0},
{0,1},
{1,1},
{1,2},
{2,2},
{2,3},
{2,4},
{3,4},
{3,5},
{4,5},
{5,5},
{6,5},
{6,6},
{6,7},
{7,7}
};

/**
goPath,
This function moves the robot to the next location in the path.
inputs = currentX: x current location, currentY: y current location, nextX: next x location, nextY: next y location
output = status of our followed path (3 for goal reached, 2 if obstacle detected, 1 for no direction
*/

int goPath(int currentX,int currentY,int nextX,int nextY ){

int returnValue = 1;

Serial.print("(");
Serial.print(currentX);
Serial.print(",");
Serial.print(currentY);
Serial.print(")");
Serial.print("-->");

Serial.print("(");
Serial.print(nextX);
Serial.print(",");
Serial.print(nextY);
Serial.println(")");

char direction = goNext(currentX, currentY, nextX, nextY);
Serial.print("Direction: ");

Serial.println(direction);

if (direction == 'r'){
turnRight();
goForward();
}
else if (direction == 'l'){
turnLeft();
goForward();
}

else if (direction == 'f'){
goForward();
}
return returnValue;

}

/**
goNext,
Depending on the current position, the robot moves to the next square on the grid.
input = x: x current, y: y current, w: x next, z: y next
output = f: front, b:back, l:left, r:right
*/
char goNext(int x,int y,int w,int z){

if (x == w && y < z){
if (position == 'n'){
return 'f';
}
else if (position == 'o'){return 'r';}
else if(position == 's'){return 'b';}
else if(position == 'e'){return 'l';}
}
if (x == w && y > z){
if (position == 'n'){
return 'b';}
else if (position == 'o'){return 'l';}
else if(position == 's'){return 'f';}
else if(position == 'e'){return 'r';}
}
if (x < w && y == z){
if (position == 'n'){
return 'l';}
else if (position == 'o'){return 'f';}
else if(position == 's'){return 'r';}
else if(position == 'e'){return 'b';}
}
if (x > w && y == z){
if (position == 'n'){
return 'r';}
else if (position == 'o'){return 'b';}
else if(position == 's'){return 'l';}
else if(position == 'e'){return 'f';}
}
if ((x == w && y == z) || (x !=w && y != z)){
return 'e';
}

}

//functions to move robot
//robot moves forward
void goForward(){
motors.setSpeeds(FORWARD_SPEED, FORWARD_SPEED);
delay(FORWARD_DURATION);
stop();
}

//robot stops
void stop(){
motors.setSpeeds(0, 0);
delay(1000);
}

//robot makes 90 degree left turn
void turnLeft(){
motors.setSpeeds(-TURN_SPEED, TURN_SPEED);
delay(TURN_LEFT_DURATION);
if (position == 'n'){
position = 'o';
}
else if (position == 'o'){position = 's';}
else if(position == 's'){position = 'e';}
else if(position == 'e'){position = 'n';}
stop();
}

//robot makes 90 degree right turn
void turnRight(){
motors.setSpeeds(TURN_SPEED, -TURN_SPEED);
delay(TURN_RIGHT_DURATION);
if (position == 'n'){
position = 'e';
}
else if (position == 'e'){position = 's';}
else if(position == 's'){position = 'o';}
else if(position == 'o'){position = 'n';}
stop();
}

int count = 0;

void loop() {
// setting currentX and currentY variables to path values in PATH_LEN and goPath is called
if(count == 0){
for(int i = 0; i < PATH_LEN -1 ; i++){
int currentX = path[i][0];
int currentY = path[i][1];

if(i == PATH_LEN -1){
// goal reached
break;
}
int nextX = path[i+1][0];
int nextY = path[i+1][1];

goPath(currentX, currentY, nextX, nextY);

}
//ends loop
count++;
}