I'd like to make a program for changing in direction. Change in direction is just opposite to each other to rotate the motor A and motor B.
This is called "rotation really" to rotate on the spot.
So, how do I turn the motor on at proper angle. I want to calculate them. Was measured in a ruler, the diameter of the tire was 5.7cm.
So "diameter of the tire × π"= diameter circle, the circumference of the tire is about 17.9cm. This means that a motor is rotated by one time, it advances approximately 17.9cm.
If you have a serious rotation, the path of the tire should be on top of the red circle. It was 9.5cm and a ruler to measure the spacing of the tire. So, the circumference is about 9.5 × π = 29.8cm. Divided by the circumference of the tire that distance, angle of rotation required for the motor is found.
360 × 29.8 ÷ 17.9 = 597.6 ...
... is required to change direction 360 degrees for this robot. If you turn 597 degrees around the tire, the robot will be able to change direction 360 degrees. This further divided by 4,
597 ÷ 4 = 149.25
Rotation angle ... will be required to change of direction of 90 degrees.
The program just ended up ... and failed. Why was it failed ?
This is a program that had failed. It contained 4 of the "start of the loop" is because it was planned (degree 90 × 4 = 360) performed four times a change in direction of 90-degree increments. Cause it did not work because the rotation speed of the motors A and B have different. In this program it was only to monitor the motor A, I had gotten to finish in the middle of a slow rotation speed of the motor B. The rotational speed of the motor is it different, with the product problem? In order to solve this, you need to monitor at the same time the angle of rotation of the motor A and motor B.
[DOWNLOAD] Program was created (for Robolab2.9)
Use a feature called "Tasks" there. That task means to work.
When you are making a ramen, have better do at the same time warming the soup and boiling the noodles. In this case "Warm soup" and "boil the noodles" in this case is equivalent to the task. You need to do tasks at the same time that the task of "turning the motor A" in the program as "turning the motor B".
Change of direction was 90 degrees.
Further change of direction was 90 degrees.
At the end of the fourth 90 degrees change direction, the total will be 360 degrees. They seem to be about 5 degrees too many around for some reason, is a success for now.
A program.
Using the "branch task", has been monitored the motor A and motor B at the same time. Two tasks do not know ends first. Therefore, task of side A have to wait until the end of the task of side B.
I used the container as a way to tell the completion of the task. It is a container that can be stored in values that change (variable).
[DOWNLOAD] Program was created (for Robolab2.9)