pibot:challenge2:softwaremac
Software Setup
- Open the Visual Studio Code from the Applications directory on the flash drive
- Use the information below to change the code so that the PiBot will solve the maze with obstacles
- After the changes to the code are complete, save it with File→Save
Software Explanation
- Copy the GPIO settings for the ECHO and TRIGGER pins as well as the servo setting from the picar-obstacle-avoid.py file
- Copy the measure function from the picar-obstacle-avoid.py file
- Copy the pwm.set_pwm function calls for the servo from the picar-obstacle-avoid.py file
- Copy the ob_range variable from the picar-obstacle-avoid.py file and use it to determine if there is an obstacle that the PiBot needs to avoid
- Include debugging prints to help troubleshoot if the distance measured doesn't seem to be working
- Make the changes to the intersection decision logic to sense for obstacles and react to any obstacles that are in the path
It may be easiest to only take a sonar measurement after making a decision (and turn if necessary) at an intersection. If there is an obstacle then the PiBot will need to undo the decision (and turn).
- Bonus points if you include moving the sonar sensor in the PiBot's “Happy Dance” when it reaches the end of the maze
"Therefore, if anyone is in Christ, he is a new creation. The old has passed away; behold, the new has come. - 2 Corinthians 5:17"
pibot/challenge2/softwaremac.txt · Last modified: by 127.0.0.1







