RobotBASIC Robots For Beginners: Building Inexpensive RROS-Based Robots by John Blankenship
Author:John Blankenship [Blankenship, John]
Language: eng
Format: epub, azw3, pdf
Publisher: CreateSpace
Published: 2017-10-12T07:00:00+00:00
Coding vs Developing Algorithms
Notice that the discussion above did not talk about how to program the robot to do anything. Instead, it simply expressed an idea of what the robot should do. In general, programmers should decide what has to be done first, then decide how to write the code to do it. As you become more and more proficient in a computer language the difference between the above two ideas will blur, but in the beginning, you should certainly see them as distinct processes.
The plan for what needs to happen is called an algorithm. Writing a program to implement the plan is called coding. Programming is really the process of creating an algorithm and implementing that using the code required for the language you are using. If you learn how to create algorithms, then you can program with many language by just studying their instructions.
Our next step is to see how we can make the robot change between right and left turns for a random amount of time. Look at Figure 6.9. The actual rTurn statement uses dir*10 to control the turn itself. If the value of dir is +1 the robot will turn right. A value of -1 will turn the robot left. At the beginning of the module, the variable dir is set equal to 1. Inside the loop, a random statement multiplies dir by -1 about 5% of the time.
If dir is 1, multiplying it by -1 will make it a -1. If it is already -1, multiplying it by -1 will make it positive again. This means the robot will change the style of its turns about 5% of the time and that should eliminate the vibrating movements seen in the last module used. Make these modification to your Roam module and verify the program now works as expected.
This program is not necessarily perfect, but it does seem to perform fairly well based on our original goals. It certainly is possible though that the robot, if it runs long enough, might eventually bump into an object for some unusual position of the robot in the room. And since our robot moves with some randomness, it should eventually find itself in every possible situation (given enough time).
Download
RobotBASIC Robots For Beginners: Building Inexpensive RROS-Based Robots by John Blankenship.azw3
RobotBASIC Robots For Beginners: Building Inexpensive RROS-Based Robots by John Blankenship.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Automotive | Engineering |
Transportation |
Whiskies Galore by Ian Buxton(41503)
Introduction to Aircraft Design (Cambridge Aerospace Series) by John P. Fielding(32871)
Small Unmanned Fixed-wing Aircraft Design by Andrew J. Keane Andras Sobester James P. Scanlan & András Sóbester & James P. Scanlan(32545)
Craft Beer for the Homebrewer by Michael Agnew(17911)
Turbulence by E. J. Noyes(7672)
The Complete Stick Figure Physics Tutorials by Allen Sarah(7109)
Kaplan MCAT General Chemistry Review by Kaplan(6559)
The Thirst by Nesbo Jo(6417)
Bad Blood by John Carreyrou(6251)
Modelling of Convective Heat and Mass Transfer in Rotating Flows by Igor V. Shevchuk(6213)
Learning SQL by Alan Beaulieu(6005)
Weapons of Math Destruction by Cathy O'Neil(5798)
Man-made Catastrophes and Risk Information Concealment by Dmitry Chernov & Didier Sornette(5611)
Digital Minimalism by Cal Newport;(5343)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5160)
iGen by Jean M. Twenge(5135)
Secrets of Antigravity Propulsion: Tesla, UFOs, and Classified Aerospace Technology by Ph.D. Paul A. Laviolette(4885)
Design of Trajectory Optimization Approach for Space Maneuver Vehicle Skip Entry Problems by Runqi Chai & Al Savvaris & Antonios Tsourdos & Senchun Chai(4822)
Electronic Devices & Circuits by Jacob Millman & Christos C. Halkias(4714)
