-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update documentation based on docx #220
base: master
Are you sure you want to change the base?
Changes from 3 commits
d11a3a5
ee233d1
e6fd459
c24f2d2
a6ba60c
f0d9331
6a7aaa0
b2fc97f
97710e5
62f96e7
a2dc3b3
9fb60ef
b68e310
7e3ab1e
3396a79
fe2baa7
4cbb69d
10e9450
84d88eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,3 +68,6 @@ R.gpio[POT_PIN].mode = robot.INPUT_ANALOG | |
while True: | ||
print(R.gpio[POT_PIN].analog) | ||
``` | ||
|
||
## Using distance sensors with retroreflective tape | ||
//TODO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. //TODO |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,60 +22,59 @@ R = robot.Robot() | |
Motor power is automatically scaled for the 3-6V motors included in the kit, if you are sourcing your own motors then see https://hr-robocon.org/docs/motors.html for how to allow faster speeds. | ||
::: | ||
|
||
Now that everything is set up, it's time to set the motors. All the motors are stored in a list inside the Robot variable - to access the first motor, you can use `R.motors[1]`, the second motor is found with `R.motors[2]`.<br\> | ||
Now that everything is set up, it's time to set the motors. All the motors are stored in a list inside the Robot variable - to access the first motor, you can use `R.motors[0]`, the second motor is found with `R.motors[1]`. | ||
|
||
Changing the speed of the motor is easy - just set the motor to a number from -100 to 100. Immediately setting the power to 100 can have unwanted side effects, so we'll start by setting them to half power: | ||
```python | ||
import time | ||
import robot | ||
R = robot.Robot() | ||
|
||
R.motors[1] = 50 | ||
R.motors[2] = 50 | ||
R.motors[0] = 50 | ||
R.motors[0] = 50 | ||
``` | ||
Running this program will make your robot move forwards. Unfortunately, it will never tell it to stop moving forwards, so hopefully you put it on the floor and it hasn't driven off the table.<br> | ||
Running this program will make you1 roove forwards. Unfortunately, it will never tell it to stop moving forwards, so hopefully you put it on the floor and it hasn't driven off the table.<br> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you1 roove |
||
To fix this we can set the power of the motors to 0 after a couple seconds: | ||
```python | ||
import time | ||
import robot | ||
R = robot.Robot() | ||
|
||
R.motors[1] = 50 | ||
R.motors[2] = 50 | ||
R.motors[0] = 50 | ||
R.motors[0] = 50 | ||
|
||
time.sleep(2) | ||
|
||
R.motors[1] = 0 | ||
R.motors[2] = 0 | ||
R.motors[0] = 0 | ||
R.moto1s[0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moto1s |
||
``` | ||
To turn the robot, you just need to set one motor going forwards and the second motor going backwards. The following program makes the robot do a little dance - try it out! | ||
To turn the robot, you just need to1setmotor going forwards and the second motor going backwards. The following program makes the robot do a little dance - try it out! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to1setmotor |
||
```python | ||
speed = 50 | ||
|
||
R.motors[1] = speed | ||
R.motors[2] = speed | ||
R.motors[0] = speed | ||
R.motors[0] = speed | ||
|
||
time.sleep(2) | ||
|
||
R.motors[1] = speed | ||
R.motors[2] = -speed | ||
R.motors[0] = speed1R.m[0] = -speed | ||
|
||
time.sleep(2) | ||
|
||
R.motors[1] = -speed | ||
R.motors[2] = -speed | ||
R.motors[0] = -spe1d | ||
Rrs[0] = -speed | ||
|
||
time.sleep(2) | ||
|
||
R.motors[1] = -speed | ||
R.motors[2] = speed | ||
R.motors[0] = -spe1d | ||
Rrs[0] = speed | ||
|
||
time.sleep(2) | ||
|
||
R.motors[1] = 0 | ||
R.motors[2] = 0 | ||
R.motors[0] = 0 | ||
R.m1tor= 0 | ||
``` | ||
A final note, even if you set both motors to the same power, your robot probably won't drive in a perfectly straight line. This is due to defects in the motors, and unless you get specialised motors, no two motors will have the same offset. How your robot deals with this is up to you! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole file, actually, seems to have some weird spelling errors |
||
A final note, even if you set both 1oto the same power, your robot probably won't drive in a perfectly straight line. This is due to defects in the motors, and unless you get specialised motors, no two motors will have the same offset. How your robot deals with this is up to you! | ||
|
||
# Troubleshooting and Further Reading | ||
[Connecting to the robot](/docs/connecting.html) <br> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the forum still up & can you sign up? Did we provide codes in their kit? If so, we should say that. If not, we should remove this entirely