1 / 1

Your First Robot program

Your First Robot program. For the Create robot In Python Based on the create module (library), originally developed by Zach Dodds at Harvey Mudd. import new_create import time def main (): port = 4 robot = new_create.Create (port ) robot.go ( 10 , 90 ) time.sleep ( 4.0 )

trey
Télécharger la présentation

Your First Robot program

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Your First Robot program • For the Create robot • In Python • Based on the create module (library), originally developed by Zach Dodds at Harvey Mudd importnew_create import time defmain(): port = 4 robot = new_create.Create(port) robot.go(10, 90) time.sleep(4.0) robot.stop() sensor = new_create.Sensors.distance v = robot.getSensor(sensor) print(v) robot.shutdown() Connects to a Create robot using the given COM port • Start the robot moving: • At 10 cm/sec forwards • While spinning 90 degrees/sec counterclockwise Sleep 4 seconds (while the above motion continues), then stop. Specify a sensor (here, the distance sensor that says how far the robot has moved linearly since you last asked), then get and print the current value of the sensor. Always have your program execute this at its end!

More Related