GW-Robotics / 2017-Firefighter

2017 GW Robotics code for the Trinity College Fire Fighting Robot competition
MIT License
2 stars 2 forks source link

Write code to stop in front of a wall and decide a direction to move #27

Open omn0mn0m opened 7 years ago

omn0mn0m commented 7 years ago

Pseudocode:

if wall: check left and right ultrasonics move in direction of clearest path

WaIIer commented 7 years ago

Check left and right sonar, turn in that direction

reading on sonar for when to stop moving

stopReading = none

assign values later using tuple

leftPin = none rightPin = none centerPin = none()

Declare two sonar sensors

center = Sonar(centerPin[0],centerPin[1],centerPin[2])

left = Sonar(leftPin[0],leftPin[1],leftPin[2])

right = Sonar(rightPin[0],rightPin[1],rightPin[2])

if center.get_distnace > stopReading: if right.get_distance > left.get_distance:

move/turn right

else:
    #move/turn left
omn0mn0m commented 7 years ago

Code has been written to follow a maze and make its way out using what is called the left-handed wall following algorithm. This needs to be changed from using limit switches to using the ultrasonic's reading_in_range() function.

When the robot is within a certain range (probably 0 to 5 cm), then it is equivalent to a limit switch being triggered.

From SEAS Innovation Challenge R&D Showcase code:

def navigate_maze(self):
        """Simple Left-Handed Wall Follower Algorithm"""

        if self.front_switch.get():
            arcade_drive(0.0, 0.0, -1.0)

        if self.left_switch.get():
            arcade_drive(0.0, 0.0, 1.0)

        if self.right_switch.get():
            arcade_drive(0.0, 1.0, 0.0)
            sleep(1.0)
            arcade_drive(1.0, 0.0, 0.0)
omn0mn0m commented 7 years ago

For now turn by time until we have working gyro code.