• Home
  • My IT Instructor
    • Student Resources >
      • CNM Courses >
        • CNM - Cisco Self Enroll Courses
        • CIS-1410 IT Essentials Hardware
        • CIS-1415 Network Essentials
        • CIS-1605 Internet of Things
        • CIS-1610 IT Essentials Software
        • CIS 1696 Introduction to Competitive Robotics
        • CIS-2620 Configuring Windows Server
        • CIS-2636 Cloud Computing
        • CIS-2650 Advanced Windows Server
        • CIS-2670 Computer Security+
    • Instructor Resources >
      • IoT Resources
      • Raspberry Pi in the Classroom
      • Raspberry Pi CS/CIS Activities >
        • Pi Computer Basics
        • Pi Networking
        • Pi Cybersecurity
        • Pi Programming
        • Pi System Administration
        • Pi Web
      • Big Data Resources
    • NCTC
    • Let's Get Social
    • Books I Recommend
  • WASTC
    • Cyber
    • Networking with the Raspberry Pi
    • 2021 Summer vFDW
    • 2021 WATSC Raspi PlayShop
    • 2022 - Summer vFDW - CIS Topics
    • 2022 - Summer vFDW - CyberSecurity
    • WASTC Tiki Bar Links
  • #PiWars Blogs
    • #PiWars 2024
    • #PiWars 2021
    • #PiWars 2020
    • #PiWars 2019
    • #PiWars 2018
    • #PiWars 2017
  • Pi IT Up!
    • Raspberry Pi Web Resources
    • Home Automation
  • CNM HackerSpace
  • Robotics Resources
  • Workshop Information
MyITInstructor
  • Home
  • My IT Instructor
    • Student Resources >
      • CNM Courses >
        • CNM - Cisco Self Enroll Courses
        • CIS-1410 IT Essentials Hardware
        • CIS-1415 Network Essentials
        • CIS-1605 Internet of Things
        • CIS-1610 IT Essentials Software
        • CIS 1696 Introduction to Competitive Robotics
        • CIS-2620 Configuring Windows Server
        • CIS-2636 Cloud Computing
        • CIS-2650 Advanced Windows Server
        • CIS-2670 Computer Security+
    • Instructor Resources >
      • IoT Resources
      • Raspberry Pi in the Classroom
      • Raspberry Pi CS/CIS Activities >
        • Pi Computer Basics
        • Pi Networking
        • Pi Cybersecurity
        • Pi Programming
        • Pi System Administration
        • Pi Web
      • Big Data Resources
    • NCTC
    • Let's Get Social
    • Books I Recommend
  • WASTC
    • Cyber
    • Networking with the Raspberry Pi
    • 2021 Summer vFDW
    • 2021 WATSC Raspi PlayShop
    • 2022 - Summer vFDW - CIS Topics
    • 2022 - Summer vFDW - CyberSecurity
    • WASTC Tiki Bar Links
  • #PiWars Blogs
    • #PiWars 2024
    • #PiWars 2021
    • #PiWars 2020
    • #PiWars 2019
    • #PiWars 2018
    • #PiWars 2017
  • Pi IT Up!
    • Raspberry Pi Web Resources
    • Home Automation
  • CNM HackerSpace
  • Robotics Resources
  • Workshop Information

Baby steps - GoPiGo3

11/2/2020

 
Hello everyone, my name is Joey Ferreri. It is unfortunate that PiWars will not be held in person this year, but we are still excited to participate this year in PiWars at home. Our team is comprised of both veteran PiWars goers and newbies. This year we will continue iterating on CNM Hackerspace’s HAL robot that we have incrementally upgraded for the past several years. To get everyone warmed up and prepare to work on the real deal, we’ve been using Dexter Industries’ GoPiGo3 robots for programming and practicing with various sensors as well. Specifically, we have been orientating ourselves with the distance sensor, light and color sensor, and the camera, all of which will aid us in autonomous completion of the challenges. We are hoping to all acquire the skills to develop our robot to its best iteration yet. Here’s to a great PiWars at home!

Here is the main code for the distance sensor on my Dexter robot:

from easygopigo3 import EasyGoPiGo3

import easygopigo3 as easy
import time

gpg = easy.EasyGoPiGo3()
distance = gpg.init_distance_sensor()

# create an EasyGoPiGo3 object
gpg3_obj = EasyGoPiGo3()

# and now let's instantiate a Servo object through the gpg3_obj object
# this will bind a servo to port "SERVO1"
servo = gpg3_obj.init_servo()

def goOrNo(gpg, distance):
    leftAngle = 150
    rightAngle = 30
    centerAngle = 90
    leftDist = -1
    rightDist = -1
    
    print("scanning")

    servo.rotate_servo(leftAngle)
    time.sleep(.5)    
    leftDist = distance.read_mm()
    
    servo.rotate_servo(rightAngle)
    time.sleep(.8)    
    rightDist = distance.read_mm()

    servo.rotate_servo(centerAngle)

    if leftDist > rightDist:
        gpg.turn_degrees(-70)
    else:
        gpg.turn_degrees(70)
    
    print("route found")

tooClose = 100
run = True
center = 90

servo.rotate_servo(center)

while run == True:
    d = distance.read_mm()
    print(d)
    gpg.forward()
    time.sleep(.2)
    if d < tooClose:
        print("too close")
        gpg.drive_cm(-50)
        goOrNo(gpg, distance)

This program allows autonomous function of the robot. It drives until the value from the distance sensor goes below a certain value, then backs up a predetermined amount and checks its surroundings. it looks left, then right and stores the value of each side and turns to whichever side has a greater distance value.

Comments are closed.

    Author

    CNM HackerSpace Robotics
    Jimmy Alexander - Team Leader
    Joey Ferreri - Experienced Non-Veteran
    Robert Burnside - Groupie
    Colin Stapleton - YouTube Video Watcher

    Archives

    December 2020
    November 2020
    February 2020

    Categories

    All

    RSS Feed

© COPYRIGHT 2015. ALL RIGHTS RESERVED.
  • Home
  • My IT Instructor
    • Student Resources >
      • CNM Courses >
        • CNM - Cisco Self Enroll Courses
        • CIS-1410 IT Essentials Hardware
        • CIS-1415 Network Essentials
        • CIS-1605 Internet of Things
        • CIS-1610 IT Essentials Software
        • CIS 1696 Introduction to Competitive Robotics
        • CIS-2620 Configuring Windows Server
        • CIS-2636 Cloud Computing
        • CIS-2650 Advanced Windows Server
        • CIS-2670 Computer Security+
    • Instructor Resources >
      • IoT Resources
      • Raspberry Pi in the Classroom
      • Raspberry Pi CS/CIS Activities >
        • Pi Computer Basics
        • Pi Networking
        • Pi Cybersecurity
        • Pi Programming
        • Pi System Administration
        • Pi Web
      • Big Data Resources
    • NCTC
    • Let's Get Social
    • Books I Recommend
  • WASTC
    • Cyber
    • Networking with the Raspberry Pi
    • 2021 Summer vFDW
    • 2021 WATSC Raspi PlayShop
    • 2022 - Summer vFDW - CIS Topics
    • 2022 - Summer vFDW - CyberSecurity
    • WASTC Tiki Bar Links
  • #PiWars Blogs
    • #PiWars 2024
    • #PiWars 2021
    • #PiWars 2020
    • #PiWars 2019
    • #PiWars 2018
    • #PiWars 2017
  • Pi IT Up!
    • Raspberry Pi Web Resources
    • Home Automation
  • CNM HackerSpace
  • Robotics Resources
  • Workshop Information