FASTBot motor command – Move Forward

FASTBot motor command – Move Forward.

This is an interesting motor function to give you many useful options when the bot is moving forward. The speed of both the motors can be adjusted independently. Basically, the bot turns to the right or left depending on the difference between the running speed between the motors. When the left runs slower than the right motor, the bot turns left. Similarly, if the right motor is slower than the left motor, the bot turns into right side. Even though the motors take different speeds independent of each other, the motors are forced to run only in forward direction. To get same kind of movement in backward, we have another motor function, Move Backwards, which is discussed next.

You need to customize the following parameters to do the exact movement:

The speed of the left motor (Forward)

The speed of the right motor (Forward)

Timing (optional)

Stop the motors once the action is performed (optional)

The structure of the function without the Motor stop option is given here:

MoveForward (char LeftMotorSpeed, char RightMotorSpeed, int RunTime )

With the Motor stop option the function looks like

MoveForward_S(char LeftMotorSpeed, char RightMotorSpeed, int RunTime )

When the equal speed is applied to both motors, the robot moves forward and resembles Go Front function.

When the left motor is stopped, the bot turns left in an arc with the left wheel as the centre. This behaves like the Turn Left function. But, when the right motor is stopped, the robot takes an arc in the right keeping the right wheel as the centre. This is similar to the results of using Turn Right function.

Now, it is clear that this particular function can replace three of the motor functions discussed already when it is moving forward. If you are keen, you can understand the utility of this function in more applications than other related functions. Using other functions, you can only make your bot either run forward or turn sideways abruptly. Suppose when your bot is required to take a calculated turn sideways in a defined arc, you can finish the task only with this function. This is required for many navigational tasks like line tracking, wall hugging, light following and avoidance where gradual turn is most preferred than Turn Right, Turn Left functions. Also, when you set the motors running to their maximum speed, the bot takes the turns at the fastest speed.

The function also gives you an option of changing the speeds and the run time using variables to create more flexibility during robotic operations. The function structure becomes like this:

MoveForward ( 90-a, 90-b, c ) with a,b and c acting like variables to introduce more flexibility during program development and subsequent execution.

Because of this, you can vary the robot behaviours using switch case statements. Now the program becomes simpler using multiple If statements and the execution takes less time than before.

Following indicates the options you get when using variables to define speeds of the motors.

Move Forward ( 90-a, 90-b, c )

a = 0, b = 0 – Go Front.

a = 90, b = 0 – Turn left.

a = 0, b = 90 – Turn Right.

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

a = 0, b = 30 – Smooth turn in the right.

Also keep an eye on the values of the variables during programming since the speed values should take values between 0 and 100 for executing this function in all conditions.

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

Comments are closed.