Drive#
Programming
15 min
1#
In the previous workshop you’ve learned how to turn the robot on and off. But she is not doing anything yet. In this workshop you will learn how to drive around and why all motors are different.
BE CAREFUL
You will drive around with the robot. We do not want your robot to break, so make sure you have put the robot on the floor so she will not drive off a table.
2#
Help
- When none of the motors are turning:
Check that the wiring of the motors is correct.
Check that the small light on the motor driver is on. Make sure that it is connected to the PCB correctly. If this still fails, you might need to check if the motor driver is working at all by testing it with someone elses.
- When the motors are turning, but not in the right direction:
It could be the case that the wiring of the motors is not done correctly. For example: left is right, etc. Please make sure that they are properly connected.
3#
4#
We can get a bit better understanding of the fact that not both motors are turning with the same speed. We can also control the motors individually. Each motor can get a value from -100 to 100.
-100 |
fully backward |
0 |
stop |
100 |
fully forward |
Each motor is slightly different and will only start to rotate at a different value. Below that threshold, you will only hear a soft beep. This is the sound of the motor trying to move, but still having too much friction.
4#
Assignment: Put the robot on the ground and try to find the values where the motor starts to move the robot for each motor.
The left motor turns… |
|
---|---|
… forward from value: |
… |
… backward from value: |
… |
The right motor turns… |
|
---|---|
… forward from value: |
… |
… backward from value: |
… |
5#
Assignment: Lift the robot up, and try to find the values again.
The left motor turns… |
|
---|---|
… forward from value: |
… |
… backward from value: |
… |
The right motor turns… |
|
---|---|
… forward from value: |
… |
… backward from value: |
… |
6#
You will see that the values are different depending on whether the robot is on the ground or not. When the robot is touching the ground it will feel more friction resulting in the motor trying to rotate even more.
But you have probably also seen that each motor has a slightly different starting value. Each motor is different and will only start at a slightly different value.
But also the battery power might be of influency. It could be that these values change depending on the state (full or empty) of the battery.
TIP
It is better to make sure your battery is always fully powered.
6#
7#
Help
- My robot is not moving:
Please have a look at the next step.
8#
9#
Assignment: Try to program the robot to drive a square. Or a cicrle?
You can use the ‘wait x seconds’ to change the size of the square.