User Tools

Site Tools


pibot:challenge2:softwarewin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
pibot:challenge2:softwarewin [2021/09/12 15:44] – created jstruebelpibot:challenge2:softwarewin [2022/10/20 19:53] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Software Setup ======
 +
 +  - Open the VSCode from the Applications directory on the flash drive
 +  - Click on the small green square in the bottom left corner of the screen\\ \\ <WRAP box>{{ :pibot:challenge2:softwarewin:s1.png |VSCode Main Screen}}</WRAP>
 +  - Select the "Connect Current Window to Host..." option\\ \\ <WRAP box>{{ :pibot:challenge2:softwarewin:s2.png |VSCode Remote-SSH}}</WRAP>
 +  - Type "pi@pibot##" and press enter\\ \\ <WRAP round important>Replace the text "pibot##" with the label on the pibot</WRAP> <WRAP round important>The password to enter when prompted is "DogsAndCatsAreNice2." without the quotes. The '.' at the end is important!</WRAP> <WRAP round tip>It may take a couple of minutes while it installs some files on the PiBot</WRAP> <WRAP box>{{ :pibot:challenge2:softwarewin:s3.png |VSCode Remote Connection}}</WRAP>
 +  - Click the "Open Folder" button\\ \\ <WRAP box>{{ :pibot:challenge2:softwarewin:s4.png |VSCode Open Folder}}</WRAP>
 +  - Select the "pibot" folder and click the "OK" button\\ \\ <WRAP box>{{ :pibot:challenge2:softwarewin:s5.png |VSCode Browse}}</WRAP>
 +  - Select the picar-line-maze.py file in the list on the left\\ \\ <WRAP box>{{ :pibot:challenge2:softwarewin:s6.png |VSCode picar-line-maze.py}}</WRAP>
 +  - Select File->Save As... and save the file as picar-line-maze-obstacles.py\\ \\ <WRAP box>{{ :pibot:challenge2:softwarewin:s7.png |VSCode picar-line-maze-obstacles.py}}</WRAP>
 +  - 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\\ \\ <WRAP round tip>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).</WRAP>
 +  * Bonus points if you include moving the sonar sensor in the PiBot's "Happy Dance" when it reaches the end of the maze :-)
 +
 +[[:pibot:challenge2#software|Return to Challenge 2]]