SunFounder PiDog Kit, Release 1.0
(continued from previous page)
my_dog.do_action('stand', wait=False, speed=60)
my_dog.head_move_raw([[0, 0, head_pitch_adjust]],
immediately=True, speed=60)
my_dog.do_action(name, step_count=10, wait=False, speed=speed)
elif index < len(actions) + len(sound_effects):
my_dog.speak(sound_effects[index - len(actions)])
last_index = index
def function_demonstration():
global index
global exit_flag
show_info()
while True:
try:
num = input("Enter function number: ")
if int(num) > len(actions) + len(sound_effects):
print('Out of range')
continue
index = int(num) - 1
do_function(index)
show_info()
except ValueError:
print('ValueError')
except KeyboardInterrupt:
my_dog.close()
sleep(0.05)
if __name__ == "__main__":
function_demonstration()
2.2.4 Patrol
In this project, PiDog makes a vivid behavior: patrolling.
PiDog will walk forward, if there is an obstacle in front of it, it will stop and bark.
Run the Code
cd /home/pi/pidog/examples
sudo python3 3_patrol.py
After running this example, PiDog will wag its tail, scan left and right, and walk forward.
Code
Note: You can Modify/Reset/Copy/Run/Stop the code below. But before that, you need to go to source code path
like pidog\examples. After modifying the code, you can run it directly to see the effect.
2.2. Funny Project 51