1 / 7

Điều khiển chuyển động

Điều khiển chuyển động. SaigonTech SRobot Workshop. Nội dung chính. Điều khiển Motor Điều khiển tay lái (Pilot). 1. Điều khiển Motor. Yêu cầu : Viết chương trình điều khiển robot xoay vòng tròn tại tâm trong 5 giây . uses STRobot , SysUtils ; var robot: SROBOT;

urbain
Download Presentation

Điều khiển chuyển động

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. Điềukhiểnchuyểnđộng SaigonTechSRobot Workshop

  2. Nội dung chính • Điềukhiển Motor • Điềukhiểntaylái (Pilot)

  3. 1. ĐiềukhiểnMotor • Yêucầu:Viếtchươngtrìnhđiềukhiển robot xoayvòngtròntạitâmtrong5 giây.

  4. uses STRobot, SysUtils; var robot: SROBOT; leftMotor, rightMotor: SMOTOR; begin robot := createRobot('NXT', 'Robot xe 1', 100, 100, 0); leftMotor := robotGetMotor(robot, PORT_A); rightMotor := robotGetMotor(robot, PORT_B); motorForward(leftMotor); motorBackward(rightMotor); sleep(5000); end.

  5. 2. Điềukhiểntaylái (Pilot) • Yêucầu:Viếtchươngtrìnhđiềukhiển robot di chuyểnnhưsau: • Di chuyểnvớiquỹđạolàmộthìnhvuôngcócạnhlà 60cm. • Sauđótiếptục di chuyểnvớiquỹđạolàmộthìnhtrònvớibánkính 30cm.

  6. uses STRobot, SysUtils; var robot: SROBOT; pilot: SPILOT; counter, power, edge, radius: Integer; length : Double; begin robot := createRobot('NXT', 'Robot xe 1', 100, 100, 0); pilot := robotGetPilot(robot); power := 50; edge := 60; radius := 30; for counter := 1 to 4 do begin pilotForwardByDistance(pilot, edge, TYPE_POWER, power); pilotTurnLeftByAngle(pilot, 90, TYPE_POWER, power); end; length := 2 * PI * radius; pilotTurnRightArcByLength(pilot, radius, length, TYPE_POWER, power); end.

  7. Hỏi đáp

More Related