What is an encoder in robotics
In a first test run, the robot will drive straight ahead for four seconds at 32 encoder ticks per second. During this time he covers a distance of approx. 80 cm and both bikes cover the same distance at the same speed.
|Test run the robot|
The robot should walk straight ahead for about 80cm. Due to the constant feedback from the encoder, which the robot uses to continuously adjust and correct its course, the movement is not absolutely straight.
The program Test for Trim.c
How does the program work?
Except the order break (8000) all other commands come from the library abdrive.
drive_trimSet (0, 0, 0)clears any trim settings that may have been entered previously.
drive_speed (32, 32)sets both wheels to a speed of 32 ticks (1/2 revolution) per second over a period of 8s. The command
drive_speed (0, 0)stops both servos.
What you should know
Updates- The ActivityBot updates the motor speed 50x per second via feedback from the encoder data. It compares how far the wheel should have turned and how far it actually turned.
Encoder ticksand distances - With each encoder tick, the wheel has moved 3.25mm forward. A tick is always the distance from a spoke to a hole or from a hole to a spoke. There are 32 spokes and 32 holes in each wheel, making a total of 64 encoder ticks per wheel revolution.
Ramping- Ramping means the gradual increase or decrease in speed so that the robot starts and ends driving maneuvers gently and does not start or stop abruptly.
If you want to drive down the route you have just traveled twice as fast, then try the following program.
program Be faster c
Now you come!
In the following program, the principle of ramping becomes clear and you can see it again from the movement of the robot. In a LOOP loop and with the help of a variable speed, the rotation rate of the wheels is first increased and later decreased.
2 - cover distances
Of course it is possible to cover a certain distance by choosing a certain speed and setting the time. It gets complicated as soon as you build in rampings at start and stop. In the library abdrive there is a function drive_gotothat takes all of this into account. In addition, it controls the propulsion of each wheel in units of 3.25mm.
3 - Straight lines, turns and encoder ticks
A wheel of the Propeller ActivityBot has 32 spokes and 32 spaces; that makes 64 ticks for the encoder. If the wheel turns 1/64 (this corresponds to a tick), it moves 3.25mm.
Should he ActivityBot travel a certain distance s, then s in the unit mm must be divided by 3.25 mm in order to find out how many ticks have to be counted in the program.
The turning radius of a ActivityBots is typically 105.8mm.
If the right wheel stops and only the left wheel rotates, then the distance the wheel runs corresponds to the circumference of the circle: 2 x Pi x r. In this case r is the radius of the circle; it corresponds to the distance between the two wheels: 105.8mm. The circumference is calculated as follows: 664.76 mm. A quarter turn would then correspond to a circumferential distance of 166.2 mm or 166.2 / 3.25 ticks = approx. 51 ticks.
With this program the moves ActivityBot 256 ticks forward and then rotates 90 degrees to the right.
How does the program work?
The ActivityBot drives forward 256 ticks (four wheel revolutions).
The robot executes a 90 ° turn to the right.
4 - Set the speed
With the function drive_speed from the library abdrive each drive servo can be set to a specific speed (in encoder ticks per second). Positive signs stand for forward movements and negative signs for backward movements. If a wheel speed is set to 64 ticks, this corresponds to a full revolution per second. And we will drive_ramp Use the function and slowly brake the robot and allow it to start slowly.
Sample program for speed control
In this example, the robot moves forward at a speed of 64 ticks / second for 200 ticks, then performs a 45 ° right turn by turning the left wheel at 32 ticks / second, and then moves for another 200+ ticks at a speed of 128 ticks / second.
|Adjust the speed|
The program Speeds for navigation c
How does the program work?
The program starts with both servos rotating at 64 ticks / second for over 2 seconds. Makes a total of 128 ticks.
Drive_speed (26, 0) the left wheel turns at approx. 26 ticks / second while the right wheel stands still. This process takes 1 second; the left wheel rotates with 26 ticks, which corresponds to an angle of approx. 45 °.
Drive_speed (0, 0) lets both wheels stand still for a second. The subsequent last maneuver takes the same route as the first, only this time twice as fast (128 ticks / second instead of 64) but only one second instead of 2.
- What is the scientific name of chili
- How can I get rid of gynochomesty
- You can use an example to explain how JSON works
- Are Louis Vuitton bags cheaper in Europe?
- How do INTJs deal with romantic rejection
- When will Overwatch die
- What are distorted thoughts
- Why do birds generally have a long lifespan
- Is Croatia part of the Schengen area
- Does SSN have a good teacher
- How to say supercalifragilisticexpialidocious in Spanish?
- How does chervil taste
- Unwanted possession can happen in secret
- What things make a rocket successful
- Is Manchester United Catholic or Protestant?
- What is the real meaning of X.
- You can order plants online
- Do girls and women have sexual feelings?
- Why do porn stars look so attractive
- Flat feet are allowed in the defense
- Do narcissists feel something for their pets
- Why was Meek Mill in jail?
- How can I arouse interest in drawing?
- Is Notepad ++ better than other HTML editors
- How can I become an Android developer
- What qualities are inherited from parents
- Killed Jigen Naruto and Sasuke
- How do I deal with social cliques
- Light is faster than lightning
- How are the teachers in DPS Newtown
- Why did BTS V have long legs
- How does Google WebMaster work
- Will BTS ever come to Pittsburgh