programming - motion

Download Programming - Motion

If you can't read please download the document

Upload: zorina

Post on 25-Feb-2016

44 views

Category:

Documents


5 download

DESCRIPTION

Programming - Motion. Intro to Robotics. Motor Command. The motor command tells the robot to run a motor at a given power level. The example below sets the motor on port 3 to run at full power forwards. Remember, every command ends with a semicolon. Wait Command. - PowerPoint PPT Presentation

TRANSCRIPT

  • Programming - MotionIntro to Robotics

  • Motor CommandThe motor command tells the robot to run a motor at a given power level. The example below sets the motor on port 3 to run at full power forwards. Remember, every command ends with a semicolon.

  • Wait CommandThe comment wait1Msec tells the robot to wait before it executes the next command, for a given time in milliseconds. The value in parenthesis is the amount of time you want the robot to wait. 3000Ms is equal to 3 seconds.

  • What happened????

  • bMotorReflectedOne way to correct this problem is by using the bMotorReflected statement. To reverse the polarity of the motor, set this statement equal to 1. This reverses the direction in which the motor spins. Reversing the direction of one motor makes it easier to use reflected motors. The same motor command can then be used to run both motors.

  • Modify this code. Since we are moving at half power lets double our time.

  • Modify the code, then compile and download. Note what happens.

  • Modify the code below, then compile and download each time. Note what happens.

  • Manual Straightening

    To compensate for the differences between the motors, we could either speed up the slower motor or slow down the faster one. Lets slow down the faster one.

  • Save the code with a filename you will remember in your MY DOCUMENTS folder.