FASTBot motor command – Move Motors.

FASTBot motor command – Move Motors.

This move function enables you to take your bot in any desired direction and operate the motors with independent speed. This function effectively substitutes all motor functions you have come across so far except the Configure Motors function, which you are going to deal with in the next pages. In short, this function is the most powerful one to take your bot in any desired movement. Using this function, you can move the motors in any direction, with any speed, independently for any required time.

When using this function, you need to customize the following parameters:

The parameters to be set are:

The speed of the left motor

The direction of the left motor

The speed of the right motor

The direction of the right motor

Timing (optional)

Stop the motors once the action is performed (optional)

The structure of the function is given here:

MoveMotors ( LeftMotorDirection & Speed, RightMotorDirection & Speed, RunTime)

When the Stop option is enabled:

MoveMotors_S ( LeftMotorDirection & Speed, RightMotorDirection & Speed, RunTime)

The Function Run Time determines how long the bot can move on its defined path and next function becomes active only when run time becomes lapsed. If the Stop option is enabled, the bot comes to halt at the end of run time. If the Stop function is disabled, next immediate function starts acting on the bot when the previous function run time comes to the end.

There is no separate representation for the motor direction. If the speed is positive, the direction is forward. For the negative speed value, the direction is backward.

Negative values are applicable only for this function and not for any other motor function.

Since this motor function can substitute other functions like Go Front, Go Back, Spin Left, Spin right, Move Forward, Move Backward because of the independent speed setting as well as the direction definition. When you master this function, you don’t need other functions. But, there is another complementary motor function, Configure Motors, made available to give you additional features.

Apart from all above, you can define variables for motor speed initially and then modify them “on the fly” when using this motor function in your applications to create more flexibility during bot navigation.

You can consider the function structure as MoveMotors ( 90-a, 90-b, c ) where the values of a, b and c can be set and modified using switch-case statements. Now, your program becomes simpler and faster than using multiple if statements which results in slower execution. This facility is very much useful in navigational tasks like line tracking, wall following, light following where controlled turns are most preferred than the results of Turn Left, Turn Right, Spin Left and Spin Right functions.

Following is the list of possibilities for this motor function for different values of a and b:

a=0, b=0 – Go Front

a=20, b=0 – Smooth turn to the left.

a=0, b=20 – Smooth turn to the right.

a=90, b=0 – Abrupt turn to the left.

a=0, b=90 – Abrupt turn to the right.

a=90, b=90 – Stop motors.

a=180, b=0 – Spin left.

a=0, b=180 – Spin right.

a= 180, b=90 – Abrupt left turn in backward direction.

a=90, b=180 – Abrupt right turn in backward direction.

a=180, b=160 – Smooth left turn in backward direction.

a=160, b=180 – Smooth right turn in backward direction.

a=180, b=180 – Go back.

Only when using this motor function, the operating parameters can take negative values. If the speed is positive, motors take the bot forward, else, the bot moves backwards for the negative speed.

The screen shot for the command looks like this

The function can be used easily to create gradual and precise turns in the forward and backward direction.

This entry was posted in Articles on FASTBot, FASTBot Motor Control, Knowledge Base and tagged , , , . Bookmark the permalink.

Comments are closed.