├── Project4.1-CommunicatorGUI ├── bin │ ├── Callback.class │ ├── ComputerCommunicator.class │ ├── Driver.class │ ├── World$GraphicsUpdater.class │ └── World.class ├── images │ ├── clear.png │ ├── occupied.png │ └── robot.png └── src │ ├── Callback.java │ ├── ComputerCommunicator.java │ ├── Driver.java │ └── World.java ├── Project5.1-FinalRobot ├── bin │ ├── GridNavigator.class │ ├── LineTrackSensor.class │ ├── LineTracker.class │ ├── MainRobot.class │ ├── Message.class │ ├── MyPilot.class │ ├── Node.class │ ├── ObjectSensor.class │ ├── OccupancyUpdate.class │ ├── Pathfinder.class │ └── Pose.class ├── doc │ ├── GridNavigator.html │ ├── LineTrackSensor.html │ ├── LineTracker.html │ ├── MainRobot.html │ ├── Message.html │ ├── MyPilot.html │ ├── Node.html │ ├── ObjectSensor.html │ ├── OccupancyUpdate.html │ ├── Pathfinder.html │ ├── Pose.html │ ├── allclasses-frame.html │ ├── allclasses-noframe.html │ ├── class-use │ │ ├── GridNavigator.html │ │ ├── LineTrackSensor.html │ │ ├── LineTracker.html │ │ ├── MainRobot.html │ │ ├── Message.html │ │ ├── MyPilot.html │ │ ├── Node.html │ │ ├── ObjectSensor.html │ │ ├── OccupancyUpdate.html │ │ ├── Pathfinder.html │ │ └── Pose.html │ ├── constant-values.html │ ├── deprecated-list.html │ ├── help-doc.html │ ├── index-files │ │ ├── index-1.html │ │ ├── index-10.html │ │ ├── index-11.html │ │ ├── index-12.html │ │ ├── index-13.html │ │ ├── index-14.html │ │ ├── index-15.html │ │ ├── index-16.html │ │ ├── index-17.html │ │ ├── index-18.html │ │ ├── index-19.html │ │ ├── index-2.html │ │ ├── index-3.html │ │ ├── index-4.html │ │ ├── index-5.html │ │ ├── index-6.html │ │ ├── index-7.html │ │ ├── index-8.html │ │ └── index-9.html │ ├── index.html │ ├── overview-tree.html │ ├── package-frame.html │ ├── package-list │ ├── package-summary.html │ ├── package-tree.html │ ├── package-use.html │ ├── resources │ │ ├── background.gif │ │ ├── tab.gif │ │ ├── titlebar.gif │ │ └── titlebar_end.gif │ └── stylesheet.css └── src │ ├── GridNavigator.java │ ├── LineTrackSensor.java │ ├── LineTracker.java │ ├── MainRobot.java │ ├── Message.java │ ├── MyPilot.java │ ├── Node.java │ ├── ObjectSensor.java │ ├── OccupancyUpdate.java │ ├── Pathfinder.java │ └── Pose.java ├── README.md ├── doc ├── GridNavigator.html ├── LineTrackSensor.html ├── LineTracker.html ├── MainRobot.html ├── Message.html ├── MyPilot.html ├── Node.html ├── ObjectSensor.html ├── OccupancyUpdate.html ├── Pathfinder.html ├── Pose.html ├── allclasses-frame.html ├── allclasses-noframe.html ├── class-use │ ├── GridNavigator.html │ ├── LineTrackSensor.html │ ├── LineTracker.html │ ├── MainRobot.html │ ├── Message.html │ ├── MyPilot.html │ ├── Node.html │ ├── ObjectSensor.html │ ├── OccupancyUpdate.html │ ├── Pathfinder.html │ └── Pose.html ├── constant-values.html ├── deprecated-list.html ├── help-doc.html ├── index-files │ ├── index-1.html │ ├── index-10.html │ ├── index-11.html │ ├── index-12.html │ ├── index-13.html │ ├── index-14.html │ ├── index-15.html │ ├── index-16.html │ ├── index-17.html │ ├── index-18.html │ ├── index-19.html │ ├── index-2.html │ ├── index-3.html │ ├── index-4.html │ ├── index-5.html │ ├── index-6.html │ ├── index-7.html │ ├── index-8.html │ └── index-9.html ├── index.html ├── overview-tree.html ├── package-frame.html ├── package-list ├── package-summary.html ├── package-tree.html ├── package-use.html ├── resources │ ├── background.gif │ ├── tab.gif │ ├── titlebar.gif │ └── titlebar_end.gif └── stylesheet.css ├── index.html ├── javascripts └── scale.fix.js ├── params.json └── stylesheets ├── pygment_trac.css └── styles.css /Project4.1-CommunicatorGUI/bin/Callback.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project4.1-CommunicatorGUI/bin/Callback.class -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/bin/ComputerCommunicator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project4.1-CommunicatorGUI/bin/ComputerCommunicator.class -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/bin/Driver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project4.1-CommunicatorGUI/bin/Driver.class -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/bin/World$GraphicsUpdater.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project4.1-CommunicatorGUI/bin/World$GraphicsUpdater.class -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/bin/World.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project4.1-CommunicatorGUI/bin/World.class -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/images/clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project4.1-CommunicatorGUI/images/clear.png -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/images/occupied.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project4.1-CommunicatorGUI/images/occupied.png -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/images/robot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project4.1-CommunicatorGUI/images/robot.png -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/src/Callback.java: -------------------------------------------------------------------------------- 1 | import java.awt.Point; 2 | import java.util.ArrayList; 3 | 4 | /** 5 | * Allows the {@link ComputerCommunicator} to return data within the scope of the {@link World} class 6 | * 7 | * @author peter 8 | * 9 | */ 10 | public interface Callback { 11 | 12 | /** 13 | * 14 | * @param x X position of update 15 | * @param y Y position of update 16 | * @param obstacles list of obstacles to add to the display 17 | */ 18 | public void run(int x, int y, ArrayList obstacles); 19 | } 20 | -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/src/ComputerCommunicator.java: -------------------------------------------------------------------------------- 1 | import java.awt.Point; 2 | import java.io.DataInputStream; 3 | import java.io.DataOutputStream; 4 | import java.io.IOException; 5 | import java.net.ServerSocket; 6 | import java.net.Socket; 7 | import java.util.ArrayList; 8 | 9 | import javax.swing.SwingUtilities; 10 | 11 | /** 12 | * Handles all sending and parsing of message with the robot. This class 13 | * inmplements runnable so it can be started in a new thread. 14 | * 15 | * @author peter 16 | * 17 | */ 18 | public class ComputerCommunicator implements Runnable { 19 | 20 | private static ServerSocket socket; 21 | private static Socket conn; 22 | private static DataInputStream in; 23 | private static DataOutputStream out; 24 | 25 | private int x, y; 26 | private Callback c; 27 | 28 | /** 29 | * 30 | * @param x 31 | * the x position of the robot 32 | * @param y 33 | * the y position of the robot 34 | * @param c 35 | * a class implementing the callback interface 36 | */ 37 | public ComputerCommunicator(int x, int y, Callback c) { 38 | this.x = x; 39 | this.y = y; 40 | this.c = c; 41 | } 42 | 43 | /** 44 | * this si the run method required by the runnable interface. it sends a 45 | * command to the robot, which interprets it as a new destination. 46 | */ 47 | public void run() { 48 | try { 49 | sendCommand(x, y); 50 | } catch (Exception e) { 51 | System.out.println("ERROR " + e.getMessage()); 52 | } 53 | } 54 | 55 | private void sendCommand(int x, int y) throws IOException { 56 | out.writeInt(x); 57 | out.writeInt(y); 58 | catchResponses(); 59 | } 60 | 61 | private void catchResponses() throws IOException { 62 | boolean done = false; 63 | System.out.println("catching responses..."); 64 | while (!done) { 65 | 66 | done = in.readBoolean(); 67 | int x = in.readInt(); 68 | int y = in.readInt(); 69 | int l = in.readInt(); 70 | ArrayList obstacles = new ArrayList(); 71 | for (int i = 0; i < l; i++) { 72 | obstacles.add(new Point(in.readInt(), in.readInt())); 73 | } 74 | 75 | c.run(x, y, obstacles); 76 | } 77 | 78 | System.out.println("destinatino reached"); 79 | } 80 | 81 | /** 82 | * initializes the connection between the robot and the computer 83 | * @throws IOException 84 | */ 85 | public static void connect() throws IOException { 86 | socket = new ServerSocket(1234); 87 | System.out.println("waiting..."); 88 | conn = socket.accept(); 89 | System.out.println("accepted"); 90 | 91 | in = new DataInputStream(conn.getInputStream()); 92 | out = new DataOutputStream(conn.getOutputStream()); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/src/Driver.java: -------------------------------------------------------------------------------- 1 | import java.awt.Dimension; 2 | import java.awt.event.ActionEvent; 3 | import java.awt.event.ActionListener; 4 | import java.io.IOException; 5 | 6 | import javax.swing.JButton; 7 | import javax.swing.JFrame; 8 | import javax.swing.JPanel; 9 | 10 | /** 11 | * Contains the main. window won't pop-up until connection to the robot is 12 | * established. 13 | * 14 | * @author peter 15 | * 16 | */ 17 | public class Driver { 18 | 19 | public static void main(String[] args) throws IOException { 20 | ComputerCommunicator.connect(); 21 | JFrame frame = new JFrame("Controller"); 22 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 23 | 24 | frame.add(new World()); 25 | frame.setPreferredSize(new Dimension(800, 500)); 26 | frame.pack(); 27 | frame.setVisible(true); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Project4.1-CommunicatorGUI/src/World.java: -------------------------------------------------------------------------------- 1 | import java.awt.Color; 2 | import java.awt.Graphics; 3 | import java.awt.Point; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.awt.event.MouseEvent; 7 | import java.awt.event.MouseListener; 8 | import java.util.ArrayList; 9 | 10 | import javax.swing.JButton; 11 | import javax.swing.JPanel; 12 | import javax.swing.SwingUtilities; 13 | 14 | /** 15 | * This class handles all the GUI of the program. 16 | * 17 | * @author peter 18 | * 19 | */ 20 | public class World extends JPanel implements MouseListener, Callback, 21 | ActionListener { 22 | 23 | private static final int W = 9, H = 5; 24 | 25 | private static ArrayList obstacles; 26 | private static int robotX = 0, robotY = 0; 27 | private int s; 28 | private JButton reset; 29 | 30 | /** 31 | * creates the GUI 32 | */ 33 | World() { 34 | super(); 35 | reset = new JButton("Clear Obstacles"); 36 | reset.addActionListener(this); 37 | this.add(reset); 38 | addMouseListener(this); 39 | s = Math.min(getWidth() / W, getHeight() / H); 40 | obstacles = new ArrayList(); 41 | } 42 | 43 | private void setRobotPosition(int x, int y) { 44 | if (x >= 0 && x < W && y >= 0 && y < H) { 45 | robotX = x; 46 | robotY = y; 47 | } else { 48 | System.out.println("can't set robot location to: " + x + "," + y); 49 | } 50 | } 51 | 52 | private void addObstacles(ArrayList obstacles) { 53 | for (Point p : obstacles) { 54 | if (!World.obstacles.contains(p)) { 55 | World.obstacles.add(p); 56 | } 57 | } 58 | } 59 | 60 | public void paintComponent(Graphics g) { 61 | super.paintComponent(g); 62 | s = Math.min(getWidth() / W, getHeight() / H); 63 | g.drawRect(0, 0, W * s, H * s); 64 | for (int i = 1; i <= W; i++) { 65 | g.drawLine(i * s, 0, i * s, s * H); 66 | } 67 | for (int j = 1; j <= H; j++) { 68 | g.drawLine(0, j * s, W * s, j * s); 69 | } 70 | 71 | drawRobot(g); 72 | drawObstacles(g); 73 | } 74 | 75 | private void drawRobot(Graphics g) { 76 | g.setColor(Color.green); 77 | g.fillOval(robotX * s, (H - robotY - 1) * s, s, s); 78 | } 79 | 80 | private void drawObstacles(Graphics g) { 81 | for (Point p : obstacles) { 82 | g.setColor(Color.red); 83 | g.fillOval(p.x * s, (H - p.y - 1) * s, s, s); 84 | } 85 | } 86 | 87 | @Override 88 | public void mouseClicked(MouseEvent me) { 89 | int x = me.getX() / s; 90 | int y = H - me.getY() / s - 1; 91 | new Thread(new ComputerCommunicator(x, y, this)).start(); 92 | } 93 | 94 | @Override 95 | public void mouseEntered(MouseEvent arg0) { 96 | } 97 | 98 | @Override 99 | public void mouseExited(MouseEvent arg0) { 100 | } 101 | 102 | @Override 103 | public void mousePressed(MouseEvent arg0) { 104 | } 105 | 106 | @Override 107 | public void mouseReleased(MouseEvent arg0) { 108 | } 109 | 110 | private class GraphicsUpdater implements Runnable { 111 | 112 | int x, y; 113 | ArrayList obstacles; 114 | 115 | GraphicsUpdater(int x, int y, ArrayList obstacles) { 116 | this.x = x; 117 | this.y = y; 118 | this.obstacles = obstacles; 119 | } 120 | 121 | public void run() { 122 | setRobotPosition(x, y); 123 | addObstacles(obstacles); 124 | repaint(); 125 | } 126 | } 127 | 128 | @Override 129 | public void run(int x, int y, ArrayList obstacles) { 130 | SwingUtilities.invokeLater(new GraphicsUpdater(x, y, obstacles)); 131 | } 132 | 133 | @Override 134 | public void actionPerformed(ActionEvent ae) { 135 | if (ae.getSource() == reset) { 136 | obstacles.clear(); 137 | repaint(); 138 | } 139 | } 140 | 141 | } -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/GridNavigator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/GridNavigator.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/LineTrackSensor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/LineTrackSensor.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/LineTracker.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/LineTracker.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/MainRobot.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/MainRobot.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/Message.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/Message.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/MyPilot.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/MyPilot.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/Node.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/Node.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/ObjectSensor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/ObjectSensor.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/OccupancyUpdate.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/OccupancyUpdate.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/Pathfinder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/Pathfinder.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/bin/Pose.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/bin/Pose.class -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 |

All Classes

12 |
13 | 26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 |

All Classes

12 |
13 | 26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/class-use/GridNavigator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class GridNavigator 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
GridNavigator

66 |
67 |
No usage of GridNavigator
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/class-use/LineTracker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class LineTracker 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
LineTracker

66 |
67 |
No usage of LineTracker
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/class-use/MainRobot.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class MainRobot 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
MainRobot

66 |
67 |
No usage of MainRobot
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/class-use/Message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class Message 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
Message

66 |
67 |
No usage of Message
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/class-use/MyPilot.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class MyPilot 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
MyPilot

66 |
67 |
No usage of MyPilot
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/class-use/Node.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class Node 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
Node

66 |
67 |
68 |
    69 |
  • 70 |
      71 |
    • 72 | 73 | 74 |

      Uses of Node in <Unnamed>

      75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 88 | 89 | 90 |
      Methods in <Unnamed> that return types with arguments of type Node 
      Modifier and TypeMethod and Description
      java.util.ArrayList<Node>Pathfinder.getPath(int startX, 85 | int startY, 86 | int goalX, 87 | int goalY) 
      91 |
    • 92 |
    93 |
  • 94 |
95 |
96 | 97 |
98 | 99 | 100 | 101 | 102 | 111 |
112 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/class-use/ObjectSensor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class ObjectSensor 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
ObjectSensor

66 |
67 |
68 | 94 |
95 | 96 |
97 | 98 | 99 | 100 | 101 | 110 |
111 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/class-use/Pathfinder.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class Pathfinder 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
Pathfinder

66 |
67 |
No usage of Pathfinder
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deprecated List 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Deprecated API

66 |

Contents

67 |
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/index-files/index-16.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | V-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
A C D E G I K L M N O P R S T V W X Y  65 | 66 | 67 |

V

68 |
69 |
visited - Variable in class Node
70 |
71 |
boolean to mark node as visited
72 |
73 |
74 | A C D E G I K L M N O P R S T V W X Y 
75 | 76 |
77 | 78 | 79 | 80 | 81 | 90 |
91 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/index-files/index-4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | E-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
A C D E G I K L M N O P R S T V W X Y  65 | 66 | 67 |

E

68 |
69 |
E - Static variable in class Pose
70 |
 
71 |
72 | A C D E G I K L M N O P R S T V W X Y 
73 | 74 |
75 | 76 | 77 | 78 | 79 | 88 |
89 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/index-files/index-7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | K-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
A C D E G I K L M N O P R S T V W X Y  65 | 66 | 67 |

K

68 |
69 |
keys - Static variable in class LineTracker
70 |
 
71 |
72 | A C D E G I K L M N O P R S T V W X Y 
73 | 74 |
75 | 76 | 77 | 78 | 79 | 88 |
89 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Generated Documentation (Untitled) 7 | 59 | 60 | 61 | 62 | 63 | 64 | <noscript> 65 | <div>JavaScript is disabled on your browser.</div> 66 | </noscript> 67 | <h2>Frame Alert</h2> 68 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="GridNavigator.html">Non-frame version</a>.</p> 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/overview-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Hierarchy 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Hierarchy For All Packages

66 |
67 |
68 |

Class Hierarchy

69 | 86 |
87 | 88 |
89 | 90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | &lt;Unnamed&gt; 7 | 8 | 9 | 10 | 11 |

<Unnamed>

12 |
13 |

Classes

14 | 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/package-list: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Hierarchy 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Hierarchy For Package <Unnamed>

66 |
67 |
68 |

Class Hierarchy

69 | 86 |
87 | 88 |
89 | 90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Package 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Package

66 |
67 |
68 |
    69 |
  • 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 80 | 81 | 82 |
    Classes in <Unnamed> used by <Unnamed> 
    Class and Description
    LineTrackSensor 78 |
    handles initialization and reading of color sensor.
    79 |
    83 |
  • 84 |
85 |
86 | 87 |
88 | 89 | 90 | 91 | 92 | 101 |
102 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/resources/background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/doc/resources/background.gif -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/resources/tab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/doc/resources/tab.gif -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/resources/titlebar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/doc/resources/titlebar.gif -------------------------------------------------------------------------------- /Project5.1-FinalRobot/doc/resources/titlebar_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/Project5.1-FinalRobot/doc/resources/titlebar_end.gif -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/GridNavigator.java: -------------------------------------------------------------------------------- 1 | import java.awt.Point; 2 | import java.io.IOException; 3 | import java.util.ArrayList; 4 | 5 | import lejos.hardware.port.SensorPort; 6 | 7 | public class GridNavigator { 8 | 9 | private LineTracker lineTracker; 10 | private int x, y; 11 | private Pose pose; 12 | private ObjectSensor objSensor; 13 | private ArrayList obstacles; 14 | 15 | GridNavigator() { 16 | objSensor = new ObjectSensor(SensorPort.S4); 17 | lineTracker = new LineTracker(objSensor); 18 | obstacles = new ArrayList(); 19 | x = 0; 20 | y = 0; 21 | pose = Pose.N; 22 | } 23 | 24 | public void calibrate() { 25 | lineTracker.calibrate(); 26 | } 27 | 28 | public int getX() { 29 | return x; 30 | } 31 | 32 | public int getY() { 33 | return y; 34 | } 35 | 36 | private void addObstacleToMessage(Point p) { 37 | obstacles.add(p); 38 | } 39 | 40 | /** 41 | * tells the robot to navigate to a location 42 | * 43 | * @param x 44 | * The x location on the map to travel to (1-9) 45 | * @param y 46 | * The y location on the map to travel to (1-5) 47 | * @return Either the OccupancyUpdate.SUCCESS object or one containing 48 | * information on the obstacle that was found. 49 | * @throws IOException 50 | * 51 | */ 52 | public OccupancyUpdate navigateTo(int x, int y) throws IOException { 53 | LineTracker.lcd.clear(); 54 | LineTracker.lcd.drawString("Navigating to " + x + "," + y, 0, 0); 55 | if (!attemptNavigateToX(x) || !attemptNavigateToY(y)) { 56 | Point blockedPoint = getPointInFrontOfMe(); 57 | addObstacleToMessage(blockedPoint); 58 | sendData(); 59 | return new OccupancyUpdate(false, blockedPoint); 60 | } 61 | return OccupancyUpdate.SUCCESS; 62 | } 63 | 64 | /** 65 | * send x and y position to computer 66 | * 67 | * @throws IOException 68 | */ 69 | private void sendData() throws IOException { 70 | new Message(false, x, y, obstacles).send(); 71 | } 72 | 73 | private void face(Pose p) { 74 | while (pose != p) { 75 | if (p.leftOf(pose)) { 76 | lineTracker.turnLeft(); 77 | pose = pose.getLeft(); 78 | } else { 79 | lineTracker.turnRight(); 80 | pose = pose.getRight(); 81 | } 82 | } 83 | } 84 | 85 | private boolean attemptNavigateToX(int x) throws IOException { 86 | int dx = 0; 87 | if (x > this.x) { 88 | face(Pose.E); 89 | dx = 1; 90 | } else if (x < this.x) { 91 | face(Pose.W); 92 | dx = -1; 93 | } 94 | 95 | while (Math.abs(this.x - x) > 0) { 96 | if (!attemptPath()) { 97 | return false; 98 | } else { 99 | this.x += dx; 100 | sendData(); 101 | } 102 | } 103 | return true; 104 | } 105 | 106 | private boolean attemptNavigateToY(int y) throws IOException { 107 | int dy = 0; 108 | if (y > this.y) { 109 | face(Pose.N); 110 | dy = 1; 111 | } else if (y < this.y) { 112 | face(Pose.S); 113 | dy = -1; 114 | } 115 | 116 | while (Math.abs(this.y - y) > 0) { 117 | if (!attemptPath()) { 118 | return false; 119 | } else { 120 | this.y += dy; 121 | sendData(); 122 | } 123 | } 124 | 125 | return true; 126 | } 127 | 128 | private boolean attemptPath() { 129 | boolean completedPath = lineTracker.investigatePath(); 130 | if (completedPath) { 131 | lineTracker.driveOverCross(); 132 | } else { 133 | lineTracker.reverseInvestigatePath(); 134 | } 135 | return completedPath; 136 | } 137 | 138 | private Point getPointInFrontOfMe() { 139 | Point p; 140 | if (pose == Pose.N) { 141 | p = new Point(x, y + 1); 142 | } else if (pose == Pose.S) { 143 | p = new Point(x, y - 1); 144 | } else if (pose == Pose.E) { 145 | p = new Point(x + 1, y); 146 | } else { 147 | p = new Point(x - 1, y); 148 | } 149 | return p; 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/LineTrackSensor.java: -------------------------------------------------------------------------------- 1 | import lejos.hardware.motor.NXTMotor; 2 | import lejos.hardware.port.Port; 3 | import lejos.hardware.sensor.EV3ColorSensor; 4 | import lejos.robotics.SampleProvider; 5 | 6 | /** 7 | * handles initialization and reading of color sensor. Uses the color sensor in 8 | * RGB mode and sums up the RGB values coming from the sensor. This allows for 9 | * proportional line tracking. 10 | * 11 | * @author peter 12 | * 13 | */ 14 | public class LineTrackSensor { 15 | 16 | private static float BLACK_THREASHOLD = 0.3f, WHITE_THREASHOLD = 0.7f; 17 | 18 | private EV3ColorSensor sensor; 19 | private SampleProvider sampleProvider; 20 | private float[] samples; 21 | private float max = 0, min = Float.MAX_VALUE; 22 | 23 | /** 24 | * intialize the color sensor in RGB mode, and create the sample provider 25 | * 26 | * @param sensorPort 27 | * The port of the sensor, like SensorPort.S4 28 | */ 29 | public LineTrackSensor(Port sensorPort) { 30 | sensor = new EV3ColorSensor(sensorPort); 31 | sampleProvider = sensor.getRGBMode(); 32 | samples = new float[sampleProvider.sampleSize()]; 33 | } 34 | 35 | /** 36 | * 37 | * @return the normalized sensor value. the return is capped between -1 and 38 | * 1 39 | */ 40 | public float getValue() { 41 | float val = 2 * (readIntensity() - min) / (max - min) - 1; 42 | val = val < -1 ? -1 : val > 1 ? 1 : val; 43 | return val; 44 | } 45 | 46 | /** 47 | * 48 | * @return returns true if the color sensor is less than 30% towards white 49 | */ 50 | public boolean onCross() { 51 | return getValue() < BLACK_THREASHOLD; 52 | } 53 | 54 | /** 55 | * 56 | * @return returns true if the color sensor is over a 70% towards white 57 | */ 58 | public boolean offCross() { 59 | return getValue() > WHITE_THREASHOLD; 60 | } 61 | 62 | /** 63 | * Calibrates the line sensor on the same side as the given motor object 64 | * 65 | * @param motor 66 | * The motor which is one the side of the sensor you want to 67 | * calibrate 68 | */ 69 | public void calibrate(NXTMotor motor) { 70 | motor.setPower(LineTracker.moveSpeed); 71 | motor.forward(); 72 | int t0 = motor.getTachoCount(); 73 | while (Math.abs(motor.getTachoCount() - t0) < 120) { 74 | float intensity = readIntensity(); 75 | compareToMin(intensity); 76 | compareToMax(intensity); 77 | } 78 | motor.backward(); 79 | t0 = motor.getTachoCount(); 80 | while (Math.abs(motor.getTachoCount() - t0) < 120) { 81 | } 82 | motor.stop(); 83 | } 84 | 85 | private void compareToMin(float n) { 86 | min = n < min ? n : min; 87 | } 88 | 89 | private void compareToMax(float n) { 90 | max = n > max ? n : max; 91 | } 92 | 93 | private float readIntensity() { 94 | float intensity = 0; 95 | 96 | sampleProvider.fetchSample(samples, 0); 97 | 98 | for (int i = 0; i < sampleProvider.sampleSize(); i++) { 99 | intensity += samples[i]; 100 | } 101 | 102 | return intensity; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/LineTracker.java: -------------------------------------------------------------------------------- 1 | import lejos.hardware.Audio; 2 | import lejos.hardware.BrickFinder; 3 | import lejos.hardware.Keys; 4 | import lejos.hardware.ev3.EV3; 5 | import lejos.hardware.lcd.TextLCD; 6 | import lejos.hardware.motor.NXTMotor; 7 | import lejos.hardware.port.MotorPort; 8 | import lejos.hardware.port.SensorPort; 9 | 10 | /** 11 | * this class runs the line tracking is a child to the grid navigation. It 12 | * follows lines and alerts the higher up controls of obstacles. 13 | * 14 | * @author peter 15 | * 16 | */ 17 | public class LineTracker { 18 | 19 | /** 20 | * general speed of motions. This controls line tracking speed, turn speed, 21 | * and scan speed. it is currently 40% of max power. 22 | */ 23 | public static final int moveSpeed = 40; 24 | 25 | private static final EV3 ev3 = (EV3) BrickFinder.getLocal(); 26 | public static final TextLCD lcd = ev3.getTextLCD(); 27 | public static final Audio audio = ev3.getAudio(); 28 | public static final Keys keys = ev3.getKeys(); 29 | 30 | private LineTrackSensor leftSensor, rightSensor; 31 | private MyPilot pilot; 32 | private ObjectSensor objSensor; 33 | 34 | /** 35 | * Initializes the two motors, which are then passed to the MyPilot object 36 | * 37 | * @param objSensor 38 | * An object sensor, which is used in determining when to stop 39 | * turning 40 | */ 41 | LineTracker(ObjectSensor objSensor) { 42 | this.objSensor = objSensor; 43 | NXTMotor leftDrive = new NXTMotor(MotorPort.B); 44 | NXTMotor rightDrive = new NXTMotor(MotorPort.C); 45 | leftSensor = new LineTrackSensor(SensorPort.S2); 46 | rightSensor = new LineTrackSensor(SensorPort.S3); 47 | pilot = new MyPilot(leftDrive, rightDrive); 48 | } 49 | 50 | /** 51 | * instructs the robot to follow the line it's on until it reaches a 52 | * 'cross', or finds an obstacle in it's way. 53 | */ 54 | public boolean investigatePath() { 55 | while (!onCross()) { 56 | if (!trackClearPath(false)) { 57 | pilot.stop(); 58 | return false; 59 | } 60 | } 61 | pilot.stop(); 62 | return true; 63 | } 64 | 65 | /** 66 | * instructs the robot to follow the line in reverse it's on until it reaches a 67 | * 'cross' 68 | */ 69 | public boolean reverseInvestigatePath() { 70 | while (!onCross()) { 71 | if (!trackClearPath(true)) { 72 | pilot.stop(); 73 | return false; 74 | } 75 | } 76 | pilot.stop(); 77 | return true; 78 | } 79 | 80 | /** 81 | * instructs the robot to drive until neither sensor is on the line, which 82 | * results in the robot driving forward off the cross 83 | */ 84 | public void driveOverCross() { 85 | while (!offCross()) { 86 | pilot.drive(moveSpeed, moveSpeed); 87 | } 88 | pilot.stop(); 89 | } 90 | 91 | /** 92 | * instructs thr robot to calibrate the left and right sensors by calling 93 | * the calibrate method of the MyPilot class given the left and right sensor 94 | * objects 95 | */ 96 | public void calibrate() { 97 | pilot.calibrate(leftSensor, rightSensor); 98 | } 99 | 100 | /** 101 | * turn right 102 | */ 103 | public void turnRight() { 104 | while (!rightSensor.onCross()) { 105 | pilot.drive(moveSpeed, -moveSpeed); 106 | } 107 | 108 | while (!rightSensor.offCross()) { 109 | pilot.drive(moveSpeed, -moveSpeed); 110 | } 111 | } 112 | 113 | /** 114 | * turn left 115 | */ 116 | public void turnLeft() { 117 | while (!leftSensor.onCross()) { 118 | pilot.drive(-moveSpeed, moveSpeed); 119 | } 120 | 121 | while (!leftSensor.offCross()) { 122 | pilot.drive(-moveSpeed, moveSpeed); 123 | } 124 | } 125 | 126 | private boolean onCross() { 127 | return leftSensor.onCross() && rightSensor.onCross(); 128 | } 129 | 130 | private boolean offCross() { 131 | return leftSensor.offCross() || rightSensor.offCross(); 132 | } 133 | 134 | private boolean trackClearPath(boolean reverse) { 135 | int leftSpeed = (int) (leftSensor.getValue() * moveSpeed); 136 | int rightSpeed = (int) (rightSensor.getValue() * moveSpeed); 137 | if (reverse) { 138 | pilot.drive(-leftSpeed, -rightSpeed); 139 | return true; 140 | } else { 141 | pilot.drive(leftSpeed, rightSpeed); 142 | return objSensor.pathClear(); 143 | } 144 | 145 | } 146 | } -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/MainRobot.java: -------------------------------------------------------------------------------- 1 | import java.awt.Point; 2 | import java.io.DataInputStream; 3 | import java.io.DataOutputStream; 4 | import java.io.IOException; 5 | import java.net.Socket; 6 | import java.util.ArrayList; 7 | 8 | /** 9 | * This is the move abstract/overall class. It contains both a Pathfinder 10 | * object, a GridNavigator object, and the Socket connection to the computer 11 | * 12 | * @author peter 13 | * 14 | */ 15 | public class MainRobot { 16 | 17 | private GridNavigator bob; 18 | private Socket socket; 19 | private DataInputStream in; 20 | private Pathfinder pfinder; 21 | 22 | /** 23 | * creates the pathfinder, and a socket. The socket connects to 10.0.1.12 on 24 | * port 1234. It also gets the DataInputStream and DataOutputStream, and 25 | * passes the DataOuput stream to the Message class. This prevents any use 26 | * of the DataOutput stream that isn't of the format specified by the 27 | * Message class 28 | * 29 | */ 30 | MainRobot() { 31 | pfinder = new Pathfinder(9, 5); 32 | 33 | try { 34 | socket = new Socket("10.0.1.12", 1234); 35 | Message.out = new DataOutputStream(socket.getOutputStream()); 36 | in = new DataInputStream(socket.getInputStream()); 37 | 38 | } catch (IOException e) { 39 | LineTracker.lcd.drawString("ERROR " + e.getMessage(), 0, 5); 40 | LineTracker.keys.waitForAnyPress(); 41 | } 42 | 43 | bob = new GridNavigator(); 44 | bob.calibrate(); 45 | } 46 | 47 | /** 48 | * The main loop of the program. It is an infinite loop that reads a x and y 49 | * position from the DataInputStream, then navigates to that point, then 50 | * sends an update to the computer, and repeats 51 | * 52 | * @throws IOException 53 | */ 54 | public void run() throws IOException { 55 | while (true) { 56 | int x = in.readInt(); 57 | int y = in.readInt(); 58 | navigateTo(x, y); 59 | // tell GUI it's reach destination 60 | new Message(true, bob.getX(), bob.getY(), new ArrayList()) 61 | .send(); 62 | } 63 | } 64 | 65 | /** 66 | * 67 | * @param x 68 | * The x position the robot should travel to 69 | * @param y 70 | * The y position the robot should travel to 71 | * @throws IOException 72 | * If the DataOutputStream is screwed up it will throw 73 | * IOException 74 | */ 75 | private void navigateTo(int x, int y) throws IOException { 76 | for (Node n : pfinder.getPath(bob.getX(), bob.getY(), x, y)) { 77 | OccupancyUpdate update = bob.navigateTo(n.x, n.y); 78 | if (!update.pathClear) { 79 | pfinder.addObject(update.x, update.y); 80 | navigateTo(x, y); 81 | return; 82 | } 83 | } 84 | } 85 | 86 | public static void main(String[] args) throws IOException { 87 | new MainRobot().run(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/Message.java: -------------------------------------------------------------------------------- 1 | import java.awt.Point; 2 | import java.io.DataOutputStream; 3 | import java.io.IOException; 4 | import java.util.ArrayList; 5 | 6 | /** 7 | * The class defines the content of messages being sent to the computer from the 8 | * robot since only this class has access to the DataOutputStream, only 9 | * instances of this class can send data to the computer. This ensures that all 10 | * data is sent in a predictable and consistent format. 11 | * 12 | * @author peter 13 | * 14 | */ 15 | public class Message { 16 | 17 | public static DataOutputStream out; 18 | private boolean done; 19 | private int x, y, l; 20 | private ArrayList obstacles; 21 | 22 | /** 23 | * 24 | * @param done 25 | * Tells the computer if the robot has reached its position. 26 | * Sending this will cause the computer application to stop 27 | * listening for position updates, and be again ready to send a 28 | * new position command 29 | * @param x 30 | * The current x position of the robot 31 | * @param y 32 | * The current Y position of the robot 33 | * @param obstacles 34 | * A list of Point objects listing any newly found obstacles. 35 | * These will be added to the pathfinder's grid so that they can 36 | * be planned around in future navigations 37 | */ 38 | Message(boolean done, int x, int y, ArrayList obstacles) { 39 | this.done = done; 40 | this.x = x; 41 | this.y = y; 42 | this.l = obstacles.size(); 43 | this.obstacles = obstacles; 44 | } 45 | 46 | /** 47 | * send the constructed message to the computer via bluetooth connection 48 | * 49 | * @throws IOException 50 | * This will error out if the DataOuputStream given to the 51 | * message is no longer valid. 52 | */ 53 | public void send() throws IOException { 54 | out.writeBoolean(done); 55 | out.writeInt(x); 56 | out.writeInt(y); 57 | out.writeInt(l); 58 | for (int i = 0; i < l; i++) { 59 | out.writeInt(obstacles.get(i).x); 60 | out.writeInt(obstacles.get(i).y); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/MyPilot.java: -------------------------------------------------------------------------------- 1 | import lejos.hardware.motor.NXTMotor; 2 | 3 | /** 4 | * this class controls the motion of the robot drive train. this is the only 5 | * class whose methods have access to the motors, so all motion in the wheels is 6 | * guaranteed to come from here. Even with EV3 motors, the NXTMotor class is 7 | * used because the EV3 regulated motors have unpredictable behavior. The 8 | * limitation is that tachometer count cannot be reset. 9 | * 10 | * @author peter 11 | * 12 | */ 13 | public class MyPilot { 14 | 15 | private NXTMotor leftDrive, rightDrive; 16 | private static final int checkAngle = 40; 17 | 18 | /** 19 | * instantiate the pilot given the two motors 20 | * 21 | * @param leftDrive 22 | * the left NXTMotor object 23 | * @param rightDrive 24 | * the right NXTMotor object 25 | */ 26 | MyPilot(NXTMotor leftDrive, NXTMotor rightDrive) { 27 | this.leftDrive = leftDrive; 28 | this.rightDrive = rightDrive; 29 | } 30 | 31 | /** 32 | * calibrates each line sensor. calls the calibrate method of each sensor 33 | * given the corresponding motor. 34 | * 35 | * @param leftSensor 36 | * the left LineTrackSensor object 37 | * @param rightSensor 38 | * the right LineTrackSensor object 39 | */ 40 | public void calibrate(LineTrackSensor leftSensor, 41 | LineTrackSensor rightSensor) { 42 | leftSensor.calibrate(leftDrive); 43 | rightSensor.calibrate(rightDrive); 44 | } 45 | 46 | // 47 | // public void settle() { 48 | // long t0 = System.currentTimeMillis(); 49 | // while (System.currentTimeMillis() - t0 < 300) { 50 | // stop(); 51 | // } 52 | // } 53 | // 54 | // public void driveExtra() { 55 | // int t0 = leftDrive.getTachoCount(); 56 | // while (leftDrive.getTachoCount() - t0 < 25) { 57 | // drive(LineTracker.moveSpeed, LineTracker.moveSpeed); 58 | // } 59 | // } 60 | 61 | /** 62 | * determines if the next intersection has an obstacle. 63 | * 64 | * @param objSensor 65 | * the ObjectSensor object 66 | * @return returns true if there is nothing in the way. 67 | */ 68 | 69 | public boolean pathClearAfterTurn(ObjectSensor objSensor) { 70 | boolean pathClear = true; 71 | int t0 = leftDrive.getTachoCount(); 72 | while (Math.abs(leftDrive.getTachoCount() - t0) < checkAngle) { 73 | drive(-LineTracker.moveSpeed / 2, LineTracker.moveSpeed / 2); 74 | pathClear = pathClear && objSensor.pathClear(); 75 | } 76 | t0 = leftDrive.getTachoCount(); 77 | while (Math.abs(leftDrive.getTachoCount() - t0) < 2 * checkAngle) { 78 | drive(LineTracker.moveSpeed / 2, -LineTracker.moveSpeed / 2); 79 | pathClear = pathClear && objSensor.pathClear(); 80 | } 81 | t0 = leftDrive.getTachoCount(); 82 | while (Math.abs(leftDrive.getTachoCount() - t0) < checkAngle) { 83 | drive(-LineTracker.moveSpeed / 2, LineTracker.moveSpeed / 2); 84 | pathClear = pathClear && objSensor.pathClear(); 85 | } 86 | return pathClear; 87 | } 88 | 89 | /** 90 | * stop the robot 91 | */ 92 | public void stop() { 93 | leftDrive.stop(); 94 | rightDrive.stop(); 95 | } 96 | 97 | /** 98 | * drive the robot at a given speed 99 | * 100 | * @param leftSpeed 101 | * drive left motor at this speed (0-100) 102 | * @param rightSpeed 103 | * drive right motor at this speed (0-100) 104 | */ 105 | public void drive(int leftSpeed, int rightSpeed) { 106 | setSpeed(leftSpeed, rightSpeed); 107 | leftDrive.forward(); 108 | rightDrive.forward(); 109 | } 110 | 111 | private void setSpeed(int ls, int rs) { 112 | leftDrive.setPower(ls); 113 | rightDrive.setPower(rs); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/Node.java: -------------------------------------------------------------------------------- 1 | /** 2 | * A Node is a position on the map as used by the pathfinder class. 3 | * 4 | * @author peter 5 | * 6 | * 7 | */ 8 | public class Node { 9 | 10 | /** x location of Node in grid */ 11 | public int x; 12 | 13 | /** y location of Node in grid */ 14 | public int y; 15 | 16 | /** distance between node and start location */ 17 | public int distance; 18 | 19 | /** 20 | * cost to move to this node. This is 1 for any unoccupied node, and 21 | * {@link Pathfinder#INFINITY} for occupied node 22 | */ 23 | public int weight; 24 | 25 | /** boolean to mark node as visited */ 26 | public boolean visited; 27 | 28 | /** 29 | * creates a new node at that position. The node is given a distance of 30 | * {@link Pathfinder#INFINITY} and weight of 1. it is intialized as not 31 | * visited. 32 | * 33 | * @param x the x position of the new new 34 | * @param y the y position of the new new 35 | * */ 36 | public Node(int x, int y) { 37 | this.x = x; 38 | this.y = y; 39 | this.distance = Pathfinder.INFINITY; 40 | this.weight = 1; 41 | this.visited = false; 42 | } 43 | 44 | /** returns the location of the node in the form x,y 45 | * 46 | * */ 47 | public String toString() { 48 | return x + "," + y; 49 | } 50 | } -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/ObjectSensor.java: -------------------------------------------------------------------------------- 1 | import lejos.hardware.port.Port; 2 | import lejos.hardware.sensor.EV3UltrasonicSensor; 3 | import lejos.robotics.SampleProvider; 4 | 5 | /** 6 | * Controls the ultrasonic sensor. 7 | * 8 | * @author peter 9 | * 10 | */ 11 | public class ObjectSensor { 12 | 13 | private EV3UltrasonicSensor sensor; 14 | private SampleProvider sampleProvider; 15 | private float[] sample; 16 | private static final float PATH_CLEAR_THREASHOLD = 0.15f; 17 | 18 | /** 19 | * 20 | * @param sensorPort 21 | * initialize the sensor in DistanceMode and the sample provider 22 | * mode 23 | */ 24 | public ObjectSensor(Port sensorPort) { 25 | sensor = new EV3UltrasonicSensor(sensorPort); 26 | sampleProvider = sensor.getDistanceMode(); 27 | sample = new float[sampleProvider.sampleSize()]; 28 | } 29 | 30 | /** 31 | * 32 | * @return returns true if the path is clear 33 | */ 34 | public boolean pathClear() { 35 | sampleProvider.fetchSample(sample, 0); 36 | boolean pathClear = sample[0] > PATH_CLEAR_THREASHOLD; 37 | if (!pathClear) { 38 | LineTracker.audio.playTone(600, 50); 39 | } 40 | return pathClear; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/OccupancyUpdate.java: -------------------------------------------------------------------------------- 1 | import java.awt.Point; 2 | 3 | /** 4 | * object containing data about the success of a move. This is what 5 | * {@link GridNavigator#navigateTo(int, int)} method returns 6 | * 7 | * @author peter 8 | * 9 | */ 10 | public class OccupancyUpdate { 11 | 12 | /** this represents a successful completion of a navigation task */ 13 | public static final OccupancyUpdate SUCCESS = new OccupancyUpdate(true, 14 | new Point()); 15 | 16 | /** holds weather or not the next intersection in front of the robot has an obstacle */ 17 | public boolean pathClear; 18 | 19 | /** holds the x and y position at which the obstacle was found */ 20 | public int x, y; 21 | 22 | /** 23 | * 24 | * @param pathClear holds if the intersection in front is clear 25 | * @param p holds the point at which the obstacle is found. This is an empty Point() for {@link OccupancyUpdate#SUCCESS} 26 | */ 27 | OccupancyUpdate(boolean pathClear, Point p) { 28 | this.pathClear = pathClear; 29 | this.x = p.x; 30 | this.y = p.y; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/Pathfinder.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.Collections; 3 | 4 | /** 5 | * Implementation of A* path finding algorithm in a grid 6 | * 7 | * @author peter 8 | * 9 | */ 10 | public class Pathfinder { 11 | 12 | private Node[][] grid; 13 | private ArrayList path; 14 | 15 | /** 16 | * INFINITY is actually 1000, and represents an obstacle in the grid 17 | */ 18 | public static final int INFINITY = 1000; 19 | 20 | /** 21 | * Create the path finder object at a certain width and height 22 | * 23 | * @param worldX 24 | * the X width of the world 25 | * @param worldY 26 | * the Y width of the world 27 | */ 28 | public Pathfinder(int worldX, int worldY) { 29 | path = new ArrayList(); 30 | populateGrid(worldY, worldX); 31 | } 32 | 33 | public void addObject(int x, int y) { 34 | LineTracker.lcd.drawString("object at " + x + "," + y, 0, 2); 35 | grid[y][x].weight = INFINITY; 36 | } 37 | 38 | private void populateGrid(int rows, int cols) { 39 | // rowsi are y 40 | // cols,j are x 41 | grid = new Node[rows][cols]; 42 | for (int i = 0; i < rows; i++) { 43 | for (int j = 0; j < cols; j++) { 44 | grid[i][j] = new Node(j, i); 45 | } 46 | } 47 | } 48 | 49 | public ArrayList getPath(int startX, int startY, int goalX, int goalY) { 50 | resetGrid(); 51 | path.clear(); 52 | 53 | Node u; 54 | grid[startY][startX].distance = 0; 55 | 56 | while (!grid[goalY][goalX].visited) { 57 | u = closestUnvisited(); 58 | u.visited = true; 59 | 60 | updateNeightbor(0, -1, u); 61 | updateNeightbor(0, 1, u); 62 | updateNeightbor(-1, 0, u); 63 | updateNeightbor(1, 0, u); 64 | } 65 | 66 | generatePathFrom(grid[goalY][goalX]); 67 | Collections.reverse(path); 68 | return path; 69 | } 70 | 71 | private void resetGrid() { 72 | for (int i = 0; i < grid.length; i++) { 73 | for (int j = 0; j < grid[0].length; j++) { 74 | grid[i][j].distance = Pathfinder.INFINITY; 75 | grid[i][j].visited = false; 76 | } 77 | } 78 | } 79 | 80 | private void generatePathFrom(Node n) { 81 | path.add(n); 82 | 83 | if (isPrevious(n, n.y - 1, n.x)) { 84 | generatePathFrom(grid[n.y - 1][n.x]); 85 | 86 | } else if (isPrevious(n, n.y + 1, n.x)) { 87 | generatePathFrom(grid[n.y + 1][n.x]); 88 | 89 | } else if (isPrevious(n, n.y, n.x - 1)) { 90 | generatePathFrom(grid[n.y][n.x - 1]); 91 | 92 | } else if (isPrevious(n, n.y, n.x + 1)) { 93 | generatePathFrom(grid[n.y][n.x + 1]); 94 | } 95 | } 96 | 97 | private boolean isPrevious(Node n, int i, int j) { 98 | return inBounds(i, j) && n.distance - 1 == grid[i][j].distance; 99 | } 100 | 101 | private Node closestUnvisited() { 102 | int min = INFINITY; 103 | Node minNode = new Node(-1, -1); 104 | for (int i = 0; i < grid.length; i++) { 105 | for (int j = 0; j < grid[0].length; j++) { 106 | if (!grid[i][j].visited) { 107 | int d = grid[i][j].distance; 108 | if (d < min) { 109 | min = d; 110 | minNode = grid[i][j]; 111 | } 112 | } 113 | } 114 | } 115 | return minNode; 116 | } 117 | 118 | private void updateNeightbor(int dx, int dy, Node u) { 119 | int newx = u.x + dx; 120 | int newy = u.y + dy; 121 | 122 | if (newx >= 0 && newy >= 0) { 123 | if (inBounds(newy, newx)) { 124 | Node n = grid[newy][newx]; 125 | if (!n.visited) { 126 | n.distance = Math.min(n.distance, u.distance + n.weight); 127 | } 128 | } 129 | } 130 | } 131 | 132 | private boolean inBounds(int i, int j) { 133 | return i >= 0 && i < grid.length - 1 && j >= 0 134 | && j < grid[0].length - 1; 135 | } 136 | 137 | private void printGrid() { 138 | // print grid 139 | for (int i = 0; i < grid.length; i++) { 140 | for (int j = 0; j < grid[0].length; j++) { 141 | int d = grid[i][j].distance; 142 | if (d >= Pathfinder.INFINITY) { 143 | LineTracker.lcd.drawChar('X', j, i); 144 | } else { 145 | LineTracker.lcd.drawInt(d, j, i); 146 | } 147 | } 148 | } 149 | LineTracker.keys.waitForAnyPress(); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /Project5.1-FinalRobot/src/Pose.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The pose represents the direcition the robot is facing, either North, South, 3 | * East, or West 4 | * 5 | * @author peter 6 | * 7 | */ 8 | public class Pose { 9 | 10 | public static final Pose N = new Pose(), S = new Pose(), E = new Pose(), 11 | W = new Pose(); 12 | 13 | Pose() { 14 | } 15 | 16 | /** 17 | * Get the pose left of this pose 18 | * @return the pose counter-clockwise to the current pose. For example, North returns West 19 | */ 20 | public Pose getLeft() { 21 | if (this == Pose.N) { 22 | return Pose.W; 23 | } else if (this == Pose.S) { 24 | return Pose.E; 25 | } else if (this == Pose.E) { 26 | return Pose.N; 27 | } 28 | return Pose.S; 29 | } 30 | 31 | /** 32 | * Get the pose right of this pose 33 | * @return the pose clockwise to the current pose. For example, North returns East 34 | */ 35 | public Pose getRight() { 36 | if (this == Pose.N) { 37 | return Pose.E; 38 | } else if (this == Pose.S) { 39 | return Pose.W; 40 | } else if (this == Pose.E) { 41 | return Pose.S; 42 | } 43 | return Pose.N; 44 | } 45 | 46 | /** 47 | * Determines if a pose is to the right of this pose 48 | * 49 | * @param b the pose you want to test 50 | * @return returns true if the pose is to the right, otherwise it returns false 51 | */ 52 | public boolean rightOf(Pose b) { 53 | if (this == Pose.N) { 54 | return b == Pose.W; 55 | } else if (this == Pose.S) { 56 | return b == Pose.E; 57 | } else if (this == Pose.E) { 58 | return b == Pose.N; 59 | } 60 | return b == Pose.S; 61 | } 62 | 63 | /** 64 | * Determines if a pose is to the left of this pose 65 | * 66 | * @param b the pose you want to test 67 | * @return returns true if the pose is to the left, otherwise it returns false 68 | */ 69 | public boolean leftOf(Pose b) { 70 | if (this == Pose.N) { 71 | return b == Pose.E; 72 | } else if (this == Pose.S) { 73 | return b == Pose.W; 74 | } else if (this == Pose.E) { 75 | return b == Pose.S; 76 | } 77 | return b == Pose.N; 78 | } 79 | 80 | /** 81 | * Returns the String version of the pose. For example, Pose.N returns "N" 82 | * 83 | * @return returns the String version of the pose 84 | */ 85 | public String toString() { 86 | if (this == Pose.N) { 87 | return "N"; 88 | } else if (this == Pose.S) { 89 | return "S"; 90 | } else if (this == Pose.E) { 91 | return "E"; 92 | } 93 | return "N"; 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | EV3-Grid-Navigation 2 | =================== 3 | 4 | EV3 project for grid navigation & path planning 5 | 6 | =================== 7 | 8 | EV3 project written with the lejos library. The robot has 2 color sensors and an ultrasonic sensor. 9 | The robot receives commands from the GUI program running on the laptop, and navigates to those points in the shortest path possible, given that the grid contains obstacles. These obstacles are discovered and remebered as the robot navigates. 10 | 11 | A* was used for path planning, with manhattan method for the heuristic component and a weight of 1 for open nodes and 1000 for node with obstacles. 12 | 13 | java socket connection was used for communication between the robot and computer over the bluetooth PAN network 14 | -------------------------------------------------------------------------------- /doc/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 |

All Classes

12 |
13 | 26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /doc/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 |

All Classes

12 |
13 | 26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /doc/class-use/GridNavigator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class GridNavigator 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
GridNavigator

66 |
67 |
No usage of GridNavigator
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/class-use/LineTrackSensor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class LineTrackSensor 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
LineTrackSensor

66 |
67 |
68 | 95 |
96 | 97 |
98 | 99 | 100 | 101 | 102 | 111 |
112 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /doc/class-use/LineTracker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class LineTracker 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
LineTracker

66 |
67 |
No usage of LineTracker
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/class-use/MainRobot.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class MainRobot 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
MainRobot

66 |
67 |
No usage of MainRobot
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/class-use/Message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class Message 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
Message

66 |
67 |
No usage of Message
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/class-use/MyPilot.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class MyPilot 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
MyPilot

66 |
67 |
No usage of MyPilot
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/class-use/Node.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class Node 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
Node

66 |
67 |
68 |
    69 |
  • 70 |
      71 |
    • 72 | 73 | 74 |

      Uses of Node in <Unnamed>

      75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 88 | 89 | 90 |
      Methods in <Unnamed> that return types with arguments of type Node 
      Modifier and TypeMethod and Description
      java.util.ArrayList<Node>Pathfinder.getPath(int startX, 85 | int startY, 86 | int goalX, 87 | int goalY) 
      91 |
    • 92 |
    93 |
  • 94 |
95 |
96 | 97 |
98 | 99 | 100 | 101 | 102 | 111 |
112 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /doc/class-use/ObjectSensor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class ObjectSensor 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
ObjectSensor

66 |
67 |
68 | 94 |
95 | 96 |
97 | 98 | 99 | 100 | 101 | 110 |
111 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /doc/class-use/Pathfinder.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class Pathfinder 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
Pathfinder

66 |
67 |
No usage of Pathfinder
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deprecated List 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Deprecated API

66 |

Contents

67 |
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/index-files/index-16.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | V-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
A C D E G I K L M N O P R S T V W X Y  65 | 66 | 67 |

V

68 |
69 |
visited - Variable in class Node
70 |
71 |
boolean to mark node as visited
72 |
73 |
74 | A C D E G I K L M N O P R S T V W X Y 
75 | 76 |
77 | 78 | 79 | 80 | 81 | 90 |
91 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /doc/index-files/index-4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | E-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
A C D E G I K L M N O P R S T V W X Y  65 | 66 | 67 |

E

68 |
69 |
E - Static variable in class Pose
70 |
 
71 |
72 | A C D E G I K L M N O P R S T V W X Y 
73 | 74 |
75 | 76 | 77 | 78 | 79 | 88 |
89 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /doc/index-files/index-7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | K-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
A C D E G I K L M N O P R S T V W X Y  65 | 66 | 67 |

K

68 |
69 |
keys - Static variable in class LineTracker
70 |
 
71 |
72 | A C D E G I K L M N O P R S T V W X Y 
73 | 74 |
75 | 76 | 77 | 78 | 79 | 88 |
89 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Generated Documentation (Untitled) 7 | 59 | 60 | 61 | 62 | 63 | 64 | <noscript> 65 | <div>JavaScript is disabled on your browser.</div> 66 | </noscript> 67 | <h2>Frame Alert</h2> 68 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="GridNavigator.html">Non-frame version</a>.</p> 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /doc/overview-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Hierarchy 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Hierarchy For All Packages

66 |
67 |
68 |

Class Hierarchy

69 | 86 |
87 | 88 |
89 | 90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | &lt;Unnamed&gt; 7 | 8 | 9 | 10 | 11 |

<Unnamed>

12 |
13 |

Classes

14 | 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/package-list: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /doc/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Hierarchy 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Hierarchy For Package <Unnamed>

66 |
67 |
68 |

Class Hierarchy

69 | 86 |
87 | 88 |
89 | 90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Package 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Package

66 |
67 |
68 |
    69 |
  • 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 80 | 81 | 82 |
    Classes in <Unnamed> used by <Unnamed> 
    Class and Description
    LineTrackSensor 78 |
    handles initialization and reading of color sensor.
    79 |
    83 |
  • 84 |
85 |
86 | 87 |
88 | 89 | 90 | 91 | 92 | 101 |
102 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /doc/resources/background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/doc/resources/background.gif -------------------------------------------------------------------------------- /doc/resources/tab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/doc/resources/tab.gif -------------------------------------------------------------------------------- /doc/resources/titlebar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/doc/resources/titlebar.gif -------------------------------------------------------------------------------- /doc/resources/titlebar_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PeterMitrano/EV3-Grid-Navigation/64d0e509ba6eafb818ef5e235b0489a50c0ee5c9/doc/resources/titlebar_end.gif -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ev3-grid-navigation by PeterMitrano 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |
17 |
18 |

Ev3-grid-navigation

19 |

EV3 project for grid navigation & path planning

20 | 21 |

View the Project on GitHub PeterMitrano/EV3-Grid-Navigation

22 | 23 | 24 | 29 |
30 |
31 |

32 | EV3 Grid Navigation

33 | 34 |

This is a project I worked on at WPI as an independant study project to replace the Object Oriented Programming course. I combined A* path finding, line following, and socket communication into one EV3 robotics project

35 | 36 | 37 | 38 |

Having trouble with Pages? Check out the documentation at http://help.github.com/pages or contact support@github.com and we’ll help you sort it out.

39 |
40 | 44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /javascripts/scale.fix.js: -------------------------------------------------------------------------------- 1 | var metas = document.getElementsByTagName('meta'); 2 | var i; 3 | if (navigator.userAgent.match(/iPhone/i)) { 4 | for (i=0; i` element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out the documentation at http://help.github.com/pages or contact support@github.com and we’ll help you sort it out.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} -------------------------------------------------------------------------------- /stylesheets/pygment_trac.css: -------------------------------------------------------------------------------- 1 | .highlight { background: #ffffff; } 2 | .highlight .c { color: #999988; font-style: italic } /* Comment */ 3 | .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ 4 | .highlight .k { font-weight: bold } /* Keyword */ 5 | .highlight .o { font-weight: bold } /* Operator */ 6 | .highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */ 7 | .highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */ 8 | .highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */ 9 | .highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ 10 | .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ 11 | .highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */ 12 | .highlight .ge { font-style: italic } /* Generic.Emph */ 13 | .highlight .gr { color: #aa0000 } /* Generic.Error */ 14 | .highlight .gh { color: #999999 } /* Generic.Heading */ 15 | .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ 16 | .highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */ 17 | .highlight .go { color: #888888 } /* Generic.Output */ 18 | .highlight .gp { color: #555555 } /* Generic.Prompt */ 19 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 20 | .highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */ 21 | .highlight .gt { color: #aa0000 } /* Generic.Traceback */ 22 | .highlight .kc { font-weight: bold } /* Keyword.Constant */ 23 | .highlight .kd { font-weight: bold } /* Keyword.Declaration */ 24 | .highlight .kn { font-weight: bold } /* Keyword.Namespace */ 25 | .highlight .kp { font-weight: bold } /* Keyword.Pseudo */ 26 | .highlight .kr { font-weight: bold } /* Keyword.Reserved */ 27 | .highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */ 28 | .highlight .m { color: #009999 } /* Literal.Number */ 29 | .highlight .s { color: #d14 } /* Literal.String */ 30 | .highlight .na { color: #008080 } /* Name.Attribute */ 31 | .highlight .nb { color: #0086B3 } /* Name.Builtin */ 32 | .highlight .nc { color: #445588; font-weight: bold } /* Name.Class */ 33 | .highlight .no { color: #008080 } /* Name.Constant */ 34 | .highlight .ni { color: #800080 } /* Name.Entity */ 35 | .highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */ 36 | .highlight .nf { color: #990000; font-weight: bold } /* Name.Function */ 37 | .highlight .nn { color: #555555 } /* Name.Namespace */ 38 | .highlight .nt { color: #000080 } /* Name.Tag */ 39 | .highlight .nv { color: #008080 } /* Name.Variable */ 40 | .highlight .ow { font-weight: bold } /* Operator.Word */ 41 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 42 | .highlight .mf { color: #009999 } /* Literal.Number.Float */ 43 | .highlight .mh { color: #009999 } /* Literal.Number.Hex */ 44 | .highlight .mi { color: #009999 } /* Literal.Number.Integer */ 45 | .highlight .mo { color: #009999 } /* Literal.Number.Oct */ 46 | .highlight .sb { color: #d14 } /* Literal.String.Backtick */ 47 | .highlight .sc { color: #d14 } /* Literal.String.Char */ 48 | .highlight .sd { color: #d14 } /* Literal.String.Doc */ 49 | .highlight .s2 { color: #d14 } /* Literal.String.Double */ 50 | .highlight .se { color: #d14 } /* Literal.String.Escape */ 51 | .highlight .sh { color: #d14 } /* Literal.String.Heredoc */ 52 | .highlight .si { color: #d14 } /* Literal.String.Interpol */ 53 | .highlight .sx { color: #d14 } /* Literal.String.Other */ 54 | .highlight .sr { color: #009926 } /* Literal.String.Regex */ 55 | .highlight .s1 { color: #d14 } /* Literal.String.Single */ 56 | .highlight .ss { color: #990073 } /* Literal.String.Symbol */ 57 | .highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */ 58 | .highlight .vc { color: #008080 } /* Name.Variable.Class */ 59 | .highlight .vg { color: #008080 } /* Name.Variable.Global */ 60 | .highlight .vi { color: #008080 } /* Name.Variable.Instance */ 61 | .highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ 62 | 63 | .type-csharp .highlight .k { color: #0000FF } 64 | .type-csharp .highlight .kt { color: #0000FF } 65 | .type-csharp .highlight .nf { color: #000000; font-weight: normal } 66 | .type-csharp .highlight .nc { color: #2B91AF } 67 | .type-csharp .highlight .nn { color: #000000 } 68 | .type-csharp .highlight .s { color: #A31515 } 69 | .type-csharp .highlight .sc { color: #A31515 } 70 | -------------------------------------------------------------------------------- /stylesheets/styles.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700); 2 | 3 | body { 4 | padding:50px; 5 | font:14px/1.5 Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; 6 | color:#777; 7 | font-weight:300; 8 | } 9 | 10 | h1, h2, h3, h4, h5, h6 { 11 | color:#222; 12 | margin:0 0 20px; 13 | } 14 | 15 | p, ul, ol, table, pre, dl { 16 | margin:0 0 20px; 17 | } 18 | 19 | h1, h2, h3 { 20 | line-height:1.1; 21 | } 22 | 23 | h1 { 24 | font-size:28px; 25 | } 26 | 27 | h2 { 28 | color:#393939; 29 | } 30 | 31 | h3, h4, h5, h6 { 32 | color:#494949; 33 | } 34 | 35 | a { 36 | color:#39c; 37 | font-weight:400; 38 | text-decoration:none; 39 | } 40 | 41 | a small { 42 | font-size:11px; 43 | color:#777; 44 | margin-top:-0.6em; 45 | display:block; 46 | } 47 | 48 | .wrapper { 49 | width:860px; 50 | margin:0 auto; 51 | } 52 | 53 | blockquote { 54 | border-left:1px solid #e5e5e5; 55 | margin:0; 56 | padding:0 0 0 20px; 57 | font-style:italic; 58 | } 59 | 60 | code, pre { 61 | font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; 62 | color:#333; 63 | font-size:12px; 64 | } 65 | 66 | pre { 67 | padding:8px 15px; 68 | background: #f8f8f8; 69 | border-radius:5px; 70 | border:1px solid #e5e5e5; 71 | overflow-x: auto; 72 | } 73 | 74 | table { 75 | width:100%; 76 | border-collapse:collapse; 77 | } 78 | 79 | th, td { 80 | text-align:left; 81 | padding:5px 10px; 82 | border-bottom:1px solid #e5e5e5; 83 | } 84 | 85 | dt { 86 | color:#444; 87 | font-weight:700; 88 | } 89 | 90 | th { 91 | color:#444; 92 | } 93 | 94 | img { 95 | max-width:100%; 96 | } 97 | 98 | header { 99 | width:270px; 100 | float:left; 101 | position:fixed; 102 | } 103 | 104 | header ul { 105 | list-style:none; 106 | height:40px; 107 | 108 | padding:0; 109 | 110 | background: #eee; 111 | background: -moz-linear-gradient(top, #f8f8f8 0%, #dddddd 100%); 112 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd)); 113 | background: -webkit-linear-gradient(top, #f8f8f8 0%,#dddddd 100%); 114 | background: -o-linear-gradient(top, #f8f8f8 0%,#dddddd 100%); 115 | background: -ms-linear-gradient(top, #f8f8f8 0%,#dddddd 100%); 116 | background: linear-gradient(top, #f8f8f8 0%,#dddddd 100%); 117 | 118 | border-radius:5px; 119 | border:1px solid #d2d2d2; 120 | box-shadow:inset #fff 0 1px 0, inset rgba(0,0,0,0.03) 0 -1px 0; 121 | width:270px; 122 | } 123 | 124 | header li { 125 | width:89px; 126 | float:left; 127 | border-right:1px solid #d2d2d2; 128 | height:40px; 129 | } 130 | 131 | header ul a { 132 | line-height:1; 133 | font-size:11px; 134 | color:#999; 135 | display:block; 136 | text-align:center; 137 | padding-top:6px; 138 | height:40px; 139 | } 140 | 141 | strong { 142 | color:#222; 143 | font-weight:700; 144 | } 145 | 146 | header ul li + li { 147 | width:88px; 148 | border-left:1px solid #fff; 149 | } 150 | 151 | header ul li + li + li { 152 | border-right:none; 153 | width:89px; 154 | } 155 | 156 | header ul a strong { 157 | font-size:14px; 158 | display:block; 159 | color:#222; 160 | } 161 | 162 | section { 163 | width:500px; 164 | float:right; 165 | padding-bottom:50px; 166 | } 167 | 168 | small { 169 | font-size:11px; 170 | } 171 | 172 | hr { 173 | border:0; 174 | background:#e5e5e5; 175 | height:1px; 176 | margin:0 0 20px; 177 | } 178 | 179 | footer { 180 | width:270px; 181 | float:left; 182 | position:fixed; 183 | bottom:50px; 184 | } 185 | 186 | @media print, screen and (max-width: 960px) { 187 | 188 | div.wrapper { 189 | width:auto; 190 | margin:0; 191 | } 192 | 193 | header, section, footer { 194 | float:none; 195 | position:static; 196 | width:auto; 197 | } 198 | 199 | header { 200 | padding-right:320px; 201 | } 202 | 203 | section { 204 | border:1px solid #e5e5e5; 205 | border-width:1px 0; 206 | padding:20px 0; 207 | margin:0 0 20px; 208 | } 209 | 210 | header a small { 211 | display:inline; 212 | } 213 | 214 | header ul { 215 | position:absolute; 216 | right:50px; 217 | top:52px; 218 | } 219 | } 220 | 221 | @media print, screen and (max-width: 720px) { 222 | body { 223 | word-wrap:break-word; 224 | } 225 | 226 | header { 227 | padding:0; 228 | } 229 | 230 | header ul, header p.view { 231 | position:static; 232 | } 233 | 234 | pre, code { 235 | word-wrap:normal; 236 | } 237 | } 238 | 239 | @media print, screen and (max-width: 480px) { 240 | body { 241 | padding:15px; 242 | } 243 | 244 | header ul { 245 | display:none; 246 | } 247 | } 248 | 249 | @media print { 250 | body { 251 | padding:0.4in; 252 | font-size:12pt; 253 | color:#444; 254 | } 255 | } 256 | --------------------------------------------------------------------------------