├── .gitignore
├── LICENSE
├── README.md
├── docs
├── about.md
├── automation
│ ├── ControlTheory
│ │ ├── Control_Theory.md
│ │ ├── LQR.md
│ │ ├── MPC.md
│ │ ├── PID_Controller.md
│ │ └── images
│ │ │ ├── Change_with_Kd.png
│ │ │ ├── Change_with_Ki.png
│ │ │ ├── PID_varyingP.jpg
│ │ │ ├── Pid.jpg
│ │ │ ├── controlablity.png
│ │ │ ├── controlablity_1.jpg
│ │ │ ├── controller.png
│ │ │ ├── controller_1.png
│ │ │ ├── controller_2.png
│ │ │ ├── controller_4.png
│ │ │ ├── controller_5.png
│ │ │ ├── derivative.png
│ │ │ ├── integral.png
│ │ │ ├── propotional.png
│ │ │ ├── tuning_1.png
│ │ │ ├── tuning_2.png
│ │ │ ├── tuning_3.png
│ │ │ ├── tuning_4.png
│ │ │ └── whatis-feedback_loop_mobile.jpg
│ ├── PathPlanners
│ │ ├── APF.md
│ │ ├── Astar.md
│ │ ├── Dijkstra.md
│ │ ├── GA.md
│ │ ├── PRM.md
│ │ ├── RRT.md
│ │ ├── images
│ │ │ ├── pathimg1.png
│ │ │ ├── pathimg10.png
│ │ │ ├── pathimg11.png
│ │ │ ├── pathimg12.png
│ │ │ ├── pathimg13.png
│ │ │ ├── pathimg14.png
│ │ │ ├── pathimg15.png
│ │ │ ├── pathimg16.png
│ │ │ ├── pathimg17.png
│ │ │ ├── pathimg2.png
│ │ │ ├── pathimg3.png
│ │ │ ├── pathimg4.png
│ │ │ ├── pathimg5.png
│ │ │ ├── pathimg6.png
│ │ │ ├── pathimg7.png
│ │ │ ├── pathimg8.png
│ │ │ └── pathimg9.png
│ │ └── intro.md
│ ├── ROS
│ │ ├── gettingstartedros.md
│ │ ├── images
│ │ │ ├── ROSimg1.png
│ │ │ ├── ROSimg2.png
│ │ │ ├── ROSimg3.png
│ │ │ ├── ROSimg4.png
│ │ │ └── ROSimg5.png
│ │ └── installation.md
│ ├── intro.md
│ └── simulation
│ │ ├── gazebo
│ │ └── basics.md
│ │ ├── intro.md
│ │ └── stdr
│ │ ├── Basics.md
│ │ └── images
│ │ └── architecture.jpg
├── electronics
│ ├── Development_Boards
│ │ ├── Arduino.md
│ │ ├── ESP32.md
│ │ ├── Pyboard.md
│ │ ├── STM32.md
│ │ └── images
│ │ │ ├── ESP32pinout.png
│ │ │ ├── STM32-Pin-Details_0.png
│ │ │ ├── arduino1.png
│ │ │ ├── arduino2.png
│ │ │ ├── arduinoide.png
│ │ │ ├── arduinopot.png
│ │ │ ├── bluepill_intro.jpeg
│ │ │ ├── esp32intro.jpeg
│ │ │ ├── esp32intro2.jpg
│ │ │ ├── ledblink.png
│ │ │ ├── pyboard1.jpg
│ │ │ └── pyboard2.jpg
│ ├── Modules
│ │ ├── ESP8266.md
│ │ └── images
│ │ │ ├── board.png
│ │ │ ├── board_manager.png
│ │ │ ├── connection.png
│ │ │ ├── install.png
│ │ │ ├── pinout.png
│ │ │ ├── preferences.png
│ │ │ └── url.png
│ ├── Motors
│ │ ├── ServoMotor.md
│ │ └── images
│ │ │ ├── servo1.jpg
│ │ │ ├── servoconstr.jpg
│ │ │ └── servomech.jpg
│ ├── Sensors
│ │ ├── images
│ │ │ ├── lidar-airborne_lidar.jpg
│ │ │ ├── lidar-components_of_lidar.png
│ │ │ ├── lidar-lidar.jpg
│ │ │ └── lidar-terrestrial_lidar.png
│ │ └── lidar.md
│ ├── Single_board_computer
│ │ ├── Jetsonnano.md
│ │ ├── Raspberrypi.md
│ │ └── images
│ │ │ ├── GPIO-diagram-Raspberry-Pi-4.png
│ │ │ ├── Jetson.png
│ │ │ ├── boardlayoutraspberrypi.webp
│ │ │ ├── img1.webp
│ │ │ ├── img2.webp
│ │ │ ├── img3.webp
│ │ │ ├── img4.webp
│ │ │ ├── img5.png
│ │ │ ├── img6.jpeg
│ │ │ ├── jet1.png
│ │ │ ├── jet2.png
│ │ │ ├── ras1.png
│ │ │ ├── ras10.png
│ │ │ ├── ras11.png
│ │ │ ├── ras12.png
│ │ │ ├── ras13.png
│ │ │ ├── ras14.png
│ │ │ ├── ras15.png
│ │ │ ├── ras16.png
│ │ │ ├── ras17.png
│ │ │ ├── ras18.png
│ │ │ ├── ras19.png
│ │ │ ├── ras2.png
│ │ │ ├── ras20.png
│ │ │ ├── ras3.png
│ │ │ ├── ras4.png
│ │ │ ├── ras5.png
│ │ │ ├── ras6.png
│ │ │ ├── ras7.png
│ │ │ ├── ras8.png
│ │ │ ├── ras9.png
│ │ │ ├── raspberrypi.png
│ │ │ └── thumbnail-1.jpeg
│ └── intro.md
├── images
│ ├── RISC Logo Dark Blue.png
│ ├── Spaceship (3).png
│ └── logo.png
├── index.md
├── javascripts
│ └── config.js
├── mechanical
│ ├── Forward and Inverse Kinematics.md
│ ├── Gears.md
│ ├── Introduction to Dynamics.md
│ ├── Joint Kinematics.md
│ ├── drive_mechanism.md
│ ├── images
│ │ ├── Inverse_Kinematics.jpg
│ │ ├── dh_parameters.jpg
│ │ ├── drive0.png
│ │ ├── drive1.png
│ │ ├── drive2.jpg
│ │ ├── drive3.png
│ │ ├── drive4.png
│ │ ├── forward_kinematics.jpg
│ │ ├── gears1.png
│ │ ├── gears10.png
│ │ ├── gears2.png
│ │ ├── gears3.png
│ │ ├── gears4.png
│ │ ├── gears5.png
│ │ ├── gears6.png
│ │ ├── gears7.png
│ │ ├── gears8.png
│ │ ├── gears9.png
│ │ ├── link_1.png
│ │ ├── link_2.png
│ │ ├── spurgear.jpg
│ │ └── why_ik.png
│ ├── intro.md
│ └── position and orientation.md
└── roadmap.md
└── mkdocs.yml
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 RISC - IIT Bhubaneswar
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |

3 | RISC Handbook
4 |
5 | Robotics is actively engaged in the expanding problems of new developing sectors as it strives to reach the human frontier. The new generation of robots will increasingly interact, explore, and collaborate with humans, affecting people and their lives.
6 |
7 | The scientific endeavour of a half-century of robotic discoveries that created robotics as a contemporary scientific subject has resulted in the credible prospect of practical robots among humans. The field’s vibrant expansion and robust growth over the previous decade has spurred our desire to innovate.
8 |
9 | This handbook has been compiled to help you get started in this field.
10 |
11 | You can access this book **[here](https://risc-iitbbs.github.io/risc-handbook/)** 🔗
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/about.md:
--------------------------------------------------------------------------------
1 | # About Us
2 |
3 | The Robotics and Intelligent Systems Club [[RISC](https://github.com/RISC-IITBBS)], IIT Bhubaneswar is a group of robotics and technology enthusiasts who explore the world of technology, learn and make projects based on Robotics, Internet of Things (IoT), Machine Learning, Computer Simulations, etc. RISC is home to many of institutes robotics enthusiasts who spend a great chunk of their time in designing and prototyping robots which can perform any required task. RISC provides a platform for students to explore and learn about modern technology.
4 |
5 | We also organize regular workshops to inspire students across varied technical backgrounds to develop their ideas and expose them to the wonders of robotics. We are open to anyone with a general interest in engineering and who wants to explore robotics, so feel free to get in touch with us.
6 |
7 | The motto of this society is to encourage and guide the members to learn newer technologies and make projects through which they get experience to solve real-life problems, possibly establishing a foundation for the ones who are looking at robotics as a career.
8 | This handbook is part of an effort to provide an organised set of learning resources to make it easy for anyone to get started with the field of robotics.
9 |
10 | Robotics is a highly broad field that is expanding quickly while investigating novel and unusual ideas. Our current efforts are concentrated on adding more pertinent data and resources to the handbook, which now only contains topics relating to basic robotics. Any contributions or ideas you may have that could help us enhance or add new information to the manual are welcome and appreciated. Please don't hesitate to submit a [issue](https://github.com/RISC-IITBBS/risc-handbook/issues) or a [PR](https://github.com/RISC-IITBBS/risc-handbook/pulls) to the repository.
11 |
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/Control_Theory.md:
--------------------------------------------------------------------------------
1 | # Control Theory
2 |
3 | A robot can exhibit a number of different behaviors, depending on the task and its environment. It can act as a source of programmed motions for tasks such as moving an object from one place to another or tracing a trajectory. It can act as a source of forces, as when applying a polishing wheel to a workpiece. In tasks such as writing on a chalkboard, it must control forces in some directions (the force must press the chalk against the board) and motions in others (the motion must be in the plane of the board). When the purpose of the robot is to act as a haptic display, rendering a virtual environment, we may want it to act like a spring, damper, or mass, yielding in response to forces applied to it.
4 |
5 | In each of these cases, it is the job of the robot controller to convert the task specification to forces and torques at the actuators. Control strategies that achieve the behaviors described above are known as **motion control**, **force control**, **hybrid motion-force control**, or **impedance control**.
6 |
7 | 
8 |
9 | A typical control block diagram is shown above The sensors are typically: potentiometers, encoders, or resolvers for joint position and angle sensing; tachometers for joint velocity sensing; joint force-torque sensors; and/or multi-axis force-torque sensors.
10 |
11 | ## Types of control systems
12 |
13 | ### Open Loop control system
14 |
15 | A control system in which the control action is totally independent of output of the system then it is called **open loop control system**. A manual control system is also an open loop control system. The figure below shows a control system block diagram of an open loop control system in which process output is totally independent of the controller action.
16 |
17 | 
18 |
19 | **Practical examples of Open loop control system:**
20 |
21 | 1. Electric Hand Drier – Hot air (output) comes out as long as you keep your hand under the machine, irrespective of how much your hand is dried.
22 | 2. Automatic Washing Machine – This machine runs according to the pre-set time irrespective of washing is completed or not.
23 | 3. Bread Toaster – This machine runs as per adjusted time irrespective of toasting is completed or not.
24 |
25 | ### Closed Loop control system
26 |
27 | Control system in which the output has an effect on the input quantity in such a manner that the input quantity will adjust itself based on the output generated is called **closed loop control system**. **Open loop control system** can be converted in to closed loop control system by providing a feedback. Figure below shows the block diagram of closed loop control system in which feedback is taken from output and fed in to input.
28 |
29 | 
30 |
31 | **Practical example of Closed loop control system:**
32 |
33 | 1. Missile Launched and Auto Tracked by Radar – The direction of missile is controlled by comparing the target and position of the missile.
34 | 2. An Air Conditioner – An air conditioner functions depending upon the temperature of the room.
35 | 3. Cooling System in Car – It operates depending upon the temperature which it controls.
36 |
37 | ## Core topics in Control Theory
38 |
39 | Before we design any controller, we have to consider the key factors that will drive the robot and how are we supposed to build the controller that will drive us to the best results which are also known as **control objectives**. These factors are listed below:
40 |
41 | 1.**Stability :** By this, we mean to measure the level of stability in the signal which will drive the object and also keep a check on the fluctuation of the signal. For eg. if we are making a cruise controller for a car, then the controller should give a stable signal after the car has reached the cruising speed and the speed should remain constant (no fluctuations).
42 |
43 | 2.**Tracking :** It is necessary to give controls after analyzing the response given due to the input signal. For instance, in a cruise controller, after setting up cruising speed, it is necessary for the controller to keep a regular check on the speed by which it can decide whether to accelerate or retard.
44 |
45 | 3.**Robustness :** Robust control systems often incorporate advanced topologies which include multiple feedback loops and feed-forward paths. The control laws may be represented by high order transfer functions required to simultaneously accomplish desired disturbance rejection performance with robust closed loop operation. For example, the controller should not be hard coded to function only for a certain velocity ,say 50 miles/hour if designing a cruise control.
46 |
47 | 4.**Disturbance :** It refers to the noise (not useful signal) that the controller might signal while sending or any sort of attenuation that can happen. It actually depends on the quality of instruments used in making a controller and also due to some external factors.
48 |
49 | 5.**Optimality :** It is a set of differential equations that describe the paths of the control variables that minimize the cost function.
50 |
51 | ## Laplace transform
52 |
53 | The Laplace transform plays a important role in control theory. It appears in the description of linear time invariant systems, where it changes convolution operators into multiplication operators and allows to define the transfer function of a system. The properties of systems can be then translated into properties of the transfer function. It allows the use of graphical methods to predict system performance without solving the differential equations of the system. These include response, steady state behavior, and transient behavior.
54 |
55 | ### Laplace Vs Fourier transform
56 |
57 | Laplace transform:
58 | $F(s)=\int_{0}^{\infty}f(t)e^{-st}dt \qquad f^{'}(t)\Rightarrow sF(s)$
59 | Fourier transform:
60 | $F(\omega) = \int_{-\infty}^{\infty}f(t)e^{-j\omega t}dt$
61 | Laplace transforms often depend on the initial value of the function whereas Fourier transforms are independent of the initial value. The transforms are only the same if the function is the same both sides of the y-axis (so the unit step function is different).
62 |
63 | To understand Laplace transform in detail read [this](https://www.electrical4u.com/laplace-transformation/) article
64 |
65 | ## Closed Loop Transfer Function
66 |
67 | A **closed-loop transfer function** in control theory is a mathematical expression describing the net result of the effects of a closed feedback loop on the input signal to the circuits enclosed by the loop.
68 |
69 | 
70 |
71 | Where: block G represents the open-loop gains of the controller or system and is the forward path, and block H represents the gain of the sensor, transducer or measurement system in the feedback path.
72 |
73 | To find the transfer function of the closed-loop system above, we must first calculate the output signal θo in terms of the input signal θi. To do so, we can easily write the equations of the given block-diagram as follows.
74 |
75 | The output from the system is equal to: Output = G x Error
76 |
77 | Note that the error signal, θe is also the input to the feed-forward block: G
78 |
79 | The output from the summing point is equal to: Error = Input - H x Output
80 |
81 | If H = 1 (unity feedback) then:
82 |
83 | The output from the summing point will be: Error (θe) = Input - Output
84 |
85 | Eliminating the error term, then:
86 |
87 | The output is equal to: Output = G x (Input - H x Output)
88 |
89 | Therefore: G x Input = Output + G x H x Output
90 |
91 | Rearranging the above gives us the closed-loop transfer function of:
92 |
93 | 
94 |
95 | ## Controllability
96 |
97 | 
98 |
99 | 
100 |
101 | ## Types of Feedback Control
102 |
103 | ### Positive Feedback
104 |
105 | In a “positive feedback control system”, the set point and output values are added together by the controller as the feedback is “in-phase” with the input. The effect of positive (or regenerative) feedback is to “increase” the systems gain, i.e, the overall gain with positive feedback applied will be greater than the gain without feedback]
106 |
107 | ### Negative Feedback
108 |
109 | In a “negative feedback control system”, the set point and output values are subtracted from each other as the feedback is “out-of-phase” with the original input. The effect of negative (or degenerative) feedback is to “reduce” the gain. As a rule negative feedback systems are more stable than positive feedback systems. Negative feedback also makes systems more immune to random variations in component values and inputs.
110 |
111 | 
112 |
113 | To know more about different types of control systems you can read [this](https://www.electrical4u.com/types-of-systems-linear-and-non-linear-system/) article.
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/LQR.md:
--------------------------------------------------------------------------------
1 | # Linear-Quadratic Regulator(LQR) Controller
2 |
3 | The theory of optimal control is concerned with operating a dynamic system at minimum cost. The case where the system dynamics are described by a set of linear differential equations and the cost is described by a quadratic function is called the LQ problem. One of the main results in the theory is that the solution is provided by the **linear–quadratic regulator** (**LQR**).
4 |
5 | The settings of a (regulating) controller governing either a machine or process (like an airplane or chemical reactor) are found by using a mathematical algorithm that minimizes a cost function with weighting factors needed to be supplied. A **cost function** is a function that maps an event or values of one or more variables onto a real number intuitively representing some "cost" associated with the event. The cost function is often defined as a sum of the deviations of key measurements, like altitude or process temperature, from their desired values. The algorithm thus finds those controller settings that minimize undesired deviations. The magnitude of the control action itself may also be included in the cost function.
6 |
7 | ## Finite horizon LQR
8 |
9 | For a continuous-time linear system, defined on $t \epsilon [t_0,t_1]$ , described by:
10 | $\dot{x} = Ax + Bu$
11 |
12 | with a quadratic cost function defined as:
13 | $J = x^T (t_1)F(t_1)x(t_1) + \int_{t_0}^{t_1} (x^TQx + u^TRu + 2x^TNu) \,dt$
14 | the feedback control law that minimizes the value of the cost is:
15 | $u = -Kx$
16 | where K is given by:
17 | $K = R^{-1}(B^TP(t) + N^t)$
18 | and P is found by solving the continuous time [Riccati differential equation](https://en.wikipedia.org/wiki/Riccati_differential_equation):
19 | $A^TP(t) + P(t)A - (P(t)B+N)R^{-1}(B^TP(t) + N^T) + Q = - \dot{P}(t)$
20 | with the boundary condition:
21 | $P(t_1)=F(t_1)$
22 |
23 | To learn more in detail about LQR controller watch [this](https://www.youtube.com/watch?v=1_UobILf3cc&list=RDCMUCm5mt-A4w61lknZ9lCsZtBw&start_radio=1&t=7) video by Steve Brunton
24 |
25 | ## Linear Quadratic Gaussian (LQG) control theory
26 |
27 | Here, Given a linear model of the plant in a statespace description, and assuming that the disturbance and measurement noise are Gaussian stochastic processes with known power spectral densities, the designer translates the design specifications into a quadratic performance criterion consisting of some state variables and control signal inputs. The object of design then is to minimize the performance criterion by using appropriate state or measurement feedback controllers while guaranteeing the closed-loop stability. When LQG controller problem is solved in a deterministic setting, known as an H2 optimal control problem, in which the H2 norm of a certain transfer function from an exogenous disturbance to a pertinent controlled output of a given plant is minimized by appropriate use of an internally stabilizing controller.
28 |
29 | To learn about robust controllers and LQG control problem in detail watch [this](https://www.youtube.com/watch?v=7OZVbqPQ2Zw) video
30 |
31 | **H∞** (i.e. "**H-infinity**") **methods** are used in control theory to synthesize controllers to achieve stabilization with guaranteed performance. To use *H*∞ methods, a control designer expresses the control problem as a mathematical optimization problem and then finds the controller that solves this optimization. *H*∞ techniques have the advantage over classical control techniques in that *H*∞ techniques are readily applicable to problems involving multivariate systems with cross-coupling between channels.
32 |
33 |
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/MPC.md:
--------------------------------------------------------------------------------
1 | # Model Based Controllers
2 |
3 | Model-based control uses information about the dynamics of the system's structure and its behavior in time to obtain a better control result regarding stability and performance of the controlled system. Take the following simple example:
4 |
5 | Let $\frac{d^2x}{dt^2}= f(x)+u$
6 |
7 | be the system to be controlled, where x - state vector, f(x) - nonlinear vector function, u - control vector. Suppose we have some estimation est(x) than we use a control law like
8 | $u = -est(x)+u_{st}$
9 | where ust be some maybe linear PID control law
10 | $u_{st} = K_px + K_d\frac{dx}{dt} + K_i\int xdt$
11 | So we get
12 | $\frac{d^2x}{dt^2} = \Delta f + K_px + K_d\frac{dx}{dt} + K_i\int xdt$
13 | where
14 | $\Delta f =f(x) - est(x)$
15 | If the model uncertainties are small enough we get a linear system with a disturbance Delta f which can be stabilized using appropriate control gains Kp, Kd, KI. Above given is just an example of model based controller in real life model based controller are way more complex than this.
16 |
17 | **Model Predictive Control(MPC)** is the most widely known model based controller. Model Predictive Controllers rely on the dynamic models of the process, most often linear empirical models obtained by system identification.
18 |
19 | Model predictive control offers several important advantages:
20 |
21 | (1) the process model captures the dynamic and static interactions between input, output, and disturbance variables,
22 |
23 | (2) constraints on inputs and outputs are considered in a systematic manner,
24 |
25 | (3) the control calculations can be coordinated with the calculation of optimum set points, and
26 |
27 | (4) accurate model predictions can provide early warnings of potential problems.
28 |
29 | The mathematics and concepts involved in MPC are a bit complex and require a decent understanding of mathematics of control theory.
30 |
31 | To study more about MPC controller read [this](http://folk.ntnu.no/skoge/vgprosessregulering/papers-pensum/seborg-c20ModelPredictiveControl.pdf) material by NTNU
32 |
33 | You can also check [this](https://www.youtube.com/watch?v=YwodGM2eoy4) video by Steve Brunton to get a more detailed idea
34 |
35 | Some of the other resources you should check to understand control theory and various controllers in more detail are:
36 |
37 | * Control Bootcamp [playlist](https://www.youtube.com/playlist?list=PLMrJAkhIeNNR20Mz-VpzgfQs5zrYi085m) by Steve Brunton
38 | * Control Systems [Lectures](https://www.youtube.com/user/ControlLectures) by Brian Douglas
39 | * Control of Mobile Robots [course](https://www.my-mooc.com/en/mooc/control-of-mobile-robots/) by Georgia Tech University on Coursera
40 | * Modern Robotics - Mechanical, Planning and Control by Kevin.M.Lynch and Frank.C.Park
41 | * MIT Courseware Control Theory [Notes](https://ocw.mit.edu/courses/mechanical-engineering/2-017j-design-of-electromechanical-robotic-systems-fall-2009/lecture-notes/MIT2_017JF09_control.pdf)
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/PID_Controller.md:
--------------------------------------------------------------------------------
1 | ## Linear Control Techniques
2 |
3 | Linear Control technique is the most widely used technique for designing control systems in robotics because of its simple implementation when your system is operating in vicinity of a particular point. Some of the common linear control system design techniques, includes the well-known PID control, H2 and H$\infty$ optimal control, linear quadratic regulator (LQR) with loop transfer recovery design (LTR) , and some newly developed design techniques, such as the robust and perfect tracking (RPT) method.
4 |
5 | ## PID Controller
6 |
7 | PID control is the most popular technique used in industries because it is relatively easy and simple to design and implement. Most importantly, it works in most practical situations, although its performance is somewhat limited owing to its restricted structure.
8 |
9 | 
10 |
11 | Hence, a PID control law has the following general form for the input command:
12 | $u(t) = K~p~e(t) + K~i~\int e(t) + K~d~\frac{de(t)}{dt}$
13 | where $e = q - q~d~$ is the error signal, and $K~p~, K~i~$ and $K~d~$ are positive constant gains associated with proportional, integral, and derivative controllers.
14 |
15 | Consider the control system , in which G(s) is the plant to be controlled and K(s) is the PID controller, it can be characterized by the following transfer function:
16 | $K(s) = K~p~(1+\frac{1}{Tis}+Tds)$
17 | The control system design is then to determine the parameters Kp , Ti and Td such that the resulting dosed-loop system yields a certain desired performance, i.e. it meets certain prescribed design specifications.
18 |
19 | ### Proportional factor
20 |
21 | The proportional factor is easiest to understand: The output of the proportional factor is the product of gain and measured error ε. Hence, larger proportional gain or error makes for greater output from the proportional factor. Setting the proportional gain too high causes a controller to repeatedly overshoot the setpoint, leading to oscillation.
22 |
23 | The downside to a proportional-only loop is that when error becomes too small, loop output becomes negligible. Therefore, even when the proportional loop reaches steady state, there is still error. The larger the proportional gain, the smaller the steady state error — but the larger the proportional gain, the more likely the loop is to become unstable. This dilemma leads to inevitable steady-state error called *offset*.
24 |
25 | 
26 |
27 | ### Integral Factor
28 |
29 | The main function of an integral control is to eliminate the steady state error and make the system follow the set point at steady state conditions. The integral controller leads to an increasing control command for a positive error, and a decreasing control command for a negative error. The downside to the integral factor is that it strongly contributes to controller output overshoot past the target setpoint. The shorter the integral time, the more aggressively the integral works.
30 |
31 | 
32 |
33 | ### Derivative Factor
34 |
35 | The purpose of derivative control is to improve the closed-loop stability of a system. A derivative controller has a predicting action by extrapolating the error using a tangent to the error curve. The derivative factor is the least understood and used of the three factors. In fact, a majority of PID loops in the real world are really just PI loops. A properly used derivative allows for more aggressive proportional and integral factors.
36 |
37 | 
38 |
39 | ## PID Tuning Method
40 |
41 | The determination of corresponding PID parameter values for getting the optimum performance from the process is called tuning. This is obviously a crucial part in case of all closed loop control systems. There are number of tuning methods have been introduced to obtain fast and acceptable performance.
42 |
43 | ### Trial and Error Method
44 |
45 | This is the simple method of tuning a PID controller. Once we get the clear understanding of PID parameters, the trial and error method become relatively easy.
46 |
47 | - Set integral and derivative terms to zero first and then increase the proportional gain until the output of the control loop oscillates at a constant rate. This increase of proportional gain should be in such that response the system becomes faster provided it should not make system unstable.
48 | - Once the P-response is fast enough, set the integral term, so that the oscillations will be gradually reduced. Change this I-value until the steady state error is reduced, but it may increase overshoot.
49 | - Once P and I parameters have been set to a desired values with minimal steady state error, increase the derivative gain until the system reacts quickly to its set point. Increasing derivative term decreases the overshoot of the controller response.
50 |
51 | ### Zeigler-Nichols Method
52 |
53 | It is another popular method for tuning PID controllers. Ziegler and Nichols presented two classical methods for determining values of proportional gain, integral time and derivative time based on transient response characteristics of a given plant or system.
54 |
55 | #### First Method
56 |
57 | - Obtain a unit step response of the plant experimentally and it may look‘s’ shaped curve as shown in figure below. This method applies, if obtained response exhibit s-shaped curve for unit step input otherwise it cannot be applied. This curve can also be obtained by dynamic simulation of the plant.
58 |
59 | 
60 |
61 | - Obtain two constants, delay time L and time constant T by drawing a tangent line at the inflection point of the s-shaped curve.
62 | - Set the parameters of Kp, Ti , and Td values from the table given below for three types of controllers.
63 |
64 | 
65 |
66 | #### Second Method
67 |
68 | - It is very similar to the trial and error method where integral and derivative terms are set to the zero, i.e., making Ti infinity and Td zero.
69 | - Increase the proportional gain such that the output exhibits sustained oscillations. If the system does not produce sustained oscillations then this method cannot be applied. The gain at which sustained oscillations produced is called as critical gain.
70 |
71 | 
72 |
73 | - Once the sustain oscillations are produced, set the values of Ti and Td as per the given table for P, PI and PID controllers based on critical gain and critical period.
74 |
75 | 
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/Change_with_Kd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/Change_with_Kd.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/Change_with_Ki.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/Change_with_Ki.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/PID_varyingP.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/PID_varyingP.jpg
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/Pid.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/Pid.jpg
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/controlablity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/controlablity.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/controlablity_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/controlablity_1.jpg
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/controller.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/controller.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/controller_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/controller_1.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/controller_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/controller_2.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/controller_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/controller_4.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/controller_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/controller_5.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/derivative.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/derivative.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/integral.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/integral.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/propotional.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/propotional.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/tuning_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/tuning_1.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/tuning_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/tuning_2.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/tuning_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/tuning_3.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/tuning_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/tuning_4.png
--------------------------------------------------------------------------------
/docs/automation/ControlTheory/images/whatis-feedback_loop_mobile.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ControlTheory/images/whatis-feedback_loop_mobile.jpg
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/APF.md:
--------------------------------------------------------------------------------
1 | # Artificial Potential Field Algorithm for Path Planning
2 |
3 | Over the past few years, research into using robots to reduce human labour has increased. Robotics has emerged as a new field for the benefit of people, from employing mobile robots for military operations on land and underwater to using them in restaurants to prepare food for patrons. Unmanned vehicle course planning and obstacle identification while limiting input energy and obtaining the best outcomes, however, is a significant challenge. The question of how to employ various methods to develop an obstacle distribution model and how to attain the required outcomes while making a few assumptions in a real-world system has been the subject of some recent literary works.
4 |
5 | One of the most fundamental and often used algorithms for such a situation is the potential field algorithm. In accordance with the literature sources studied and the outcomes of the experiment done, this paper will provide a quick review of how various algorithms can be employed for path planning reasons as well as how the potential field algorithm aids in obstacle detection.
6 |
7 | ## Working principle of Potential Field Algorithm
8 |
9 | Any physical field that complies with Laplace's equation is a potential field. Electromagnetic, gravitational, and electrical fields are a few typical examples of potential fields. To control a robot's movement within a given area, a potential field algorithm makes use of the artificial potential field. We simplify the division of a space into a grid of cells with obstacles and a goal node.
10 |
11 | The potential field functions, which will be discussed further in the explanation, are used by the algorithm to assign an artificial potential field to every point on earth. From the highest potential to the lowest potential, the robot simulates. In this case, the starting node will have the highest potential while the goal node has the lowest potential. Since the UAV moves from lowest to highest potential, we can say that.
12 |
13 | ## Types Of Potential Fields
14 |
15 | Two kinds of artificial potential fields are generated within the system: Attractive field and Repulsive fields.
16 |
17 | 
18 |
19 | The goal node exhibits an attractive field while the obstacles in the system produce repulsive fields.
20 |
21 | Force of repulsion is inversely proportional to Distance from the robot to obstacles.
22 |
23 | Hence, the generated total force at each point of the graph is:
24 |
25 | U(total) = U(attraction) + U(repulsion)
26 |
27 | #### Attractive Fields
28 | The following function can be used for generating the force generated by the goal node. Here, x and y are the coordinates of the starting node, (xgoal,ygoal) are the coordinates of the goal node and C is a constant.
29 |
30 | 
31 |
32 | #### Repulsive Fields
33 |
34 | Two kinds of repulsive forces are produced within the system:
35 |
36 | **1. Repulsive forces by the boundaries:**
37 | This force remains uniform throughout the system and hence, doesn’t affect the calculations; this force is useful in keeping the robot away from the boundaries. The following equation can be used to find the repulsive forces exhibited by the boundaries:
38 |
39 | 
40 |
41 | where gi is a linear function that represents the boundary of the convex region, δ is a constant number with a small value and s is the number of boundary face segments.
42 |
43 | **2. Repulsive forces by the obstacles:**
44 | The force of repulsion from obstacles can be calculated through the formula given below. Here, pmax is the highest potential, (x0,y0) are the coordinates of the center of an obstacle and l is the side length of the obstacle:
45 |
46 | 
47 |
48 | Hence, the resultant force on the environment is:
49 | P = Po + P(goal) where, Po = max{Pi}
50 |
51 | #### Local Minima Trap
52 |
53 | The local minima trap problem is a problem for potential field algorithms. This happens when all artificial forces—both attracting and repulsive—are balanced out, as happens, for example, when an obstacle is directly in the path of the UAV or when there are many impediments close together. This problem can be solved in a number of ways. The solution method we employ here introduces a fictitious barrier in the vicinity of the local minima to deter the migrating object.
54 |
55 | 
56 |
57 | #### Pseudo Code for Algorithm
58 |
59 | ```
60 | t=0,xc(0)=xstart,Flag = 0, calculate the potential function
61 | while Next decision is not goal do
62 | if Flag = 0 then
63 | Go to the next position with lowest potential
64 | else if Flag =1 then
65 | Change the cell weight and treat the cells as occupied by an obstacle
66 | Update the potential of each cell.
67 | end
68 | end
69 | if the bot is trapped in a cell or visits the same place multiple times then
70 | Flag =1,
71 | searchfor the trapping points/points
72 | end
73 | if the bot flees from the local minima then
74 | Flag = 0,
75 | end
76 | X t+! <- cell nearby with lowest potential function
77 | t <- t+1
78 | end
79 | ```
80 | #### Time Complexity of the Algorithm
81 |
82 | Evaluation of forces in the configuration space is a requirement of potential field algorithms, and the complexity of these algorithms is frequently O(MD), where M is the total number of nodes in the computation space and D is the dimension of the space. Robot path planning is a good example of this algorithm in use.
83 |
84 | ### References
85 | [CS765 McGill University Notes](https://www.cs.mcgill.ca/~hsafad/robotics/)
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/Astar.md:
--------------------------------------------------------------------------------
1 | # A-Star Algorithm
2 | A-star is a graph-based, path search algorithm. It is used in many fields of computer science as a search algorithm. It is often used due to its completeness, optimality, and optimal efficiency.
3 | ### Salient Features of the Algorithm
4 | 1. **Resolution complete** and **Resolution optimal** : The algorithm finds the optimal solution to the given problem at a chosen discretization, if one exits.
5 | 2. A-Star uses a **hueristic** to estimate the total cost of a solution constrained to pass through a state. Thus, it searches in order of decreasing solution quality and is *optimally efficient*.
6 | 3. Any other optimal algorithm using the same hueristic will expand at least as many vertices as A-Star.
7 | ### Idea of Hueristics Functions
8 | - Hueristic functions are used to map every node in the graph to a *non-negative* value.
9 | - #### Criteria for Hueristics Functions
10 | - Should be a _monotonic function_
11 | - Should satisfy $H(goal) = 0$
12 | - For any two adjacent nodes $x$ and $y$:
13 | - $H(x, y) \leq H(y) + d(x, y)$
14 | - $d(x, y) = EdgeCost(x, y)$
15 | - These properties ensure that for all nodes $n$:
16 | - $H(n) \leq length of Shortest Path(n, GOAL)$
17 | - #### For path Planning on a grid:
18 | - **Euclidean Distance:**
19 | $H(x_n, y_n) = \sqrt{(x_n-x_g)^2 + (y_n-y_g)^2}$
20 | - **Manhattan Distance:**
21 | $H(x_n, y_n) = \lvert(x_n - x_g) + (y_n - y_g)\rvert$
22 |
23 | Where $x_n$, $y_n$ and $x_g$, $y_g$ are the $x$, $y$ coordinates of a the node and the goal respectively.
24 | ### Psuedo Code for the Algorithm
25 | ```python
26 | def Astar(start, goal, graph):
27 | # Set the g, f values for all nodes in the graph
28 | for node in graph:
29 | node.f = Infinity
30 | node.g = Infinity
31 |
32 | # Create an empty list to store visited nodes
33 | nodes = []
34 |
35 | # Add Start to nodes list
36 | nodes.add(start)
37 |
38 | # Loop to traverse the graph
39 | while nodes is not EMPTY:
40 | # Obtain bode with the least f-value
41 | CURRENT = argmin(node, criteria=node.f)
42 |
43 | # Check if current node is the goal Node
44 | # which means the graph has been completely traversed
45 | if CURRENT == goal:
46 | report "SUCCESS"
47 | break
48 | # Update parameters for adjacent nodes
49 | for adjacent_node in CURRENT.adjacent_nodes:
50 | if adjacent_node.g > CURRENT.g + cost of edge from n to current:
51 | adjacent_node.g = CURRENT.g + cost of edge from n to current
52 | adjacent_node.f = adjacent_node.g + H(node)
53 | adjacent_node.parent = CURRENT
54 |
55 | # Add the adjacent node to nodes list if not there already
56 | if adjacent_node not in nodes:
57 | nodes.add(adjacent_node)
58 | ```
59 | **Notations in the Psuedo Code explained**:
60 | ```
61 | g-value = distance between a node and the start node
62 | H-function = Hueristic funciton
63 | f-value = g-value + Hueristic value of the node
64 | ```
65 |
66 | ### References
67 | * [Original paper](https://ieeexplore.ieee.org/document/4082128) on A-Star path planning algorithm.
68 | * [Psuedo Code](https://mat.uab.cat/~alseda/MasterOpt/AStar-Algorithm.pdf)
69 | * [A-star Youtube Video](https://www.youtube.com/watch?v=5n8OtzqVOyg)
70 |
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/Dijkstra.md:
--------------------------------------------------------------------------------
1 | # Dijkstra's Algorithm
2 | Dijkstra's Algorithm is an algorithm for finding the shortest path between one source node and all the other nodes in a graph, thereby producing a `shortest-path-tree`.
3 | ### Psuedo Code
4 | ```python
5 | # Set the distances if all nodes in the graph to infinty
6 | for node in graph:
7 | node.distance = INFINITY
8 |
9 | # Create an empty list
10 | nodes = []
11 |
12 | # Set the start distance to ZERO
13 | START.distance = 0
14 |
15 | # Add start to the list
16 | nodes.add(START)
17 |
18 | # Loop to update distances
19 | while nodes is not empty:
20 | CURRENT = argmin(node, criteria=node.distance)
21 |
22 | if CURRENT == GOAL:
23 | report "Success"
24 | break
25 |
26 | for adjacent_node in CURRENT.adjacent_nodes:
27 | if adjacent_node.distance > CURRENT.distance + cost of edge from CURRENT to adjacent_node:
28 | adjacent_node.distance = CURRENT.distance + cost of edge from CURRENT to adjacent_node
29 | adjacent_node.parent = CURRENT
30 |
31 | # Add adjacent_node to the list, if it is not already present
32 | if adjacent_node not in nodes:
33 | nodes.add(adjacent_node)
34 | ```
35 | ### References
36 | * [Psuedo Code for Dijkstra's Algorithm](http://www.gitta.info/Accessibiliti/en/html/Dijkstra_learningObject1.html)
37 | * [Dijkstra's Algorithm Youtube Video](https://www.youtube.com/watch?v=GazC3A4OQTE)
38 |
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/GA.md:
--------------------------------------------------------------------------------
1 | # Genetic Algorithm
2 |
3 | The class of evolutionary algorithms that includes genetic algorithms was largely influenced by biological evolution. We are all aware of the basic principles of biological evolution, which include the choice of parents, reproduction, and offspring mutation. To produce offspring that are biologically superior to their parents is the primary goal of evolution. A genetic algorithm attempts to imitate Darwin's Theory of Evolution by Natural Selection. It is based primarily on this theory.
4 |
5 | The basic idea is to choose the population's best individuals to serve as parents, then ask them to increase the size of their generation by reproducing and bearing children. However, when genes from both parents cross over during reproduction, this can result in mutations, which are errors that can occur. The process continues, resulting in a healthier generation as these kids are asked to reproduce their babies once more. Evolutionary computation has been used to solve a variety of computational issues, including the traditional knapsack problem, feature selection, and optimization issues.
6 |
7 | ## Steps in Genetic Algorithm
8 |
9 | 1. Genetic Representation(Encoding of Chromosomes)
10 | 2. Representation of the Environment
11 | 3. Initialization of Population
12 | 4. Fitness Function
13 | 5. Selection Operator
14 | 6. Crossover Operator
15 | 7. Mutation Operator
16 |
17 | 
18 |
19 | In a genetic algorithm, a population of potential solutions to an optimization problem (referred to as individuals, animals, or phenotypes) evolves toward superior solutions. Traditionally, solutions are represented in binary as strings of 0s and 1s, although other encodings are also feasible. Each candidate solution has a set of properties (its chromosomes or genotype) that can be changed and modified.
20 |
21 | ### The Genetic Representation (Encoding of chromosomes)
22 | Genetic coding of potential members of the original population is necessary for the application of genetic algorithms to a particular problem. The most popular type of encoding employed in GAs was binary. Depending on the issue at hand, many encoding techniques can be employed.
23 | The selection of a coding method is crucial for the success of the behaviour of the GAs because the fitness function and genetic operators have an impact on this coding. The pathways (Positions set) that connect two known positions are potential solutions to the path planning problem (starting point and a target point). This path's nodes must be genuine, that is, they must not correspond to any obstruction.
24 |
25 | ### Representation of the Environment
26 |
27 | We can apply the occupancy grid presentation in which the robot environment is represented by 2D matrix,in which each position (x, y) in the grid has
28 | two likely values: 0 for free cells, and 1 for occupied ones. An appropriate solution is a path (set of
29 | positions) from the starting point to the goal point crossing a set of free positions.
30 |
31 | 
32 |
33 | ### Initialization of Population
34 | As GA begins its searching process for the optimal path by acting on the initial population which is as set of potential candidates, the initialization method is a very important step since it alters
35 | the efficiency of the GA. Hence the choice of an efficient initial population method enhances the GA search
36 | effectiveness.
37 |
38 | ### Fitness Function
39 | Once the initial population has been established, the GA must assess each member's performance using an adaptive function that gives each potential solution a fitness value that reflects its calibre. The FF must take into account a number of factors, including distance, safety, smoothness, etc. The challenge of defining an appropriate fitness function is vital since the GA uses the data produced by this function to select people for reproduction, mutation, and to select the optimal outcome in the final analysis.Population based on its level of fitness. Four factors need to be considered when the suggested. Path length, Safety First Level (SFL), Safety Second Level (SSL), and energy make up the fitness function.
40 | 
41 | 
42 |
43 | ### Selection Operator
44 | The selection operator's primary goal is to select people who are highly adaptable for the following generation. The performance of GA is significantly impacted by the selection pressure, which is a crucial requirement [13]. If there is strong selection pressure, the GA converges. A low selection pressure results in random solutions, and fast without fully utilising the search space. In our elitist, which has a high pressure selection, is used to govern the pressure selection in the (TRS) approach.Utilised to give weak chromosomes a chance whereas TRS is used to keep the fittest solutions throughout generations.
45 | To avoid the dominance of the prior generation by choosing individuals from the previous one to reproduce in the present one superior person.
46 |
47 |
48 | ### Crossover Operator
49 | The crossover is used after individuals have been chosen using the selection operator.
50 | "Crossover" is a genetic operator that combines the genes from the two chosen chromosomes (parents) to produce new chromosomes (offspring/child), maintain the population's heterogeneity, and increase the fitness value of potential solutions. Crossover's core tenet is that new chromosomes take the best traits from their parents. The end outcome is a child who does better than both of its parents.
51 | The likelihood of performing a crossover is known as the crossover rate.
52 |
53 | ### Mutation Operator
54 |
55 | A genetic operator called mutation is used to increase diversity and delay the algorithm's premature convergence. Typically, this operator picks a gene at random and replaces it with a new gene that is not already present in the path. However, as stated in random mutation, invalid routes can be produced. Even though a solution is correct prior to the use of the mutation operator, the newly transformed gene may contain a barrier, which causes it to construct an unsuitable path. The mutation operator suggested in this publication is what we use in our study.
56 |
57 | ### References
58 |
59 | * [Github Link](https://github.com/Yaaximus/genetic-algorithm-path-planning)
60 | * [International Journal of Computational Engineering Research](https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.300.5493&rep=rep1&type=pdf)
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/PRM.md:
--------------------------------------------------------------------------------
1 | # Probilistic Roadmap Method
2 |
3 | A network graph of potential routes in a given map based on open and occupied spaces is known as a probabilistic roadmap (PRM). Based on the PRM algorithm parameters, an object generates nodes at random and connects these nodes. Based on the connection distance and the obstacle positions indicated in the Map, nodes are connected. The number of nodes can be altered to suit the complexity of the map and your goal to discover the quickest route. To discover a path free of obstacles from a starting point to an ending point, the PRM method makes use of a network of connected nodes. A path through an environment can be properly planned by adjusting the connection distance and number of nodes attributes.
4 |
5 | The node locations are created at random when creating or changing the PRM class, which may have an impact on your final path after several iterations. When you call update, alter the parameters, or specify Map at the beginning, a selection of nodes is made. The state of the random number generation is needed to be preserved to get consistent results with the same node location.
6 |
7 | ## Disadvantages of PRM
8 |
9 | Although this algorithm is incredibly helpful, it does not always provide the best option. Think about a configuration space where there are several obstacles that are quite close to one another. Assume that there is a very little space between two obstacles. Keep in mind that our system creates nodes at random. As a result, there is extremely little chance of creating nodes between such gaps. If we increase the number of iterations, the algorithm might build nodes in that area.
10 | 
11 |
12 | Though it may seem like it, the problem is not resolved by increasing the number of iterations.
13 | We wouldn't know whether the path doesn't exist or the number of iterations is lower for that environment if the system fails to build a path for such configurations of the space.
14 | This algorithm's only shortcoming is this. In the event of failure, it does not give us a clear image.
15 |
16 | 
17 |
18 | ## Pseudo Code for Algorithm
19 | 
20 | 
21 |
22 | ## References
23 |
24 | * [MATLAB Documentation](https://in.mathworks.com/help/robotics/ug/probabilistic-roadmaps-prm.html)
25 | * [CS CMU paper](https://www.cs.cmu.edu/~motionplanning/papers/sbp_papers/PRM/prmbasic_01.pdf)
26 | * [CS Columbia Notes](https://www.cs.columbia.edu/~allen/F15/NOTES/Probabilisticpath.pdf)
27 |
28 |
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/RRT.md:
--------------------------------------------------------------------------------
1 | # Rapidly Exploring Random Trees
2 |
3 | ### Salient Features
4 | 1. Randomly samples nodes in the Configuration space of the robot to build a tree of valid configurations.
5 | 2. It is **Probabilistically Complete**,having the probability to find a solution _if it exists_. In worst case, time taken to find a solution can be very long (longer than exhaustive search). The probability of finding a solution goes to $1$ as number of sampled nodes goes to $\infty$.
6 | 3. In practise, the algorithm tends to be very effecitve in high dimensional spaces.
7 | 4. There is no gaurantee regarding the optimality of the solution. The path produced my bot the the shortest path.
8 | 5. Post processing of the path generated is required as the path generated is often very unordered or in zig-zag fashion.
9 |
10 | ### Collision Checking Function
11 | One important requirement of sampling algorithms, is the ability to check if a configuration is valid or not. To check if a configuration $X$ is valid in a _configuration free space_ $\mathbb{C}$, a function as such can be used:
12 |
13 | $$
14 | CollisionCheck(X) = \begin{cases}
15 | 0 \quad &\text{if} \, X \in \mathbb{C} \\
16 | 1 \quad &\text{if} \, X \notin \mathbb{C}
17 | \end{cases} \\
18 | $$
19 |
20 | ### Psuedo Code
21 | ```python
22 | def RRT(START, GOAL):
23 | TREE = []
24 | TREE.add(START)
25 | DELTA = maximum distance between sampled node and nearest node.
26 | REPEAT n times:
27 | X = generateNewConfiguration()
28 | if X in FREE_SPACE:
29 | for nodes in TREE:
30 | Y = argmin(nodes, criteria=distance)
31 | if DIST(X, Y) < DELTA:
32 | Find a configuration Z that is at DELTA distance along the path from X to Y
33 | if TRAVERSABLE(X, Z):
34 | X.parent = Y
35 | TREE.add(X)
36 | else:
37 | if TRAVERSABLE(X, Y):
38 | X.parent = Y
39 | TREE.add(X)
40 | if X is GOAL:
41 | report "SUCCESS"
42 | break
43 |
44 | ```
45 | ### Notations and Functions used in Psuedo Code:
46 |
47 | - Function used to check if a path is traversable:
48 |
49 | $$
50 | Traversable(X, Y) = \begin{cases}
51 | 1 \quad &\text{if} \, \operatorname{LineJoining}(X, Y) \in \mathbb{C} \\
52 | 0 \quad &\text{if} \, \operatorname{LineJoining}(X, Y) \notin \mathbb{C} \\
53 | \end{cases}
54 | $$
55 |
56 | - In case of Rotations:
57 |
58 | $$
59 | Dist(X, Y) = \min{(\lvert X_n - Y_n \rvert}, \lvert\ 2\pi - \lvert X_n - Y_n \rvert \rvert)
60 | $$
61 |
62 | ### References
63 | 1. Refer [this](https://medium.com/@theclassytim/robotic-path-planning-rrt-and-rrt-212319121378) article for more information about RRT and RRT*
64 | 2. A [video](https://www.youtube.com/watch?v=xAmN8WnltRY) explaining RRT algorithm.
65 | 3. Refer to the paper [here](http://msl.cs.illinois.edu/~lavalle/papers/Lav98c.pdf)
66 |
67 |
68 |
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg1.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg10.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg11.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg12.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg13.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg14.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg15.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg16.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg17.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg2.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg3.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg4.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg5.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg6.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg7.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg8.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/images/pathimg9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/PathPlanners/images/pathimg9.png
--------------------------------------------------------------------------------
/docs/automation/PathPlanners/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction to Path Planning
2 |
3 | In robotics, path planning refers to how a robot should move around in space to accomplish its goals (often just getting from point A to point B without crashing into anything along the way).
4 |
5 | 
6 |
7 | ## Things to consider
8 |
9 | * Spatial reasoning/understanding of robots, as it can have many dimensions in space, obstacles can be complicated.
10 | * Global Planning of the path according to the the given environment.
11 | * Online Local Planning is required to know whether environment is dynamic.
12 | * Besides collision-free, should a path be optimal in time,energy or safety. Computing exact collision free paths is computationally expensive in 3D problem
13 | * Kinematic, dynamic, and temporal reasoning may also be required
14 |
15 | ## Space Representation
16 |
17 | A mapped representation of their surroundings is either given to or implicitly built into robots. This map can be saved as a discrete approximation with chunks of equal or varying sizes (like a grid map) (like a topological map, for example road-maps).Continuous map approximations can be saved by defining inner and outer boundaries as polygons and paths around boundaries as a sequence of real valued points. Although continuous maps have obvious memory advantages, discrete maps are more commonly used in robotic path planning because they map well to graph representations, which have a long history of search and optimization algorithms with simple computation complexity.
18 |
19 | The **occupancy grid** discretizes a space into squares of arbitrary resolution and assigns each square a binary or probabilistic value of full or empty. Grid maps can be optimised for memory by storing them as a k-d tree, with only important boundary information saved at full resolution.
20 |
21 | 
22 |
23 | To account for the fact that robots have physical embodiments that require space within the spatial map, **configuration space** is defined in such a way that the robot is reduced to a point-mass and all obstacles are enlarged by half of the robot's longest extension.
24 |
25 | 
26 |
27 | ## Path Planning algorithms
28 | The problem to find an optimal path has been studied since many decades. There are many algorithms that are `graph-based`, `sampling-based`. Each branch follows a particular approach to solve the path planning problem.
29 |
30 | 
31 |
32 | ### Deliberative
33 |
34 | #### Graph Based Algorithms
35 | Graph-based algorithms search for an optimal path by superimposing a topological graph on a robot's configurational space.
36 |
37 | Some of the notable graph-based algorithms are:
38 |
39 | - _A-Star (A*)_
40 | - _Dynamic A-Star (D*)_
41 | - _Dijkstra's Algorithm_
42 |
43 | **Pros**
44 |
45 | - Resolution Optimal
46 | - Resolution Complete
47 |
48 | **Cons**
49 |
50 | - Time Comlexity
51 | - Discrete States
52 | - Discrete Action Sets
53 | - Holonomicity(Can be controlled with a different modeling. Not implemented in given code.)
54 |
55 | #### Sampling Based Algorithms
56 | Algorithms based on sampling represent the configuration space with a roadmap or construct a tree by randomly sampling states in the configuration space.
57 |
58 | * **Pros**
59 | * **PRM**
60 | - Probalistically Optimal
61 | - Probalistically Complete
62 | - Reasonable Computation Time
63 | * **RRT**
64 | - Probalistically Complete
65 | - Near real time performance.
66 |
67 | * **Cons**
68 | * **PRM**
69 | - Narrow corridor problem
70 | - Roadmap generation not for dynamic environments
71 | - Holonomicity(Can be controlled with a different modeling. Not implemented in given code.)
72 | * **RRT**
73 | - Narrow corridor problem
74 | - Not optimal and voronoi bias
75 | - Practically not complete
76 |
77 | Some of the notable sampling-based algorithms are:
78 |
79 | - _Rapidly exploring Random Tree (RRT)_
80 | - _RRT Star (RRT*)_
81 | - _Probabilistic Roadmap Method (PRM)_
82 |
83 | #### Optimization Based Algorithms
84 | It is a slow gradual process that works by making changes to the making slight and slow changes. Also, makes slight changes to its solutions slowly until getting the best solution.
85 |
86 | **Pros**
87 |
88 | - Probabilistically Complete
89 | - Probabitistically Optimal
90 |
91 | **Cons**
92 |
93 | - Narrow corridor problem
94 | - Computationally Expensive
95 | - Practically not Complete
96 |
97 | One of the notable optimization-based algorithms is:
98 |
99 | - _Genetic Algorithm_
100 |
101 |
102 | ### Reactive
103 |
104 | - **Fuzzy Logic Algorithm**
105 | - **Artificial Potential Fields**
106 |
107 | ## Resources
108 |
109 | - [Github Repository](https://github.com/zhm-real/PathPlanning)
110 | - [Cornell Website](http://correll.cs.colorado.edu/?p=965).
111 | - [Youtube Video](https://www.youtube.com/watch?v=NwwsjVsYTbg).
112 |
--------------------------------------------------------------------------------
/docs/automation/ROS/gettingstartedros.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Robot Operating System
2 |
3 | ## What is ROS?
4 |
5 | ROS (Robot Operating System) is a BSD-licensed system for controlling robotic components from a PC. A ROS system is comprised of a number of independent nodes, each of which communicates with the other nodes using a publish/subscribe messaging model. For example, a particular sensor’s driver might be implemented as a node, which publishes sensor data in a stream of messages. These messages could be consumed by any number of other nodes, including filters, loggers, and also higher-level systems such as guidance, pathfinding, etc.
6 |
7 | ROS is best thought of as a collection of tools and frameworks that make automating robotics projects much easier for someone who is absolutely new to it. Every ROS project has a specific structure that must be followed. It would be your responsibility to fill in the automation code and define how the various components of your code communicate with one another. After that, the underlying ROS framework handles the networking and connectivity.
8 |
9 | *Resources* : [Youtube Tutorials](https://www.youtube.com/watch?v=J1qT85pTW0w&feature=youtu.be)
10 |
11 | A ROS system can be visualized as a graph where all the vertices are nodes and the edges between them are known as topics. In simple terms nodes are programs that perform a particular task and send out/receive data in the form of messages. These messages are exchanged between two nodes over the topic (edge) connecting them.
12 |
13 | ## Why ROS?
14 |
15 | Note that nodes in ROS do not have to be on the same system (multiple computers) or even of the same architecture! You could have a Arduino publishing messages, a laptop subscribing to them, and an Android phone driving motors. This makes ROS really flexible and adaptable to the needs of the user. ROS is also open source, maintained by many people.
16 |
17 | ## Basic Terminologies and Commands
18 |
19 | **Nodes:** A node is an executable file (could be python or C++) which performs a specific task and communicates with other nodes through topics.
20 | 
21 |
22 | **Topics:** Topics and are ways of communication between nodes. They depend from each node (see node definitions). Services rely on a query made by a given node or from terminal, getting a response from the node
23 | offering the service.
24 | ROS messages have to be specially defined for each user defined topic. Apart from the standard message types that come with ROS like string, int32, etc. you can also define your custom message types in ROS for custom uses.
25 |
26 | *Resources* : Go through [ROS wiki on Topics](http://wiki.ros.org/Topics) to know more.
27 |
28 | - Note: A single node can simultaneously act as a subscriber to one topic and a publisher of another topic and a server for one service and the client for another.
29 |
30 | **Packages:** Packages are used to organise all of ROS's coding and software. ROS Nodes, libraries utilised in those codes, message and service definitions, as well as any dependencies, may all be contained in a package. Two files, CMakeLists.txt and package.xml, will be used throughout our workplan once we create the package. There is a separate directory *src* from these files. The code for the package's ROS nodes is stored here (as mentioned before, nodes are nothing but programmes that perform specific tasks). It must be built after the ROS package is created before it can be used.
31 |
32 | *Resources* :
33 |
34 | - Go through catkins method of creating [ROS Packages](http://wiki.ros.org/ROS/Tutorials/CreatingPackage)
35 | - Go through [ROS wiki Package Building Tutorial](http://wiki.ros.org/ROS/Tutorials/BuildingPackages)
36 |
37 |
38 | **Catkin:** Catkin is the build system used for ROS.catkin is the ROS build system: the set of tools that ROS uses to generate executable programs, libraries, scripts, and interfaces that other code can use. If you use C++ to write your ROS code, you need to know a fair bit about catkin. To build packages you must have a catkin workspace where all your projects are contained. You will have to use it to build not only yours but any other packages that may be in your workspace. A catkin workspace or package can be built running either of these two commands : ```catkin_make``` or ```catkin build``` in the root of your catkin workspace.
39 |
40 | *Resources* :
41 |
42 | - [Catkin wiki page](http://wiki.ros.org/catkin/conceptual_overview) and [Catkin conceptual overview](http://wiki.ros.org/catkin/conceptual_overview?distro=indigo) to learn more about catkin.
43 |
44 |
45 | - Note: The command used to build a workspace should be consistent every time; for example, if the workspace was built using ```catkin make``` the first time while initialising it, all subsequent builds should use ```catkin make```. To change the build process in an existing workspace, run the command ```catkin clean```, which will remove everything but the workspace's source space (src folder). The desired command can then be used to rebuild it.
46 |
47 | **Workspace:** A ROS workspace is just a hierarchical directory where all of your linked ROS codes are stored. A workspace has packages, which contain, among other things, the code for nodes. On your computer, you can have numerous workspaces, but you can only work in one at a time.
48 |
49 | *Resources* :
50 |
51 | - [Catkin Workspace Tutorial](http://wiki.ros.org/catkin/Tutorials/create_a_workspace)
52 |
53 | **Colcon:** Colcon is another build system just like catkin. It comes with a vast array of features which can be used to organise your workspace. Similar to catkin, to build a workspace, you need to run ```colcon build``` in the root of the folder your workspace.
54 |
55 | *Resources* :
56 |
57 | - Go through [Colcon documentation](https://colcon.readthedocs.io/en/released/user/quick-start.html) for complete overview.
58 |
59 | **Publisher-Subscriber Model**
60 |
61 | Two nodes can exchange data in the form of messages asynchronously, usually used when a one way stream of information is involved.The object of a ROS node which publishes the data in the form of messages over a topic is called **Publisher**. The rate of publishing of messages can be defined by user. The data published by the publisher of one ROS node can be received through the object of a ROS node called **Subscriber**.
62 |
63 | *Resources* :
64 |
65 | - [Writing Publishers-Subcribers in C++](http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29#roscpp_tutorials.2FTutorials.2FWritingPublisherSubscriber.Writing_the_Publisher_Node)
66 | - [Writing Publishers-Subcribers in Python](http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29#roscpp_tutorials.2FTutorials.2FWritingPublisherSubscriber.Writing_the_Publisher_Node)
67 |
68 | **Client-Server Model**
69 |
70 | Another common mode of communication, especially suited when there is a transaction style relationship between the two nodes is the service - consisting of a *server* and a *client*. The node which sends requests to a server is called **Client**. A special function that acts as a proxy between the client and server can be created. When called, the function sends a request to the server with the arguments passed to it as parameters. The node which constantly monitors for requests from the client is called **Server**.It does the required task independently of the client and returns the response when the task is completed.
71 |
72 | *Resources* :
73 |
74 | - [Writing Client-Service in C++](http://wiki.ros.org/ROS/Tutorials/WritingServiceClient%28c%2B%2B%29)
75 | - [Writing Client-Service in Python](http://wiki.ros.org/ROS/Tutorials/WritingServiceClient%28python%29)
76 |
77 | **ROS Master:** It is a central server to which all nodes are connected by default. It allows any node to look up information about any other node, essentially it is needed for connecting nodes within the system. A node gets the network address of another node from ROS Master.
78 |
79 | **rosrun:** On starting the ROS Master one can now start their own ROS nodes. For this ROS has a special command called rosrun which lets you run the executable files for their own node from anywhere by running following command (replace and appropriately) : -
80 |
81 | ```bash
82 | rosrun .py
83 | ```
84 | **Note** :
85 |
86 | - If using python, before attempting to run any ROS nodes that you have written, make sure that you have given executable permission to the code files. For more info on linux file permission look [here](https://www.guru99.com/file-permissions.html) by running the following command (replace appropriately) : -
87 |
88 | ```bash
89 | chmod u+x .py
90 | ```
91 |
92 | - When one runs ```roscore``` or their own ROS node, the terminal is held until it is terminated. As a result, if you are running many nodes, each one must be run in a different terminal window. In such scenario [terminator](https://terminator-gtk3.readthedocs.io/) comes handy.
93 |
94 |
95 | **roslaunch:** There can be a lot of nodes in a ROS project, and launching them one by one can be a pain. roslaunch is a command that uses launch-files to launch a certain set of nodes all at once in a single terminal. These files usually contain a list of nodes and other related info and are generally stored in the ```launch``` directory inside a package.
96 |
97 | *Resources* :
98 |
99 | - [ROS Launch tutorial](http://wiki.ros.org/roslaunch/Tutorials)
100 |
101 | **roscd:** ```roscd``` is a command line tool which allows you to navigate or ```cd``` (change directory) to (in command line terms) a package without knowing its exact path. Note: The workspace in which the package is present needs to be sourced. E.g. If you wish to navigate into the ```turtlebot3_gazebo``` package you’ll just type the following command in the terminal:
102 |
103 | ```bash
104 | roscd turtlebot3_gazebo
105 | ```
106 |
107 | **rqt_graph:** Once you have your system running, you can obtain a diagram along with other details of the system by running the ```rqt_graph``` command in another terminal window.
108 |
109 | ## General Understandings
110 |
111 | ROS starts with the ROS Master. The Master allows all other ROS pieces of software (Nodes) to find and talk to each other. That way, we do not have to ever specifically state “Send this sensor data to that computer at 127.0.0.1. We can simply tell Node 1 to send messages to Node 2.
112 |
113 | 
114 |
115 | Nodes do this by publishing and subscribing to **Topics**.
116 |
117 |
118 |
119 | Let’s say we have a camera on our Robot. We want to be able to see the images from the camera, both on the Robot itself, and on another laptop.
120 |
121 | **In our example,** we have a Camera Node that takes care of communication with the camera, a Image Processing Node on the robot that process image data, and a Image Display Node that displays images on a screen. To start with, all Nodes have registered with the Master. Think of the Master as a lookup table where all the nodes go to find where exactly to send messages.
122 |
123 | 
124 |
125 | In registering with the ROS Master, the Camera Node states that it will Publish a Topic called /image_data (for example). Both of the other Nodes register that they areSubscribed to the Topic /image_data.
126 |
127 | Thus, once the Camera Node receives some data from the Camera, it sends the /image_data message directly to the other two nodes. (Through what is essentially TCP/IP)
128 |
129 | 
130 |
131 | Now you may be thinking, what if I want the Image Processing Node to request data from the Camera Node at a specific time? To do this, ROS implements Services.
132 |
133 | A Node can register a specific service with the ROS Master, just as it registers its messages. In the below example, the Image Processing Node first requests /image_data, the Camera Node gathers data from the Camera, and then sends the reply.
134 |
135 | 
136 |
137 |
138 | ## ROS Parameters and Parameter Server
139 |
140 | A parameter server is a collection of values or parameters that nodes can retrieve or modify during runtime in response to requests made via command prompt, nodes, or launch files. Parameters are static, globally accessible values such as integers, floats, texts, and boolean values that can be saved separately or within a YAML file. Nodes may readily check the configuration status of the system and make changes if necessary because parameters are supposed to be gloablly accessible.
141 |
142 | ### Accessing and setting Parameters
143 |
144 | #### Via command line
145 | Parameters can be accessed, modified or deleted using the `rosparam` command line utility in the `rosbash` suite of terminal commands.
146 |
147 | 1. To list all the parameters :
148 |
149 | ```bash
150 | rosparam list
151 | ```
152 |
153 | Or to list all the parameters in a specific [namespace](https://www.theconstructsim.com/ros-5-mins-046-ros-namespace/) :
154 |
155 | ```bash
156 | rosparam list
157 | ```
158 |
159 | 2. To assign a value to an already existing parameter or to set a new one :
160 |
161 | ```bash
162 | rosparam set
163 | ```
164 |
165 | Note : You can also load the parameters into the parameter server from a YAML file using
166 |
167 | ```bash
168 | rosparam load
169 | ```
170 |
171 | 3. To get/read a parameter value :
172 |
173 | ```bash
174 | rosparam get
175 | ```
176 |
177 | Note : You can also dump/save the parameters into a YAML file from parameter server using
178 |
179 | ```bash
180 | rosparam dump
181 | ```
182 |
183 | For more insights regarding the `rosparam` tool refer to [ROS wiki](http://wiki.ros.org/rosparam).
184 |
185 | #### Via the rospy API library
186 |
187 | Parameters from the parameter server can be accessed and modified using `rospy` API library. This is generally used when the parameters are to be used by a node during the runtime.
188 |
189 | For more imformation on handling parameters using `rospy` API library go through [rospy overview](http://wiki.ros.org/rospy/Overview/Parameter%20Server)
190 |
191 | #### Via launch files
192 |
193 | Parameters can be set, created and loaded into the parameter server while creating launch files. For more information on handling parameters in launch files go through [roslaunch wiki](http://wiki.ros.org/roslaunch/XML/param).
194 |
195 | For more information go through [ROS wiki on Parameter Server](http://wiki.ros.org/Parameter%20Server)
196 |
197 | ## Learning Materials
198 |
199 | - [A Gentle Introduction to ROS](https://drive.google.com/file/d/16KVq4xRZGvG5yVtNwFp7_M9a-eWYHJ0S/view?usp=sharing) by Jason M.'O Kane (use IIT BBS email-id to access link)
200 | - [Programming Robots with ROS](https://drive.google.com/file/d/1mWJNd8R7qR059PwPU214JoTYToakFzZJ/view?usp=sharing) by Morgon Quigley (use IIT BBS email-id to access link)
201 | - [Official ROS Tutorials](http://wiki.ros.org/ROS/Tutorials).
202 |
203 |
204 |
205 |
--------------------------------------------------------------------------------
/docs/automation/ROS/images/ROSimg1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ROS/images/ROSimg1.png
--------------------------------------------------------------------------------
/docs/automation/ROS/images/ROSimg2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ROS/images/ROSimg2.png
--------------------------------------------------------------------------------
/docs/automation/ROS/images/ROSimg3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ROS/images/ROSimg3.png
--------------------------------------------------------------------------------
/docs/automation/ROS/images/ROSimg4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ROS/images/ROSimg4.png
--------------------------------------------------------------------------------
/docs/automation/ROS/images/ROSimg5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/ROS/images/ROSimg5.png
--------------------------------------------------------------------------------
/docs/automation/ROS/installation.md:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 | ## Setting up Operating System
4 |
5 | [Ubuntu 22.04](https://ubuntu.com/download/desktop) is recommended for ROS if you already have Ubuntu 20.04, that is also fine although for versions older than this we recommend upgrading to 22.04.
6 |
7 | For those who currently have **Windows** as the only OS on their machine, the best way to start using Ubuntu would be to **dual boot**. Here is a guide on how to do [this](https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/) or you can go through this Youtube [video](https://www.youtube.com/watch?v=-iSAyiicyQY) . For **MacOS** users, dual booting is an [option](https://youtu.be/CNk-ftc-qRI) but it is recommend to use a virtual machine.
8 |
9 | If you are unable to dual boot for any reason, you can try setting up a **virtual machine**. The first step in this is to install a virtualisation software. For Windows you can use either [VirtualBox](https://www.virtualbox.org/) (free) or Vmware Workstation and for MacOS either [VirtualBox](https://www.virtualbox.org/) (free),
10 | Vmware Fusion or Parallels. After getting one of the above, follow the instructions given [here](https://ethz.ch/content/dam/ethz/special-interest/mavt/robotics-n-intelligent-systems/rsl-dam/ROS2020/CoursePreparation.pdf) (skip ahead to the *Download Image* section). After completing the given procedure you will be equipped with all the basic tools required for Robotics including ROS,catkin and git.
11 |
12 | In the unfortunate case that the **above options do not work**, for Windows users there is still a way - [WSL](https://ubuntu.com/wsl). Do be warned however, this path is fraught with frustration and much debugging. Only continue if you have exhausted other options. For a guide on setting up WSL for ROS, look [here](https://janbernloehr.de/2017/06/10/ros-windows).
13 |
14 | For those whom none of the above are possible, consider using the online browser based [ROS Development Studio](https://www.theconstructsim.com/). Keep in mind that it has a limited access time per week and performance may be questionable.
15 |
16 | ## Installing Robot Operating System (ROS)
17 |
18 | **For Ubuntu 22.04 users** : [ROS Humble Hawksbill](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)
19 | **For Ubuntu 20.04 users** : [ROS Noetic](http://wiki.ros.org/noetic/Installation/Ubuntu)
20 |
21 |
22 | * **Code Editors** : [VSCode](https://code.visualstudio.com/) is recommended for boosting productivity which has plugins for python and ROS. A comprehensive guide for how to integrate ROS into your favourite IDE can be found [here](http://wiki.ros.org/IDEs).
23 |
24 |
25 | * For installing developed ROS packages replace with name of the ROS package.
26 |
27 | ```bash
28 | sudo apt install ros-$ROS_DISTRO-
29 | ```
30 |
31 | * Because of having conflicting python path Anaconda and ROS can't be used in same. For dealing with this edit your
32 | .bashrc file by commenting the anaconda python path like this
33 |
34 | ```bash
35 | // export PATH="/home//anaconda3/bin:$PATH "
36 | ```
37 |
38 | * It is recommended to source the workspace on startup by editing your .bashrc file by including following line. Replace with the path of your workspace
39 |
40 | ```bash
41 | source /devel/setup.bash
42 | ```
43 |
44 | Note : Two workspaces can't be sourced at the same time.
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/docs/automation/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 | Without the capacity to accomplish things on their own, robots would be quite worthless. Robots are on their approach to becoming totally autonomous today, thanks to ever more advanced machine learning algorithms. Planning, Controls, and State Estimation comprises Automation.
3 |
4 | We must plan our actions from the minute we get up in the morning until our heads hit the pillow at night. A major challenge in developing autonomous robots is figuring out how to give them the ability to make their own decisions in a range of settings. The computational process of travelling from one location to another in the presence of barriers is known as motion planning.
5 |
6 | A robot's movements and sensory processing are controlled by the Robot control system.We require robot controllers since the dynamics (system plant) change over time. For example, when the robot travels up and down a slope, or when it travels on smooth concrete before moving to a carpeted floor.
7 |
8 | Estimating a robot's state, such as location and orientation, as it moves around the world is a fundamental part of robotics today. To locate themselves in a three-dimensional world, most robots and autonomous vehicles rely on noisy data from sensors such as cameras or laser rangefinders, or a combination of these.
9 |
--------------------------------------------------------------------------------
/docs/automation/simulation/gazebo/basics.md:
--------------------------------------------------------------------------------
1 | # Gazebo
2 |
3 | Gazebo is the most popular physics simulator for robotics development. It can simulate robots in a
4 | 3D environment and can be fully integrated into ROS integrated with Gazebo using the
5 | **gazebo_ros** ROS package. You can interface your robots in the simulation using ROS
6 | and control them using ROS messages and services.
7 |
8 | ### 2.1 Installation
9 |
10 | Gazebo and gazebo_ros package are both automatically installed when you install ROS. To make sure you have all the
11 | ROS packages necessary for running Gazebo simulations are installed
12 |
13 | `sudo apt-get install ros-melodic-gazebo-*`
14 |
15 | Gazebo can also be installed independently of ROS by using the command
16 |
17 | `curl -sSL http://get.gazebosim.org | sh`
18 |
19 | in the terminal for Ubuntu. Alternative methods of installing gazebo and installation guides for installling gazebo on other operating systems can be found [here](http://gazebosim.org/tutorials?cat=install).
20 |
21 | ### 2.2 Getting Started
22 |
23 | You can launch the Gazebo GUI simulator window by just running the command `gazebo`
24 | in the terminal. To understand how to spawn robot models in gazebo it is recommended to first get familiar with _.urdf_, _.sdf_ and _.world_ files. You can refer to the [Robot Description]() section to read about these.
25 |
26 | A file can be opened simply by running the follwing command in the command line:
27 |
28 | `gazebo `
29 |
30 | ### 2.3 Client Server Separation
31 |
32 | Running the `gazebo` command starts two programmes, namely the **gzserver** and the **gzclient**. The _gzserver_ is responsible for doing most of the 'processing' part, i.e., doing all the calculations for the simulation, sensor data generation, basically all the backend processing. The _gzclient_ is responsible for generating the user interface. It provides a nice visualization of simulation, and convenient controls over various simulation properties. _gzserver_ is capable of running independently of _gzclient_ and vice-versa. For eg; in many cases _gzserver_ is run on a cloud computer in case enough processing power is not available locally. Try running the command `gzserver` in one terminal and the command `gzclient` in other terminal. You will notice that the gazebo window pops up only when you run the `gzclient` command. The term **_run headless_** is used to refer to cases when only the _gzserver_ is being used.
33 |
34 | ### 2.4 Environment Variables in Gazebo
35 |
36 | [Environment Variables]() are variables whose values are valid throughout the system and are used by different applications and the OS for several purposes. These environment variables can contain different types of things ranging from parameter values to paths to certain files depending on what they are used for. Gazebo uses various such environment variables too. These variables and their uses are described below:
37 |
38 | * **GAZEBO_MODEL_PATH :** This environment variable contains colon-separated paths to different directories where gazebo will search for models. Models refers to the sdf file describing the robot. For more information on this refer to the [Robot Description]() section of the handbook.
39 |
40 | * **GAZEBO_RESOURCE_PATH:** This environment variable contains colon-separated set of directories where Gazebo will search for other resources such as world and media files. For eg. if you run the command `gazebo worlds/pioneer2dx.world`. You will see gazebo window pop up with an empty environment. In fact you can execute this command in any directory. You might ask how does gazebo know where the `worlds` directory is stored?. The answer is that the path to the world directory, that is `/usr/share/gazebo-7/worlds` is stored in the environment variable `GAZEBO_RESOURCE_PATH`.
41 |
42 | * **GAZEBO_MASTER__URI:** [URI]() of the [Gazebo master](). This specifies the IP and port where the server(gzserver) will be started and tells the clients(gzclients) where to connect to.
43 |
44 | * **GAZEBO_PLUGIN_PATH:** colon-separated set of directories where Gazebo will search for the plugin shared libraries at runtime. Plugins are basically..... You can refer to [this]() section to read more about gazebo plugins.
45 |
46 | * **GAZEBO_MODEL_DATABASE_URI:** URI of the online model database where Gazebo will download models from.
47 |
48 | The default values of these environment variables are stored in the `/share/gazebo/setup.sh` file. If you want to change the values of this variables for example, add or remove a path from `GITHUB_MODEL_PATH` you will have to source this file first using the command
49 |
50 | `source /share/gazebo/setup.sh`
51 |
52 | Once this is done you can edit that value of the variable by editing the value by opening the `setup.sh` file or directly thorugh the terminal/command line using the command:
53 |
54 | `GITHUB_MODEL_PATH=$GITHUB_MODEL_PATH:`
--------------------------------------------------------------------------------
/docs/automation/simulation/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | Robotics automation requires simulation as a key component. They give you a flexible environment to rapidly test your code for errors and performance, as well as to try out novel concepts.
4 | Although robots are getting easier to access all the time, we're still not at the point where you can test your program on them directly.
--------------------------------------------------------------------------------
/docs/automation/simulation/stdr/Basics.md:
--------------------------------------------------------------------------------
1 | ### General Introduction
2 |
3 | STDR is a simple two dimensional robot simulator. It is very useful in cases where there is no need for computationally costly 3-D simulation of robots. It is computationally light and serves the purpose good. Hence it is very useful for learning based robotics or for multi robot simulation.
4 |
5 | ### Installation
6 |
7 | 1. For ROS Humble Hawksbil , stdr can be installed using apt-get.
8 | 2. For ROS Melodic, it is advisible to install stdr from [source](https://github.com/stdr-simulator-ros-pkg/stdr_simulator).
9 |
10 | ### Architecture Overview
11 |
12 | {: style="height:500px"}
13 |
14 | (Reference: [ROS Wiki](http://wiki.ros.org/stdr_simulator))
15 |
16 | ### Basic Usage
17 |
18 | - The ```stdr_launchers``` package contains launch files basic usage. However, custom launch files can be created to serve personal purposes easily. Some of the launch files are
19 | 1. ```server_no_map.launch``` launches the stdr server without any map, robot or the gui.
20 | 2. ```server_with_map_and_gui.launch``` launches the serve with preloaded map and gui.
21 | 3. ```server_with_map_and_gui_plus_robot.launch``` launches the stdr_server, with preloaded map and robot along with the gui
22 | - You can also launch Rviz with a preset config file using ```rviz.launch``` file in the stdr_launchers package.
23 |
24 | ### Robot Namespaces
25 |
26 | 1. The topics corresponding to each robot have a unique namespace attached to it. For example the first robot launched has a namespace ```/robot0```. Published topics pertaining to that robot are published as ```/robot0/topic_name```.
27 | 2. Note that whenever a new robot is spawned the robot number is incremented by 1. This happens even though you delete a robot.
28 | 3. such namespacing avoids conflicts of topic names when doing multi robot simulation.
29 |
30 | ### References
31 |
32 | 1. For more information refer the ```stdr_simulator``` page in [ROS Wiki](http://wiki.ros.org/stdr_simulator).
33 | 2. The github [repository](https://github.com/stdr-simulator-ros-pkg/stdr_simulator) for stdr_simulator.
34 |
--------------------------------------------------------------------------------
/docs/automation/simulation/stdr/images/architecture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/automation/simulation/stdr/images/architecture.jpg
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/Arduino.md:
--------------------------------------------------------------------------------
1 | # Arduino
2 |
3 | The Arduino is basically a very accessible and easy to program microcontroller. Unlike other microcontrollers, which need knowledge of registers and ports, the Arduino is programmed by a very basic C-derived language. [This](https://www.youtube.com/watch?v=CqrQmQqpHXc) [video](https://www.youtube.com/watch?v=CqrQmQqpHXc) explains what an Arduino is, what it is capable of, and the numerous projects one can use it for.
4 |
5 | ## Arduino Board Layout
6 |
7 | 
8 |
9 | The above diagram shows an Arduino UNO board with all the parts labelled and explained below:
10 |
11 | 1. **USB Port:** Arduino can be powered by connecting it to your computer using a USB cable. It is also used for uploading code and communicating via the serial port.
12 | 2. **Power Jack:** Used to power an arduino directly from a wall adaptor.
13 | 3. **Voltage Regulator:** Controls and stabilises the voltage used by the Arduino and its components.
14 | 4. **Crystal Oscillator:** A microcontroller is a clock based device. The crystal oscillator present on the arduino generates a clock of frequency 16MHz.
15 | 5. **Reset controllers:** Resetting the arduino board starts the execution of a program from the beginning. Arduino can be reset in 2 ways : by pressing the reset button (17) and sending a 0V signal to the RESET pin (5).
16 | 6. **3.3V power**
17 | 7. **5V power**
18 | 8. **GND (0V)**
19 | 9. **VIN:** This pin can be used to power the arduino board from an external power source, from 7-20V.
20 | 10. **Analog Pins:** These pins (labeled A0-A5) can be used to read continuous analog values (between 0 and 5V). They are often used to interface the Arduino with analog sensors.
21 | 11. **Main Microcontroller:** This IC is the main microcontroller, that executes the code you program it with.
22 | 12. **ICSP Pin:** Can be used to program the arduino board’s firmware. For advanced users only.
23 | 13. **Power LED indicator:** Indicates whether the board is powered up correctly.
24 | 14. **TX/RX LEDs:** The TX/RX pins flash to indicate transfer/receival of serial data between the computer and Arduino.
25 | 15. **Digital I/O Pins: **These pins can be programmed as input/output pins. When used as output, they can be set HIGH (+5V) or LOW (0V).
26 | 16. **Analog Reference(AREF):** Can be used to set an external reference voltage(0-5V) as the upper limit for analog input pins.
27 | 17. **Reset Button:** Pressing it causes the Arduino to restart its code.
28 |
29 | ## The Blink Sketch
30 |
31 | The Blink sketch is like the “Hello World” program in the Arduino world. It simply consists of blinking the onboard LED (labeled ‘L’). No actual circuit connections are required!
32 |
33 | 
34 |
35 | ### Code
36 |
37 | You can copy the code from [here](https://github.com/schacon/blink/blob/master/blink.ino).
38 |
39 | ## How to code an Arduino in Arduino IDE
40 |
41 | 1. Download and install Arduino Software (IDE) from [here](https://www.arduino.cc/en/main/software). The Integrated Development Environment (IDE) is a common coding environment for all arduino boards.
42 | 2. Open the IDE and a new sketch will open up which would look like the image below. Sketch is just a name arduino uses for a program.
43 | 3. Then just paste the entire code here.
44 | 4. Now connect your Arduino UNO board to your PC using an A B USB cable and select the option "Arduino/Genuino Uno" under **Tools > Board** menu. Also make sure to select the correct port through which the PC is connected to the board under **Tools > Port** menu.
45 | 5. Click on the "tick" button in upper left corner to compile the code and check for errors. After resolving any and all errors click on the "arrow" button next to it to upload the code to the board.
46 | 6. After successful upload the Arduino Uno will start executing the code while drawing power from the PC through the USB cable.
47 |
48 | 
49 |
50 | ### Explanation
51 |
52 | Every Arduino sketch **must** have two particular functions:
53 |
54 | 1. void setup()
55 | 1. The setup() function is called when a sketch starts and will only run once, after each powerup or reset of the Arduino board.
56 | 2. void loop()
57 | 1. This function does precisely what its name suggests, that is loops consecutively, allowing your program to change and respond. Whatever code you write inside loop() will keep running as long as the Arduino is receiving power.
58 |
59 | Let us examine the [Blink](https://github.com/schacon/blink/blob/master/blink.ino) sketch now, line by line.
60 |
61 | ```cpp
62 | int led = 13;
63 | ```
64 |
65 | This line assigns a name to the pin that the LED is attached to, i.e. pin 13.
66 |
67 | Then we have the setup() function, which runs only once. It includes the following line.
68 |
69 | ```cpp
70 | pinMode(led, OUTPUT);
71 | ```
72 |
73 | This tells the Arduino to configure that pin as an output.
74 |
75 | Then we have the following loop() function.
76 |
77 | ```cpp
78 | void loop()
79 | {
80 | digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
81 | delay(1000); // wait for a second
82 | digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
83 | delay(1000); // wait for a second
84 | }
85 | ```
86 |
87 | The digitalWrite() function tells a pin to either switch on (HIGH, or +5V) or off (LOW, or 0V). The delay() function tells the Arduino to wait for a specified number of milliseconds.
88 |
89 | ## Reading Analog Values
90 |
91 | The following circuit reads the voltage from a potentiometer and sends it via USB to the serial port.
92 |
93 | ### Schematic
94 |
95 | 
96 |
97 | ### Code
98 |
99 | Copy the code from [here](https://create.arduino.cc/example/builtin/01.Basics%5CAnalogReadSerial/AnalogReadSerial/preview) and paste it into a new sketch in the Arduino IDE and upload the code to the board. After successful uploading open the serial monitor in the IDE by clicking on its button on top right corner. Trying varying the potentiometer’s knob - you should see the stream of values of the serial monitor change.
100 |
101 | ### Explanation
102 |
103 | Whenever the serial port is to be used, it should be initialised with the following line _inside_ void setup(). The 9600 refers to the communication speed in bits-per-second.
104 |
105 | ```cpp
106 | Serial.begin(9600);
107 | ```
108 |
109 | The analogRead function reads the voltage at an analog pin and linearly converts it to a value between 0 and 1023. The Serial.println() function prints a variable to the serial monitor, followed by a newline (using Serial.print() to print data without the newline). The delay(1) is to limit the amount of data printed to the serial monitor.
110 |
111 | ## References
112 |
113 |
114 | 2. For some more detailed tutorials do read the documentation of [Arduino](https://www.arduino.cc/en/Tutorial/HomePage).
115 | 3. For some video tutorials check out Jeremy Blum's [playlist](https://www.youtube.com/playlist?list=PLA567CE235D39FA84) for Arduino.
116 | 4. For more DIY project ideas and inspirations check out [Great Scott's](https://www.youtube.com/c/greatscottlab/featured) youtube channel.
117 | 5. To read more about the projects made by people using Arduino, check out Arduino's [blog](https://blog.arduino.cc/) as well.
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/ESP32.md:
--------------------------------------------------------------------------------
1 | # ESP32
2 |
3 | ## Introduction
4 |
5 | ESP32 is a series of feature-rich MCU with integrated Wi-Fi and Bluetooth connectivity for a wide range of applications. Espressif Systems, China, produce it.ESP32 is cheap and nearly ten times faster than Arduino Uno and is a 32-bit versatile device.
6 | Developers of ESP32 IC made a small module board with edge castellations. One popular version of such a module board is called ESP-WROOM-32. It is a dual-core, 32-bit microcontroller unit, and all the cores can be controlled individually. It has integrated Wi-Fi, Bluetooth, and Bluetooth Low Energy with multiple digital and analog I/O pins.
7 |
8 | 
9 |
10 | ## Comparison Of ESP32 and Arduino Uno
11 |
12 | | Parameter | ESP32 | ARDUINO UNO |
13 | |------------------------|---------------------------|-------------|
14 | | Processor | Xtensa dual-core | ATMega328P |
15 | |Number of Cores| 2 | 1 |
16 | |Architecture| 32 bit | 8 bit |
17 | | Operating Voltage|2.2 to 3.6V |5V|
18 | |CPU Frequency|160 or 240 MHz|16 MHz|
19 | |WiFi| YES | NO |
20 | |Bluetooth| YES | NO |
21 | |RAM| 512 KB | 2 KB|
22 | |Flash| 16 MB | 32 KB|
23 | |GPIO pins| 36 | 14|
24 | |Busses| SPI,I²C,UART,I2S,CAN | SPI,I²C,UART |
25 | |ADC Pins| 18 | 6 |
26 | |DAC Pins| 2 | 0 |
27 | |USB Conector|Micro|Type B|
28 | |UART|3|1|
29 | |SPI|3|1|
30 | |I²C|2|1|
31 |
32 | ## Pinout
33 |
34 | 
35 |
36 | You can refer to the [manual](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf ) provided by Espressif Systems to view the complete pinout in detail.
37 |
38 | ## Peripherals and Features
39 |
40 | Now that we have seen the ESP32 Pinout , let us now focus on some of the important peripherals of ESP32 and their associated pins. ESP32 Microcontroller has:
41 |
42 | * Up to 18 12-bit Analog to Digital converters.
43 | * 2, 8-bit Digital to Analog converters.
44 | * 10 capacitive touch switch sensors.
45 | * 4 SPI channels.
46 | * 2 I²C interfaces.
47 | * 2 I2S interfaces (for digital audio).
48 | * 3 UARTs for communications.
49 | * Up to 8 channels of IR remote control.
50 | * Up to 16 channels of LED PWM (pulse width modulation).
51 | * An integrated Hall-effect sensor.
52 | * An ultra-low-power analog preamp.
53 | * An internal low-dropout regulator.
54 |
55 | * ### GPIO
56 | 34 pins, each pin carries out more than one function ( only one will be active). You can configure a pin as either a GPIO or an ADC or an UART in the program.ADC and DAC pins are predefined, and you have to use the manufacturer specified pins. But other functions like PWM, SPI, UART, I2C etc. can be assigned to any GPIO pin through the program.
57 |
58 |
59 | * ### RTC GPIO
60 | part of the RTC Low-Power subsystem. These pins can be used to wake ESP32 from a deep sleep as an external wake-up source.
61 |
62 | * ### ADC
63 | ESP32 has two 12-bit SAR Analog to Digital Converter Modules with 8-channels and 10-channels each. So, ADC1 and ADC2 blocks combined together have 18 channels of 12-bit ADC.With 12-bit resolution, the Digital output values will be in the range of 0 – 4093.
64 |
65 | * ### DAC
66 | ESP32 Microcontroller has two independent 8-bit Digital to Analog Converter channels to convert digital values to analog voltage signals. The DAC has an internal resistor network and uses a power supply as an input reference voltage.
67 | The following two GPIO Pins are associated with DAC functionalities.
68 |
69 | 1. DAC1 — GPIO25
70 | 2. DAC2 — GPIO26
71 |
72 | * ### Capacitive Touch GPIOs
73 | can detect variations in capacitance on a pin due to touching or approaching the GPIO Pin with a finger or stylus. These Touch GPIOs can be used in implementing capacitive touch pads without any additional hardware.
74 |
75 | * ### SPI
76 | three SPI blocks (SPI, HSPI and VSPI) are present in both master and slave modes. SPI is used to interface with Flash Memory. So, you have two SPI interfaces.
77 |
78 | * ### I²C
79 | There are two I2C interfaces in ESP32 with complete flexibility on assigning pins, i.e., SCL and SDA pins for both I2C interfaces can be assigned in the program by the user.If you are using Arduino IDE, then the default I2C pins are:
80 | SDA – GPIO21
81 | SCL – GPIO22
82 |
83 | * ### PWM
84 | The PWM Controller in ESP32 has 16 independent PWM waveform channels with configurable frequency and duty cycle. The PWM waveform can be used to drive motors and LEDs. You can configure the PWM signal frequency, channel, GPIO pin and also the duty cycle.
85 |
86 | ## How To Program ESP32
87 |
88 | One can use C++ and MicroPython to program the ESP32. It supports multiple programming environments :
89 |
90 | * Arduino IDE
91 | * PlatformIO IDE (VS Code)
92 | * LUA
93 | * MicroPython
94 | * Espressif IDF (IoT Development Framework)
95 | * JavaScript
96 |
97 | To fully utilise the features , one must use the ESP-IDF.You can chek it out in detail [here](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/index.html).
98 |
99 | ## Using the Arduino IDE
100 |
101 | You can program ESP32 using the Arduino IDE. You can refer to [this](https://www.electronicshub.org/esp32-arduino-ide/) tutorial to understand the complete process.
102 |
103 | ## LED Blink Sketch
104 |
105 | 
106 |
107 | For more examples and initial projects for practice you can refer [here](https://dronebotworkshop.com/esp32-intro/ ).
108 |
109 | ## References
110 | * [Video](https://youtu.be/xPlN_Tk3VLQ) on Introduction to ESP 32-Getting Started by DroneBot Workshop
111 | * For more details you can refer to the website of DroneBot Workshop [here](https://dronebotworkshop.com/esp32-intro/).
112 | * ESP 32 [webpage](https://www.electronicshub.org/esp32-pinout/) by Electronics Hub
113 | * Programming Guide to ESP 32 by [Electronics Hub](https://www.electronicshub.org/esp32-arduino-ide/) and [OpenLab](https://openlabpro.com/guide/led-blinking-on-esp32/).
114 | * Espressif Systems [documentation](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/index.html)
115 | on ESP 32 .
116 |
117 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/Pyboard.md:
--------------------------------------------------------------------------------
1 | # Pyboard - MicroPython
2 | MicroPython is an implementation of the Python 3 programming language which is optimized to run on many microcontrollers. It has modules to access the hardware of the microcontroller, and the code is compatible to a great extent with normal python code.
3 |
4 | The Pyboard is the official MicroPython microcontroller board based on a STM3F405RG microcontroller.
5 |
6 | 
7 |
8 | ## Pyboard Board Layout
9 |
10 | 
11 |
12 | The hardware has:
13 |
14 | 1. STM32F405RG microcontroller
15 | 2. 168 MHz Cortex M4 CPU with hardware floating point
16 | 3. 1024KiB flash ROM and 192KiB RAM
17 | 4. Micro USB connector for power and serial communication
18 | 5. Micro SD card slot, supporting standard and high capacity SD cards
19 | 6. 3-axis accelerometer (MMA7660)
20 | 7. Real time clock with optional battery backup
21 | 8. 24 GPIO on left and right edges and 5 GPIO on bottom row, plus LED and switch GPIO available on bottom row
22 | 9. 3x 12-bit analog to digital converters, available on 16 pins, 4 with analog ground shielding
23 | 10. 2x 12-bit digital to analog (DAC) converters, available on pins X5 and X6
24 | 11. 4 LEDs (red, green, yellow and blue)
25 | 12. 1 reset and 1 user switch
26 | 13. On-board 3.3V LDO voltage regulator, capable of supplying up to 250mA, input voltage range 3.6V to 16V
27 | 14. DFU bootloader in ROM for easy upgrading of firmware
28 |
29 | ## Blink Sketch
30 |
31 | Similar to the blink sketch with Arduino, we can make a simple blink sketch with Pyboard using MicroPython.
32 |
33 | ### Code
34 |
35 | You can copy the code from here:
36 | ```
37 | import pyb
38 | led = pyb.LED(4)
39 | while True:
40 | led.on()
41 | pyb.delay(1000)
42 | led.off()
43 | pyb.delay(1000)
44 | ```
45 | ### How to Code
46 |
47 | 1. First connect the Pyboard to your computer using a USB. It will open up as a USB flash device with a boot python file and main python file.
48 |
49 | There are multiple ways to code a MicroPython program and run it on Pyboard.
50 |
51 | 2. One beginner friendly way is to use a serial communication program like putty, which opens the interactive REPL prompt and now you can execute commands directly.
52 | Follow this [tutorial](https://learn.adafruit.com/micropython-basics-how-to-load-micropython-on-a-board/serial-terminal) to setup putty.
53 |
54 | **NOTE:** you have to press delete after the indented at the end of the while loop to end the indented block and then only will the loop start running. To exit out of the while loop, use ctrl+c.
55 |
56 | 3. Another way is to run scripts from the built-in file system. Write to the main python file script using any text editor, save and close it. Make sure you eject the Pyboard USB drive and then only press the reset button on the PyBoard. You can use putty as a serial monitor.
57 |
58 | ## References
59 |
60 | 1. For documentation and quick reference, check out the [official MicroPython website](https://micropython.org/).
61 | 2. For a quick introduction to MicroPython and Pyboard, check out [this](https://www.youtube.com/watch?v=5LbgyDmRu9s) video.
62 | 3. For a comparison with the Arduino, check out [this](https://www.youtube.com/watch?v=CyrgzzxQPzk) video.
63 | 4. To discuss all things related to MicroPython with an online community check out the [MicroPython Forum](https://forum.micropython.org/).
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/STM32.md:
--------------------------------------------------------------------------------
1 | # Blue Pill (STM32F103C8T6)
2 |
3 | ## Introduction
4 | The STM32F103C8T6 (also known as 'STM32' or 'Blue Pill") is a cheap development board based on the ARM Cortex M3 microprocessor. [This](https://www.youtube.com/watch?v=EaZuKRSvwdo) video by Great Scott can prove to be an introductory video to understand what it exactly is and how it can be used.
5 |
6 | 
7 |
8 | ## Naming Convention of STM microcontrollers
9 | |**Parameter**|**Meaning**|
10 | |---------|-------|
11 | |STM| name of the manufacturer (STMicroelectronics)|
12 | |32| 32 bit ARM architecture |
13 | |F|Foundation |
14 | |1| Core (ARM Cortex M3)|
15 | |03| Line (describes peripherals and speed)
16 | |C| 48 pins
17 | |8|64 KB flash memory
18 | |T|LQFP package (Low Profile Quad Flat Pack)
19 | |6|Operating Temperature Range (-40 °C to 85 °C)
20 |
21 | ## Technical Specifications of STM32
22 | |**Parameter**|**Meaning**|
23 | |---------|-------|
24 | |Architecture|32 bit ARM Cortex M3
25 | |Operating Voltage| 2.7V to 3.6V
26 | |CPU Frequency | 72 MHz
27 | |Number of GPIO pins| 37
28 | |Number of PWM pins| 12
29 | |Analog Input Pins| 10 (12 bit resolution)
30 | |I2C Peripherals| 2
31 | |SPI Peripherals| 2
32 | |CAN 2.0 Peripheral|1|
33 | |Timers | 3(16-bit), 1| (PWM)
34 | |Flash Memory| 64KB |
35 | |RAM| 20kB |
36 |
37 | For more insights about the technical specifcations refer to the [official datsheet](https://www.st.com/resource/en/datasheet/stm32f103c8.pdf) and [reference manual](https://www.st.com/content/ccc/resource/technical/document/reference_manual/59/b9/ba/7f/11/af/43/d5/CD00171190.pdf/files/CD00171190.pdf/jcr:content/translations/en.CD00171190.pdf) by STMicroelectronics.
38 |
39 | ## Pinout
40 |
41 | 
42 |
43 | ## Programming STM32
44 | ### 1) Using STM32duino bootloader (Arduino IDE)
45 | You can program your STM32 development board using Arduino IDE, too. You will require FTDI (USB to UART converter) for this process. [This](https://maker.pro/arduino/tutorial/how-to-program-the-stm32-blue-pill-with-arduino-ide) tutorial explains the complete process.
46 |
47 | ### 2) Using Keil UVision and STM32CubeMX
48 | This is one step further than the last mentioned process and is more professional in terms of usage. You will require the softwares ARM's Keil Uvision and STM32CubeMX for this method of programming BluePill. You will also need the STLink/V2 which is a debugger cum programmer hardware provided by STMicroelectronics. These softwares provide a more sophisticated and professional programming environment for programming embedded systems. You may refer to [this](https://www.electronicshub.org/program-stm32f103c8t6-using-keil-uvision/) guide to know this method in detail.
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/ESP32pinout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/ESP32pinout.png
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/STM32-Pin-Details_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/STM32-Pin-Details_0.png
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/arduino1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/arduino1.png
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/arduino2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/arduino2.png
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/arduinoide.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/arduinoide.png
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/arduinopot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/arduinopot.png
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/bluepill_intro.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/bluepill_intro.jpeg
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/esp32intro.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/esp32intro.jpeg
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/esp32intro2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/esp32intro2.jpg
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/ledblink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/ledblink.png
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/pyboard1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/pyboard1.jpg
--------------------------------------------------------------------------------
/docs/electronics/Development_Boards/images/pyboard2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Development_Boards/images/pyboard2.jpg
--------------------------------------------------------------------------------
/docs/electronics/Modules/ESP8266.md:
--------------------------------------------------------------------------------
1 | # Wi-Fi module
2 |
3 | Wifi modules or wifi microcontrollers are used to send and recieve data over Wi-Fi. They can also accept commands over the Wi-Fi. Wi-Fi modules are used for communications bewtween devices. They are most commonly used in the field of Internet of Thnigs.
4 |
5 | ## ESP8266
6 |
7 | ESP8266 is the most widely used Wi-Fi module. It is a low-cost microchip with a full TCP/IP stack and microcontroller capability, produced by Espressif Systems. This small module allows microcontrollers to connect to a Wi-Fi network and make simple TCP/IP connections.
8 |
9 | ESP8226 comes with the capabilites of:-
10 | 1. 2.4 Ghz Wi-Fi
11 | 2. General-purpose input/output (16 GPIO)
12 | 3. Inter-Integrated Circuit (I²C) serial communication protocol
13 | 4. Analog-to-digital conversion (10-bit ADC)
14 |
15 | It runs at operating voltage of 3V and can handle maximum voltage of around 3.6V. It can be easily interfaced with microcontrollers board via Serial Port. There are numerous breakout boards available based on ESP8266 Wifi Module like ESP8266 NodeMCU V3. Because of its compact size, its most importantly used in autonomous project.
16 |
17 |
18 |
19 | ### ESP8266 pinout
20 |
21 | 
22 |
23 | |Pin Number|Pin Name|Working|
24 | |-|-|-|
25 | |1|RX |Serial Receiver Pin|
26 | |2|VCC|Power Pin (+3.3 V; can handle up to 3.6 V|
27 | |3|GPIO 0|General-Purpose I/O No. 0|
28 | |4|RST|Reset|
29 | |5|CH_PD|Chip power-down|
30 | |6|GPIO 2|General-purpose I/O No. 2|
31 | |7|TX|Serial Transmitter Pin|
32 | |8|GND|Ground|
33 |
34 | ### Scanning and dispalying available WiFi networks using ESP8266
35 |
36 | ESP8266 comes with a built in micro-controller. It has a Arduino support and can be programmed easily.
37 |
38 | #### Arduino support for ESP8266
39 |
40 | 1. Download Arduino IDE from Arduino.cc(1.6.4 or greater)
41 | >
42 |
43 | 2. Install the ESP8266 Board Package
44 | - Select **Preferences** under **File**
45 | 
46 | - Enter into Additional Boards Manager URL's field under preferences.
47 | 
48 | - Select the **Board Manager** under the Tools.
49 | 
50 | - Use the **Board Manager** to install the ESP8266 package.
51 | 
52 | - Restart the Arduino IDE and Select the **Generic ESP8266 Module** board
53 | 
54 |
55 | #### Connection
56 |
57 | 
58 |
59 | A USB to serial converter is nedded to program ESP8266. The above image shows connections made from Explore USB to Serial and Explore Wifi boards.
60 |
61 | #### Code
62 |
63 | ```cpp
64 | #include "ESP8266WiFi.h"
65 |
66 | void setup() {
67 | Serial.begin(115200);
68 |
69 | // Set WiFi to station mode and disconnect from an AP if it was previously connected
70 | WiFi.mode(WIFI_STA);
71 | WiFi.disconnect();
72 | delay(100);
73 |
74 | Serial.println("Setup done");
75 | }
76 |
77 | void loop() {
78 | Serial.println("scan start");
79 |
80 | // WiFi.scanNetworks will return the number of networks found
81 | int n = WiFi.scanNetworks();
82 | Serial.println("scan done");
83 | if (n == 0)
84 | Serial.println("no networks found");
85 | else
86 | {
87 | Serial.print(n);
88 | Serial.println(" networks found");
89 | for (int i = 0; i < n; ++i)
90 | {
91 | // Print SSID and RSSI for each network found
92 | Serial.print(i + 1);
93 | Serial.print(": ");
94 | Serial.print(WiFi.SSID(i));
95 | Serial.print(" (");
96 | Serial.print(WiFi.RSSI(i));
97 | Serial.print(")");
98 | Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
99 | delay(10);
100 | }
101 | }
102 | Serial.println("");
103 |
104 | // Wait a bit before scanning again
105 | delay(5000);
106 | }
107 | ```
108 |
109 | ### References
110 |
111 | 1. [Documentation](https://arduino-esp8266.readthedocs.io/en/latest/libraries.html#wifi-esp8266wifi-library) of ESP8266.h library.
112 | 2. [Technical Reference Manual](https://www.espressif.com/sites/default/files/documentation/esp8266-technical_reference_en.pdf) by Espressif Systems.
113 | 3. [ESP8266 Community Forum](https://www.esp8266.com/)
114 | 4. [ESP8266 for IoT guide](https://www.nabto.com/esp8266-for-iot-complete-guide/) by Nabto.
--------------------------------------------------------------------------------
/docs/electronics/Modules/images/board.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Modules/images/board.png
--------------------------------------------------------------------------------
/docs/electronics/Modules/images/board_manager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Modules/images/board_manager.png
--------------------------------------------------------------------------------
/docs/electronics/Modules/images/connection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Modules/images/connection.png
--------------------------------------------------------------------------------
/docs/electronics/Modules/images/install.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Modules/images/install.png
--------------------------------------------------------------------------------
/docs/electronics/Modules/images/pinout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Modules/images/pinout.png
--------------------------------------------------------------------------------
/docs/electronics/Modules/images/preferences.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Modules/images/preferences.png
--------------------------------------------------------------------------------
/docs/electronics/Modules/images/url.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Modules/images/url.png
--------------------------------------------------------------------------------
/docs/electronics/Motors/ServoMotor.md:
--------------------------------------------------------------------------------
1 | # Servo Motors
2 |
3 | Servo motors are simply just electric motors which give the users precise control over the angle of rotation, speed and torque of the motor. The shaft of a servo motor can be made to rotate by a certain angle and then it waits till the next signal is given to it. Moreover, the speed and torque, and in certain applications, even the sense of rotation of the motor can be adjusted by changing the command signal given to the motor. Whereas on the other hand, this is not possible in a simple electric motor, as it runs at a constant speed in the same direction as long as it is connected to a constant power supply. Apart from increased control, servo motors also provide high precision owing to its working principle - the servomechanism.
4 |
5 | ## What is Servomechanism ?
6 |
7 | Servomechanism is a closed loop control system which aims at achieving a fixed value of the output based on the given command, without using a variable input signal. It works by calculating the difference between the reference input signal or the command signal and the output signal received from a sensor. The feedback signal thus obtained, acts as the input signal for the device to be controlled. Hence, with the help of this feedback mechanism, we can make the output equal the reference input without having to alter the reference input manually at regular intervals. Once the output signal becomes equal to the command signal, the feedback signal goes to zero and hence the process stops till a new command signal is given.
8 |
9 | ## Working of a Servo motor
10 |
11 | A servo motor construction consists of a simple electric motor, some gears, a potentiometer/encoder/resolver, an error detector amplifier, and a control circuit.
12 | Potentiometers, encoders and resolvers all perform the same function by acting as sensors that measure the rotary position of the motor shaft. There are however certain differences in the way they function. If interested, you can take a look at these resources which give a detailed comparison between
13 |
14 | - [Potentiometer](https://www.arrow.com/en/research-and-events/articles/encoder-vs-potentiometer-how-to-choose) [and](https://www.arrow.com/en/research-and-events/articles/encoder-vs-potentiometer-how-to-choose) [Encoder](https://www.arrow.com/en/research-and-events/articles/encoder-vs-potentiometer-how-to-choose)
15 | - [Encoder](https://www.motioncontroltips.com/faq-why-are-so-many-designers-replacing-resolvers-with-encoders/) [and](https://www.motioncontroltips.com/faq-why-are-so-many-designers-replacing-resolvers-with-encoders/) [Resolver](https://www.motioncontroltips.com/faq-why-are-so-many-designers-replacing-resolvers-with-encoders/)
16 |
17 | Let us consider the simple case of a potentiometer used in the servo motor to clearly understand its working.
18 | The potentiometer gives the output reference signal by sensing the position of the shaft, hence its knob is positioned such that it does not produce any signal in the initial condition. Now, the command signal, i.e. the input reference signal, is introduced. This command signal represents how much we want the motor shaft to rotate. Next, the input reference signal and the output reference signal are fed into the error detector amplifier, where their difference is amplified and then generated as the output. This output from the amplifier acts as the input signal for the servo motor, which now starts rotating. The knob of the potentiometer is linked to the motor shaft with the help of a gear arrangement. Thus, as the shaft rotates, the knob of the potentiometer also rotates in a way such that the difference between the input and output reference signals decreases until it becomes zero. When the difference becomes zero, the output of the amplifier also goes to zero and no input signal will be given to the motor, due to which it stops rotating. Now it will remain in this condition until a new command signal is given, so that it generates a difference with the output from the potentiometer, and the process is repeated again.
19 |
20 | ## Applications of Servo motors
21 |
22 | Servo motors have a wide variety of applications ranging from RC toys to industrial machines. They are built in cameras to adjust the focus of the lens. Servo motors are even found in DVD players, where they are used to open/close the disk tray. Due to their high precision and ability to rotate by a desired angle, they are also used in cutting machines such as the milling machine. Servo motors also find numerous applications in the field of robotics, where they are actively being used for making mobile robots as well as to make movable joints in robotic arms which require highly accurate movements.
23 | Depending upon their application, there are different types of servo motors. You can check out these websites ( [1](https://realpars.com/servo-motor/) and [2](https://www.efxkits.us/different-types-servo-motor-applications/) ) to know more on this.
--------------------------------------------------------------------------------
/docs/electronics/Motors/images/servo1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Motors/images/servo1.jpg
--------------------------------------------------------------------------------
/docs/electronics/Motors/images/servoconstr.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Motors/images/servoconstr.jpg
--------------------------------------------------------------------------------
/docs/electronics/Motors/images/servomech.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Motors/images/servomech.jpg
--------------------------------------------------------------------------------
/docs/electronics/Sensors/images/lidar-airborne_lidar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Sensors/images/lidar-airborne_lidar.jpg
--------------------------------------------------------------------------------
/docs/electronics/Sensors/images/lidar-components_of_lidar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Sensors/images/lidar-components_of_lidar.png
--------------------------------------------------------------------------------
/docs/electronics/Sensors/images/lidar-lidar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Sensors/images/lidar-lidar.jpg
--------------------------------------------------------------------------------
/docs/electronics/Sensors/images/lidar-terrestrial_lidar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Sensors/images/lidar-terrestrial_lidar.png
--------------------------------------------------------------------------------
/docs/electronics/Sensors/lidar.md:
--------------------------------------------------------------------------------
1 | # Lidar
2 |
3 | Lidar is a method for calculating distances between objects with the help of a laser and measuring the amount of time taken for the reflected light to return back.
4 |
5 | ## Lidar Sensor
6 |
7 | A Lidar sensor emits pulsed light waves into the surrounding environment. These pulses bounce off of obstacles and the surrounding environment and then return to the sensor. The sensor then, keeps a track of time it took for the light to bounce off and thus calculating the distance between obstacles. Repeating this process constantly creates a real-time map of the environment.
8 |
9 | {: style="height:350px"}
10 |
11 | As an example of how a lidar sensor calculates the distance between the sensor and an obstacle,
12 |
13 | Let's define the following variables,
14 | 1) Speed of light, $c = 3 × 10^8 m/s$
15 | 2) time taken for light to travel from the lidar sensor, hitting the obstacle and returning back to the sensor, $t$
16 | 3) Distance between the obstacle and the sensor, $d$
17 |
18 | Say that the time taken, $t = 5 × 10^{-8} sec$ (Observe the order of magnitude $t$)
19 |
20 | So, to calculate the distance $d$, we use the Newton's second law of motion
21 |
22 | $$ S = u \cdot t + \frac{1}{2} \cdot a \cdot t^2 $$
23 |
24 | Since, speed of light constant, replacing, $a = 0$, $u = c$, and, $S = d$ we get,
25 |
26 | $$ d = c \cdot t $$
27 |
28 | $$ d = 3 × 10^8 × 5 * 10^{-8} $$
29 |
30 | $$ d = 15m $$
31 |
32 | Therfore, the distance between the sensor and the obstacle is calculated to be 15 meters. This is the basic calculation that goes into calculating the distances.
33 |
34 | ### Types of Lidar Systems
35 |
36 | 1) Airborne Lidar - This is installed on aerial drones or vehicles like helicopters. It emits light towards the ground surface giving a fairly detailed and quick map of the terrain above which the vehicle or drone is flying. It is also used for topographic survey.
37 |
38 | {: style="height:200px"}
39 |
40 | 2) Terrestrial Lidar - This is generally installed on vehicles moving on the earth's surface. These give a detailed map, and can be used to make a robot or a vehicle navigate through it's evironment. It is also used for observing highways, roads and infrastructure.
41 |
42 | {: style="height:200px"}
43 |
44 |
45 | ### Components of a basic Lidar Sensor
46 |
47 | {: style="height:350px"}
48 |
49 | A lidar sensor generally consists of 4 main components:
50 | 1) Light source - Generally a laser (or anything that emits light in pulses)
51 | 2) Optical components - There are multiple optical components for example, the light through the sensor, falls on a rotating/oscillating mirror so as to change the direction of light to cover a 360 view. An optical lens helps to focus light on the photodetector.
52 | 3) photodector - The light is recieved by this photodetector and the signal is processed electronically like frequency of light (for speed measurements) and the time taken for the light to bounce.
53 | 4) GPS - These sensors need a GPS system to determine the exact position and orientation of the sensor in 3D space.
54 |
55 | For a more indepth explaination of a Lidar sensor and the different factors that go into designing one, for example, the wavelength of light to use, the pulsing rate of the light or pulse repetition rate and more factors can be found [here.](https://www.newport.com/n/lidar)
56 |
57 | ## Lidar usage
58 |
59 | To implement Lidar into your ros program, these are the following steps you must follow:
60 | * Connect your Lidar sensor to a power supply, and connect a data transmitter to the Lidar sensor and the computer.
61 | * You need to give permissions to the on data input port of the computer. To check the permissions, type
62 | ```bash
63 | ls -l /dev/tty
64 | ```
65 | * If your permissions are set properly, you should get an output like shown below. Just focus on the starting part, ```crw-rw-rw```. If instead, it is something of the form ```crw-rw--```, then your permissions are not set properly.
66 | ```bash
67 | crw-rw-rw- 1 root dialout 5, 0 Sep 6 23:50 /dev/ttyACM0
68 | ```
69 | * To set permissions, (replace ```ACM0``` with whatever your ports are)
70 | ```bash
71 | sudo chmod a+rw /dev/ttyACM0
72 | ```
73 | * Next, you need to download the package of your Lidar manufacturer. Following are the common packages and their github links. You need to clone these github repositories in the src directory of your catkin workspace.
74 |
75 | 1) [Slamtec](https://github.com/Slamtec/rplidar_ros)
76 | 2) [YDLiDAR](https://github.com/EAIBOT/ydlidar)
77 | 3) [Hokuyo](https://github.com/ros-drivers/urg_node)
78 | 4) [ROS SICK](https://github.com/SICKAG/sick_scan)
79 | 5) [ROS2 SICK](https://github.com/SICKAG/sick_scan2)
80 | 6) [RoboSense](https://github.com/RoboSense-LiDAR/rslidar_sdk)
81 | * After you have cloned the ros packages, go into your workspace directory,
82 | ```bash
83 | catkin_make
84 | source devel/setup.bash
85 | ```
86 | * Now just run the launch file according to your Lidar manufacturer package. For the above 6 manufacturers, run the following launch files. (If you are getting package not found error, please give appropriate permissions to the launch files using chmod).
87 |
88 | 1) Slamtec
89 | ```bash
90 | roslaunch rplidar_ros rplidar.launch
91 | ```
92 | 2) YDLiDAR
93 | ```bash
94 | roslaunch ydlidar lidar_view.launch
95 | ```
96 | 3) Hokuyo
97 | ```bash
98 | roslaunch urg_node urg_lidar.launch
99 | ```
100 | 4) ROS SICK - Read the README file in the [github repo](https://github.com/SICKAG/sick_scan) for which launch file you need for your specific model.
101 |
102 | 5) ROS2 SICK - Read the README file in the [github repo](https://github.com/SICKAG/sick_scan2) for which launch file you need for your specific model.
103 |
104 | 6) RoboSense
105 | ```bash
106 | roslaunch rslidar_sdk start.launch
107 | ```
108 |
109 | For a much more detailed guide, use [this link.](https://www.generationrobots.com/blog/en/lidar-integration-with-ros-quickstart-guide-and-projects-ideas) This shows a fairly detailed explaination on how to setup your lidar to interact with ROS and display the results in rviz. It also has some examples of implementation and different repositories that would help you to code.
110 |
111 | You can also check out [this link](https://maker.pro/ros/tutorial/how-to-use-a-lidar-sensor-with-robot-operating-system-ros) which provides a simple explaination for setting up a YDLiDAR X4 Sensor.
112 |
113 | ## Applications of Lidar
114 |
115 | 1) Surveying land - Lidar sensors can generate a cost effective solution for generating a 3D digital terrain model of remote or rough areas which are difficult to assess otherwise. (Nasa used Lidar techonology to explore mars). For more information on Airborne Lidar and Topographic survey, check out [this research paper](https://www.isprs.org/proceedings/XXXVII/congress/3b_pdf/50.pdf).
116 | 2) Power line inspection - Power lines span very long distances and thus make the inspection of power lines very difficult. Lidar sensors can make the inspection easier, by identifying faults before they can cause any real damage.
117 | 3) Farming and Forest research - These can be deployed to large farms to help determine how to use resources in an efficient manner and boost productivity. They can also be used to research on the impact that humans have caused on natural life in forests, as Lidar sensors can penetrate tree cover.
118 | 4) Climate and weather change - Climate scientists use Lidar to study and track changes in the atmosphere. Lidar can also be used to warn people if there is a Tsunami incoming.
119 | 5) Robotics - Lidar is used to equip robots with Mapping and navigational capabilities. For example, self driving cars.
120 |
121 | ## Companies working on Lidar technologies
122 |
123 | 1) [tuSimple](https://www.tusimple.com/) - works on self driving cars which is almost commercial ready.
124 | 2) [AEye](https://www.aeye.ai/) - Develops advanced vision hardware, software and algorithms for autonomous vehicles.
125 | 3) [SiLC Technologies](https://www.silc.com/) - Is a leading provider of highly integrated FMCW (Frequency Modulated Continuous Wave) Lidar solutions, which include their FMCW integration chip.
126 |
127 | ## References -
128 |
129 | * George, N., 2021. 11 Interesting LiDAR Applications. [online] Blog.cloudfactory.com. Available at: [Accessed 7 September 2021].
130 |
131 | * Geospatial World. 2021. What is LiDAR technology and how does it work?. [online] Available at: [Accessed 7 September 2021].
132 |
133 | * Microdrones.com. 2021. 5 Compelling Applications for LiDAR Technology. [online] Available at: [Accessed 7 September 2021].
134 |
135 | * Sentech. 2021. The revealing science behind Lidar technology. [online] Available at: [Accessed 7 September 2021].
136 |
137 | * Velodyne Lidar. 2021. What is Lidar? Learn How Lidar Works | Velodyne Lidar. [online] Available at: [Accessed 7 September 2021].
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/Jetsonnano.md:
--------------------------------------------------------------------------------
1 | {: style="height:200px"}
2 |
3 | # Getting Started with NVIDIA Jetson Nano
4 |
5 | The NVIDIA Jetson Nano Developer Kit is a small edge computer for AI development. The Jetson Nano Developer Kit packs a Quad-core ARM A57 CPU with a clock-rate of 1.43GHz and 4GB of low-power DDR4 Memory.
6 |
7 | The NVIDIA Jetson Nano Developer Kit is a small edge computer for AI development.
8 |
9 |
10 | The Jetson Nano Developer Kit packs a Quad-core ARM A57 CPU with a clock rate of 1.43GHz and 4GB of low-power DDR4 memory. For the connectors, it has 4x USB 3.0, 1xUSB2.0 Micro-B for powering with 5V, an HDMI and Display Port connector for connecting displays, as well as one or two camera connectors that allow you to connect a Raspberry Pi Camera.
11 | 
12 |
13 | |**Parameter**|**Meaning**|
14 | |---------|-------|
15 | |GPU |128-core Maxwell|
16 | |CPU |Quad-core ARM A57 @ 1.43 GHz|
17 | |MEMORY |4 GB 64-bit LPDDR4 25.6 GB/s|
18 | |STORAGE |microSD (not included)|
19 | |VIDEO ENCODER |4K @ 30 , 4x 1080p @ 30 , 9x 720p @ 30 (H.264/H.265)|
20 | |VIDEO DECODER |4K @ 60 , 2x 4K @ 30 , 8x 1080p @ 30 , 18x 720p @ 30 (H.264/H.265)|
21 | |CAMERA |2x MIPI CSI-2 DPHY lanes|
22 | |CONNECTIVITY |Gigabit Ethernet, M.2 Key E|
23 | |DISPLAY |HDMI and display port|
24 | |USB |4x USB 3.0, USB 2.0 Micro-B|
25 | |OTHERS |GPIO, I2C, I2S, SPI, UART|
26 | |MECHANICAL |69 mm x 45 mm, 260-pin edge connector|
27 |
28 | ### Requirements
29 | Besides the Jetson Nano Developer Kit, you'll also need a microSD card, a power supply (5V 2A), and an ethernet cable or WiFi adapter.
30 |
31 | ### microSD card
32 |
33 | The Jetson Nano uses a microSD card as a boot device and primary storage. The minimum size for the microSD card is 16GB, but I would strongly recommend getting at least 32GB. It's also essential to get a fast microSD as this will make working on the Jetson Nano a lot more fluent.
34 |
35 | ### Power Supply
36 |
37 | The Jetson Nano can be powered in three different ways: over USB Micro-B, Barrel Jack connector, or through the GPIO Header.
38 |
39 | To power the Jetson Nano over USB Micro-B, the power supply needs to supply 5V 2A. Unfortunately, not every power supply is capable of providing this. NVIDIA specifically recommends a 5V 2.5A power supply from Adafruit, but I use a Raspberry Pi power supply, and it works just fine.
40 |
41 | If you want to get the full performance out of the Jetson Nano, I'd recommend using the Barrel Jack instead of powering over USB because you can supply 5V 4A over the Barrel Jack.
42 |
43 | Before connecting the Barrel Jack, you need to place a jumper on J48. The power jumper location can vary depending on if you have the older A02 model or, the newer B01 model.
44 |
45 | ### Ethernet cable or WiFi Adapter
46 |
47 | Lastly, you'll need an ethernet cable or a WiFi Adapter since the Jetson Nano doesn't come with one. For the WiFi Adapter, you can either use one that connects through USB or a PCIe WiFi Card like the Intel® Dual Band Wireless-AC 8265.
48 |
49 | ### Setup
50 |
51 | Before we can get started setting up a Python environment and running some deep learning demos, we have to download the Jetson Nano Developer Kit SD Card Image and flash it to the microSD card.
52 |
53 | After inserting the microSD card, you can connect the power supply, which will automatically boot up the system.
54 |
55 | When you boot the system for the first time, you'll be taken through some initial setup, including:
56 |
57 | Review and accept NVIDIA Jetson software EULA
58 | Select system language, keyboard layout, and time zone
59 | Create username, password, and computer name
60 | Log in
61 | After the initial setup, you should see the following screen:
62 | 
63 |
64 | ### Increasing swap memory
65 |
66 | Recent releases of JetPack enable swap memory as part of the default distribution using the zram module. By default, 2GB of swap memory is enabled. To change the amount of swap memory, you can either edit the /etc/systemd/nvzramconfig.sh file directly or use the resizeSwapMemory repository from JetsonNanoHacks.
67 |
68 | ```
69 | git clone https://github.com/JetsonHacksNano/resizeSwapMemory
70 | cd resizeSwapMemory
71 | ./setSwapMemorySize.sh -g 4
72 | ```
73 |
74 | After executing the above command, you'll have to restart the Jetson Nano for the changes to take effect.
75 |
76 | ### Installing prerequisites and configuring your Python environment
77 |
78 | Now that the Jetson Nano is ready to go, we will create a deep learning environment. We will start by installing all prerequisites and configuring a Python environment, and how to code remote using VSCode Remote SSH.
79 |
80 | ### Installing prerequisites
81 |
82 | ```
83 | sudo apt-get update
84 | sudo apt-get upgrade
85 |
86 | sudo apt-get install git cmake python3-dev nano
87 |
88 | sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev
89 | ```
90 | ### Configuring your Python environment
91 |
92 | Next, we will configure our Python environment. This includes downloading pip3 and virtualenv.
93 |
94 | ### Install pip
95 |
96 | ```
97 | sudo apt-get install python3-pip
98 | sudo pip3 install -U pip testresources setuptools
99 | ```
100 | For managing virtual environments, we'll be using virtualenv, which can be installed as below:
101 |
102 | ```
103 | sudo pip install virtualenv virtualenvwrapper
104 | ```
105 | To get virtualenv to work, we need to add the following lines to the ` ~/.bashrc` file:
106 |
107 | ```
108 | # virtualenv and virtualenvwrapper
109 | export WORKON_HOME=$HOME/.virtualenvs
110 | export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
111 | source /usr/local/bin/virtualenvwrapper.sh
112 | ```
113 | To activate the changes, the following command must be executed:
114 | ```
115 | source ~/.bashrc
116 | ```
117 | Now we can create a virtual environment using the `mkvirtualenv` command.
118 |
119 | ```
120 | mkvirtualenv ml -p python3
121 | workon ml
122 | ```
123 |
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/Raspberrypi.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Getting Started with Raspberry Pi
4 |
5 | #### Things You will Need
6 |
7 | * Raspberry Pi 4 B [In this guide]
8 | * A 15W USB-C power supply – we recommend the official Raspberry Pi USB-C Power Supply
9 | * Micro SD card reader for flashing Raspian OS.
10 | * Micro SD card Raspberry Pi OS, installed using the Raspberry Pi Imager
11 | * A keyboard , display and mouse
12 | * HDMI to micro HDMI Cable to connect to display via Raspberry Pi 4's micro HDMI ports
13 | * An ethernet cable (optional)
14 |
15 | #### Pinouts
16 |
17 | 
18 | 
19 |
20 | #### Powering Up Raspberry Pi
21 |
22 | The Raspberry Pi 4 B requires a charger that can output 5 volts and 3 amps. Most USB Type-C phone chargers don't have enough amps to get the job done, unless they have USB PD capability, but USB-C laptop chargers should all work. While it's unlikely to be a problem, note that Pi 4 models that were manufactured in 2019 or early 2020 have a bug which prevents them from charging over high-speed data cables that support USB 3.x 5 or 10 Gbps connections.
23 |
24 | 
25 |
26 | **Note :** The Pi doesn't have a built-in power switch, so the default way to turn it on is to plug it in. However, to avoid data loss, you'll want to use the shutdown feature in your operating system (OS) before unplugging or switching it off.
27 |
28 | ### Headless Install for Raspberry Pi
29 |
30 | If you just want to experiment with the Pi or use it to control physical objects like lights, motors and sensors, you don't need to give it its own screen and keyboard then you have to do following steps.
31 |
32 | **Step 1: Installing Raspberry Pi OS on Your microSD card**
33 |
34 | 1. Insert a microSD card into your computer your card should be 8GB or larger(preferrably 32GB).
35 | 
36 |
37 | 2. Download, install and run Raspberry Pi Imager.
38 | 
39 |
40 | 3. Click the Choose OS button, a menu will appears.
41 | 
42 |
43 | 4. Select Raspberry Pi OS (32-bit) from the OS menu.
44 |
45 |
46 | 5. Click Choose SD card and select your card from the menu.
47 |
48 | 
49 |
50 | 6. Click Write. This process will take several minutes as Raspberry Pi Imager downloads Raspberry Pi OS and burns it to your microSD card.
51 | **Note:- If you were not setting up a headless Raspberry Pi, you can just pop the card in, connect your Pi to a monitor, keyboard, power source and pointing device and boot it up. However, that's not our goal here.**
52 |
53 | 
54 |
55 | 7. Write an empty text file named "ssh" (no file extension) to the root of the directory of the card. When it sees the "ssh" on its first boot-up, Raspberry Pi OS will automatically enable SSH (Secure Socket Shell), which will allow you to remotely access the Pi command line from your PC.
56 |
57 | 8. Configure a network connection for your Raspberry Pi.Though you've enabled SSH, which will let you log in and issue terminal commands, you still need a way to actually reach your Pi. You can connect via Wi-Fi / Ethernet, direct Ethernet connection or direct USB connection (Pi Zero only). Here are instructions for each.
58 |
59 | **Step 2: Headless Wi-Fi / Ethernet**
60 |
61 | To setup a Wi-Fi connection on your headless Raspberry Pi, create a text file called wpa_supplicant.conf, and place it in the root directory of the microSD card. You will need the following text in the file.
62 |
63 | 
64 |
65 | ```
66 | country=US
67 | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
68 | update_config=1
69 |
70 | network={
71 | scan_ssid=1
72 | ssid="your_wifi_ssid"
73 | psk="your_wifi_password"
74 | }
75 | ```
76 |
77 | Change the country to "GB" for the UK or to another country code for a different country, and enter your actual SSID and password. Upon boot up, Raspberry Pi OS will log you into that network. However, if you're on a public Wi-Fi network that requires you to click "Ok" on a splash page before you get Internet, this method won't work.
78 |
79 | Prefer to use Ethernet? If you plug your Raspberry Pi directly to a wired network, you should be able to access it by its name (raspberrypi or raspberrypi.local) without changing any other files.
80 |
81 | **Step 3: Direct USB Connection (Pi Zero / Zero W Only)**
82 |
83 | My favorite way to connect is via a direct USB connection, plugging my Pi Zero W directly into a port on my PC. This method is great, because it works no matter where you are (even if there's no available Wi-Fi), and it provides both power and a connection to your Pi, over a single cable. However, you can only do this on a Pi Zero or Zero W.
84 |
85 | 
86 |
87 | 1. Open the file config.txt in the root directory of the micro SD card, and add the line dtoverlay=dwc2 to the very bottom of the file and save.
88 |
89 | 
90 |
91 | 2. Open cmdline.txt and add the text modules-load=dwc2,g_ether after the word rootwait, and save the file. There are no linebreaks in this file.
92 |
93 | 
94 |
95 | 3. Download and install Bonjour Print Services(opens in new tab) from apple.com (if you have Windows). It seems strange that you would need an Apple program to access a Pi from Windows, but this helps your PC see the Pi. Ignore the name; you're not using this for printing.
96 |
97 | 
98 |
99 | 4. Connect the micro USB cable to the port labeled "USB" on the Pi Zero. This will not work if you connect to the port labeled "PWR." However, the "USB" port will also supply power to your Pi, so you don't need to connect a dedicated power wire.
100 |
101 | **Step 4: Direct Ethernet Connection**
102 |
103 | If your PC has a spare Ethernet port or you have an Ethernet-to-USB dongle, you can use a network cable to go directly from your Pi to your computer. Just make sure that you have Bonjour installed on your PC and SSH enabled on the Pi (see above). Then, you can just connect the two devices over Ethernet.
104 |
105 | If you want the Raspberry Pi to get its Internet connection from your PC over the Ethernet port, you need to do the following in Windows 10:
106 |
107 | 1. Navigate to the Network Connections menu, which is part of the old-school Control Panel. You can get to this screen by going to Settings->Network & Internet->Wi-Fi and then clicking "Change Adapter Settings" on the right side of the screen. This works whether you are sharing an Internet connection that comes to your PC from Wi-Fi or from Ethernet.
108 | 
109 |
110 | 2. Right-click on the adapter that's connected to the Internet, and select properties.
111 | 
112 |
113 | 3. Enable "Allow other network users to connect" on the "Sharing" tab.
114 | 
115 |
116 | 4. Select the Ethernet port that is connected to the Raspberry Pi from the "Home networking connection" menu, and click Ok.
117 | 
118 |
119 |
120 | **Step 5: Connecting via SSH**
121 |
122 | After you have the Pi connected to your network or directly to your PC, you'll need to establish an SSH connection.
123 |
124 | 1. Download and install Putty if you don't already have it. Putty is the leading SSH client for Windows.
125 | 
126 |
127 | 2. Enter raspberrypi or raspberrypi.local as the address you wish to connect to in Putty, and click Open. You usually need to add the .local if the Pi is directly connected to your PC via USB or Ethernet cable.
128 | 
129 |
130 | 3. Click Ok if you get a security warning alert. It's not a problem.
131 |
132 | 4. Enter pi as your username and raspberry as your password. You may want to change these later.
133 | 
134 | Now you're connected at the command prompt, but if you want to access the GUI, complete with a desktop and floating windows, you'll need to enable VNC.
135 |
136 | **Step 6: Enabling and Connecting over VNC**
137 |
138 | 1. Enter sudo raspi-config at the command prompt.A configuration app opens.
139 | 
140 | 2. Select Interfacing Options (number 5 on the list).
141 | 
142 | 3. Select VNC (number 3 on the menu).
143 | 
144 | 4. Select Yes.
145 | 5. Hit Enter to acknowledge the VNC server is enabled.
146 | 6. Select Finish
147 |
148 | **On your PC:**
149 |
150 | 1. Download, install and launch VNC Viewer.
151 | 
152 |
153 | 2. Select New connection from the File menu.
154 | 
155 |
156 | 3. Enter raspberry.local in the "VNC Server" field. If this does not work, try again with the name "raspberrypi" without .local.
157 | 
158 |
159 | 4. Click Ok.
160 | 
161 |
162 | 5. Double-click on the connection icon to connect.
163 |
164 |
165 | 6. Click Ok if you are shown a security warning.
166 |
167 | 7. Enter the Pi's username and password when prompted. The defaults are username: pi and password: raspberry. Click Ok.
168 | 
169 |
170 | Your Raspberry Pi desktop will then appear in a window on your main computer's desktop. You'll be able to control everything from there.
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/GPIO-diagram-Raspberry-Pi-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/GPIO-diagram-Raspberry-Pi-4.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/Jetson.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/Jetson.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/boardlayoutraspberrypi.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/boardlayoutraspberrypi.webp
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/img1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/img1.webp
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/img2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/img2.webp
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/img3.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/img3.webp
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/img4.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/img4.webp
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/img5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/img5.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/img6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/img6.jpeg
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/jet1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/jet1.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/jet2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/jet2.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras1.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras10.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras11.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras12.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras13.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras14.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras15.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras16.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras17.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras18.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras19.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras2.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras20.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras3.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras4.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras5.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras6.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras7.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras8.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/ras9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/ras9.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/raspberrypi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/raspberrypi.png
--------------------------------------------------------------------------------
/docs/electronics/Single_board_computer/images/thumbnail-1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/electronics/Single_board_computer/images/thumbnail-1.jpeg
--------------------------------------------------------------------------------
/docs/electronics/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 | Electronics are essential to robotics, from connecting microprocessors to building logical circuits. At the end of the day, every action a robot takes is ultimately based on a signal it has received.
3 | Any robotics project that requires electronics must complete duties like establishing the power source, connecting sensors, establishing the compute unit, etc.
4 | Most robots include a processing unit on board that gathers information from sensors and does all calculations to determine the actions the robot should take. Popular robot processors include the Raspberry Pi, Nvidia Jetson, Arduino, and others.
--------------------------------------------------------------------------------
/docs/images/RISC Logo Dark Blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/images/RISC Logo Dark Blue.png
--------------------------------------------------------------------------------
/docs/images/Spaceship (3).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/images/Spaceship (3).png
--------------------------------------------------------------------------------
/docs/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/images/logo.png
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | # RISC Handbook
2 |
3 | Robotics in its long journey has inspired this handbook which is organized in four layers which includes mechanical system designing, electronics, machine automation and simulation.
4 |
5 | .png)
--------------------------------------------------------------------------------
/docs/javascripts/config.js:
--------------------------------------------------------------------------------
1 | window.MathJax = {
2 | tex: {
3 | inlineMath: [["\\(", "\\)"]],
4 | displayMath: [["\\[", "\\]"]],
5 | processEscapes: true,
6 | processEnvironments: true
7 | },
8 | options: {
9 | ignoreHtmlClass: ".*|",
10 | processHtmlClass: "arithmatex"
11 | }
12 | };
13 |
--------------------------------------------------------------------------------
/docs/mechanical/Forward and Inverse Kinematics.md:
--------------------------------------------------------------------------------
1 | # Forward Kinematics
2 |
3 | The forward kinematics problem for a serial-chain manipulator is to find the position and orientation of the end-effector relative to the base given the positions of all of the joints and the values of all of the geometric link parameters. Often, a frame fixed in the end-effector is referred to as the tool frame, and while fixed in the final link N, it in general has a constant offset in both position and orientation from frame N. Likewise, a station frame is often located in the base to establish the location of the task to be performed. This frame generally has a constant offset in its pose relative to frame 0, which is also fixed in the base. In practice, the forward kinematics problem is solved by calculating the transformation between a coordinate frame fixed in the end-effector and another coordinate frame fixed in the base, i.e., between the tool and station frames. This is straightforward for a serial chain since the transformation describing the position of the end-effector relative to the base is obtained by
4 | simply concatenating transformations between frames fixed in adjacent links of the chain.
5 |
6 | {: style="height:500px align=centre"}
7 |
8 | # Inverse Kinematics
9 |
10 | The inverse kinematics problem for a serial-chain manipulator is to find the values of the joint positions given the position and orientation of the end-effector relative to the base and the values of all of the geometric link parameters. Once again, this is a simplified statement applying only to serial chains. A more general statement is: given the relative positions and orientations of
11 | two members of a mechanism, find the values of all of the joint positions. This amounts to finding all of the joint positions given the homogeneous transformation between the two members of interest. When solving the inverse problem, we often have to choose one solution from a number of valid solutions. There are also degenerate cases with an infinite number of solutions Some solutions of the inverse mapping may not be physically realizable. This is due to manipulators having physical joint limits that prevent the mechanism from achieving certain joint configurations that may be solutions to the inverse kinematics problem (e.g. a joint may not have a full 360 degree motion)
12 |
13 | {: style="width:500px"}
14 |
15 | {: style="width:500px"}
16 |
17 | To get a more detailed idea of solving inverse and forward kinematics problems for robotic system do checkout this 3 part video series from milfordrobotics
18 |
19 | [Part-1](https://www.youtube.com/watch?v=VjsuBT4Npvk)|
20 | [Part-2](https://www.youtube.com/watch?v=3ZcYSKVDlOc&t=683s)|
21 | [Part-3](https://www.youtube.com/watch?v=llUBbpWVPQE)
--------------------------------------------------------------------------------
/docs/mechanical/Gears.md:
--------------------------------------------------------------------------------
1 | # Gears
2 |
3 | ## What are Gears?
4 |
5 | * Gears are defined as toothed element which are used for transmitting rotary motion from one shaft to another.
6 | * Gears are most often used in transmissions to convert an electric motor’s high speed and low torque to a shaft’s requirements for low speed high torque.
7 | * Gears essentially allow positive engagement between Teeth, so high forces can be transmitted while still undergoing essentially rolling contact.
8 | * Gears do not depend on friction as belt drives and do best when friction is minimized.
9 | * The motion and power transmitted by gears is kinematically equivalent to that transmitted by friction wheels or discs.
10 |
11 | {: style="height:350px"}
12 |
13 | _(Transmission of Power)_
14 |
15 | * In order to avoid the slipping, a number of projections (called teeth) as shown in Fig. (b), are provided on the periphery of the wheel A, which will fit into the corresponding recesses on the periphery of the wheel B. A friction wheel with the teeth cut on it is known as **_toothed wheel or gear._** **_The usual connection to show the toothed wheels is by their pitch circles_**
16 |
17 | {: style="height:350px"}
18 |
19 | ## Advantages and Disadvantages
20 |
21 | ### Advantages
22 |
23 | 1. It transmits exact velocity ratio.
24 | 2. It may be used to transmit large power.
25 | 3. It has high efficiency.
26 | 4. It has reliable service.
27 | 5. It has compact layout.
28 |
29 | ### Disadvantages
30 |
31 | 1. The manufacture of gears require special tools and equipment.
32 | 2. The error in cutting teeth may cause vibrations and noise during operation.
33 |
34 | ## Types of Gears
35 |
36 | * **According to the position of axes of the shaft**
37 | * Parallel: Spur gear, Helical gear, Rack and Pinion
38 | * Intersecting: Bevel Gear
39 | * Non Intersecting and Non Parallel: Worm and Worm Gears
40 |
41 | * **According to the periphery velocity**
42 | * Low Velocity
43 | * Medium Velocity
44 | * High Velocity
45 |
46 | * **According to the type of gearing**
47 | * External Gearing
48 | * Internal Gearing
49 | * Rack and Pinion
50 |
51 | * **According to the position of teeth on surface**
52 | * Straight
53 | * Inclined
54 | * Curved
55 |
56 | ## Spur Gear
57 |
58 | Spur gears are a type of cylindrical gear, with shafts that are parallel and coplanar, and teeth that are straight and oriented parallel to the shafts. They’re arguably the simplest and most common type of gear – easy to manufacture and suitable for a wide range of applications.
59 |
60 | {: style="height:350px"}
61 |
62 | The teeth of a spur gear have an involute profile and mesh one tooth at a time. The involute form means that spur gears only produce radial forces (no axial forces), but the method of tooth meshing causes high stress on the gear teeth and high noise production. Because of this, spur gears are typically used for lower speed applications, although they can be used at almost any speed.
63 |
64 | Spur gears are generally seen as best for applications that require speed reduction and torque multiplication, such as ball mills and crushing equipment. Examples of high-speed applications that use spur gears – despite their high noise levels – include consumer appliances such as washing machines and blenders. And while noise limits the use of spur gears in passenger automobiles, they are often used in aircraft engines, trains, and even bicycles.
65 |
66 | ## Helical Gear
67 |
68 | The teeth of a helical gear are set at an angle (relative to axis of the gear) and take the shape of a helix. This allows the teeth to mesh gradually, starting as point contact and developing into line contact as engagement progresses.
69 |
70 | One of the most noticeable benefits of helical gears over spur gears is less noise, especially at medium- to high-speeds. Also, with helical gears, multiple teeth are always in mesh, which means less load on each individual tooth. This results in a smoother transition of forces from one tooth to the next, so that vibrations, shock loads, and wear are reduced. One interesting thing about helical gears is that if the angles of the gear teeth are correct, they can be mounted on perpendicular shafts, adjusting the rotation angle by 90 degrees.
71 |
72 | 
73 |
74 | Helical gears are often the default choice in applications that are suitable for spur gears but have non-parallel shafts. They are also used in applications that require high speeds or high loading. And regardless of the load or speed, they generally provide smoother, quieter operation than spur gears.
75 |
76 | ## Bevel Gear
77 |
78 | Bevel gears are gears where the axes of the two shafts intersect and the tooth-bearing faces of the gears themselves are conically shaped. Bevel gears are most often mounted on shafts that are 90 degrees apart, but can be designed to work at other angles as well. The pitch surface of bevel gears is a cone.
79 |
80 | {: style="height:350px"}
81 |
82 | There are several types of bevel gears based on the shape of their teeth.
83 |
84 | * **Straight**
85 | * They have conical pitch surface and teeth are straight and tapering towards apex.
86 | * They are useful to verify the transmission of the motion that is generated between axes that intersect within one same plane, almost always at a 90-degree angle.
87 | * Straight bevel gears have many uses in watches, dentist drills, hand drills and vending machines.
88 |
89 | * **Spiral**
90 | * They have curved teeth at an angle allowing tooth contact to be gradual and smooth and operate at very steep planes.
91 | * Spiral bevel gears provide a high level of control over the way in which teeth mesh, and their design allows for certain mounting deflections without excessively increasing the load on either end of the teeth.
92 | * They can be used at high speeds, and are usually employed in motorcycle and bicycle gears.
93 |
94 | * **Hypoid**
95 | * These are similar to spiral bevel, but the pitch surfaces are hyberbolic and not conical. The pinion can be offset above or below the gear center, thus allowing larger pinion diameter, longer life, and smoother mesh.
96 | * In addition to being used in industrial machinery, they are commonly used in the automotive industry, where it is used in rear-wheel drive vehicles to connect the driveshaft with the wheels.
97 |
98 | ## Worm Gears
99 |
100 | Worm gears are constructed of a worm and a gear (sometimes referred to as a worm wheel), with non-parallel, non-intersecting shafts oriented 90 degrees to each other. The worm is analogous to a screw with a V-type thread, and the gear is analogous to a spur gear. The worm is typically the driving component, with the worm’s thread advancing the teeth of the gear.
101 |
102 | {: style="height:350px"}
103 |
104 | The primary benefit of worm gears is their ability to provide high reduction ratios (like 20:1 and even up to 300:1 or greater) and correspondingly high torque multiplication. They can also be used as speed reducers in low- to medium-speed applications. And, because their reduction ratio is based on the number of gear teeth alone, they are more compact than other types of gears. Worm gears are used widely in material handling and transportation machinery, machine tools, automobiles etc.
105 |
106 | ## Herringbone Gear
107 |
108 | The herringbone gear consists of two sets of gear teeth on the same gear, one right hand and one left hand. Having both hands of gear teeth, causes the thrust of one set to cancel out the thrust of the other. It is used for transmitting power between parallel shafts. It was developed to overcome the disadvantage of the high-end thrust that is present with single-helical gears. Also another advantage of this gear type is quiet, smooth operation at higher speeds. They are mostly used on heavy machinery.
109 |
110 | 
111 |
112 | ## Rack and Pinion
113 |
114 | A rack and pinion drive system consists of a rack (or a “linear gear”) and a pinion (or “circular gear”), which operate to convert rotational motion into linear motion. A rack and pinion drive can use both straight and helical gears. These systems provide high-speed travel over extremely long lengths and are frequently used in large gantry systems for material handling, machining, welding and assembly, especially in the automotive, machine tool, and packaging industries.
115 |
116 | 
117 |
118 | ## Planetary Gear
119 |
120 | A planetary gear set is made up of three types of gears; a sun gear, planet gears, and a ring gear. The sun gear is located at the center, and transmits torque to the planet gears which are typically mounted on a moveable carrier. The planet gears orbit around the sun gear and mesh with an outer ring gear. Planetary gear systems can vary in complexity from very simple to intricate compound systems, depending on the application.
121 |
122 | {: style="height:250px"}
123 |
124 | Planetary gear systems are able to produce a lot of torque because the load is shared among multiple planet gears. This arrangement also creates more contact surfaces and a larger contact area between the gears than a traditional parallel axis gear system. Because of this, in the load is more evenly distributed and therefore the gears are more resistant to damage.
125 |
126 | Planetary gears are often used when space and weight are an issue, but a large amount of speed reduction and torque are needed. This requirement applies to a variety of industries, including tractors and construction equipment where a large amount of torque is needed to drive the wheels. Other places you will find planetary gear sets include turbine engines, automatic transmissions, and even electric screwdrivers.
--------------------------------------------------------------------------------
/docs/mechanical/Introduction to Dynamics.md:
--------------------------------------------------------------------------------
1 | # Introduction to Dynamics
2 |
3 | For many applications with fixed-based robots we need to find a multi-body dynamics formulated as:
4 |
5 | $$ M(q)\ddot{q} + b(q,\dot{q}) + g(q) = \tau \: + J_{c}(q)^{T}F_{c} $$
6 |
7 | consisting of the following components:
8 |
9 | $M(q)$ $\epsilon$ $\mathbf{R}$ $^{n_{q}Xn_{q}}$ Generalized Mass matrix(orthogonal)
10 |
11 | $q, \dot{q}, \ddot{q}$ $\epsilon$ $\mathbf{R}^{n_{q}}$ Generalized position, velocity and acceleration vectors
12 |
13 | $b(q, \dot{q})$ $\epsilon$ $\mathbf{R}^{n_{q}}$ Coriolis and centrifugal terms.
14 |
15 | $g(q)$ $\epsilon$ $\mathbf{R}^{n_{q}}$ Gravitational terms.
16 |
17 | $\tau$ $\epsilon$ $\mathbf{R}^{n_{q}}$ External generalized forces.
18 |
19 | $F_{c}$ $\epsilon$ $$\mathbf{R}^{n_{q}}$ External Cartesian forces (e.g. from contacts)
20 |
21 | $J_{c}(q)$ $\epsilon$ $\mathbf{R}^{n_{q}Xn_{q}}$ Geometric Jacobian corresponding to the external forces.
22 |
23 | Different methods exist to compute the so-called Equations of Motion (EoM) of a given system, i.e., a closed-form mathematical model of the system dynamics. The two most common methods used in robotics are Newton-Euler method which essentially applies the principles of conservation of linear and angular momentum for all links of a robot and Lagrange Method which utilizes scalar energy-based functions over the the space of generalized coordinates which adhere to certain minimization principles, thus resulting in trajectories which automatically satisfy the kinematic constraints of the system.
24 |
25 | to understand better how problems related to dynamics in robotics are tackled do give a watch to this [lecture](https://www.youtube.com/watch?v=B67ug1yx13E) on robot dynamics by IIT KGP Prof. Dilip Kumar Pratihar
26 |
27 | ## Newton-Euler Method
28 |
29 | ### Newton-Euler for Single Bodies
30 |
31 | a very well known formulation formed by Newton and Euler using law of angular and linear momentum is :
32 |
33 | $\dot{\mathsf{p}} _{S}$ = $F_{ext,S}$
34 |
35 | $\dot{\mathbf{N}}_{S}$ = $T_{ext}$
36 |
37 | where $F_{ext,S}$ are the resultant external forces that act through the COG and $T_{ext}$ are the resultant external torques. External forces which do not act through the COG need to be shifted to an equivalent force/moment pair of which the force acts through the COG.
38 |
39 | ### Newton-Euler for Multi-Body Systems
40 |
41 | When dealing with multi-body systems, a valid approach is to separate all bodies at the joints as depicted in and to consider every body as a single unit. Thereby, the constraint forces F$_{i}$ at the joints must be introduced as external forces acting on each of the bodies when cut free. For all these bodies, we must then apply conservation of linear and angular momentum in all DoFs, subject to external forces (which now include the joint forces F$_{i}$ , too). For a general 3D case and a fixed base, this results in a 6$n_{j}$ -dimensional systems of equations. Additionally, there are 5 $n_{j}$ motion constraint due to the ideal joints. They ensure that the two connected bodies only move along the direction of the joint but don’t move in all other directions that are blocked by the joint.
42 |
43 | {: style="height:350px align=centre"}
44 |
45 | ## Lagrange Method
46 |
47 | This method is centered around three fundamental concepts:
48 |
49 | 1. The definition of generalized coordinates$ q$ and generalized velocities $\dot{q}$ , which may or may not encode the information regarding the constraints applicable to the system.
50 |
51 | 2. . A scalar function called the Lagrangian function $\mathcal{L}$. For mechanical systems, it is exactly the difference between the total kinetic energy $\mathcal{T}$ and the total potential energy $\mathcal{U}$, of the system at each instant:
52 |
53 | $\mathcal{L} = \mathcal{T} - \mathcal{U}$
54 |
55 | 3. The so-called Euler-Lagrange equation, also known as the Euler-Lagrange of the second kind, which applies to the Lagrangian function $\mathcal{L}$ and to the total external generalized forces $\tau$ :
56 |
57 | $\frac{d}{dt} (\frac{\partial{\mathcal{L}}}{\partial{\dot{q}}} )$ - $(\frac{\partial{L}}{\partial{\dot{q}}})$ = $\tau$
58 |
59 | In the most general case, the Lagrangian is a function of the generalized coordinates and velocities q and q˙ , and it may also have an explicit dependence on time t, hence we redefine the aforementioned scalar energy functions as $\mathcal{T} = \mathcal{T}(t, q, \dot{q})$ and $\mathcal{U} = \mathcal{U}(t,q)$, thus $\mathcal{L} = \mathcal{L}(t,q,\dot{q})$ .
60 |
61 | In the end, one of the most notable properties of this formulation is the capacity to eliminate all internal reaction forces of the system from the final EoM, in contrast to the Newton-Euler formulation where there they are explicitly accounted for.
62 |
63 | To get a more detailed insight on how to formulate Newton-Euler equation and Lagrange equation for different robot system check out this [lecture](https://youtu.be/xc71IuDmZIw) by IIT Delhi prof S.K SAHA
64 |
65 | some of the other resources you can checkout to know more about kinematics and dynamics involved in robotics are:
66 |
67 | 1. A Mathematical Introduction to Robotic Manipulation by Richard Murray
68 | 2. Robot dynamics and control by Mark Spong
69 | 3. Springer Handbook on Robotics by Oussama Khatib
--------------------------------------------------------------------------------
/docs/mechanical/Joint Kinematics.md:
--------------------------------------------------------------------------------
1 | # Joint Kinematics
2 |
3 | The links that compose the robotic mechanism are assumed to be perfectly rigid bodies having surfaces that are geometrically perfect in both position and shape. Accordingly, these rigid bodies are connected together at joints where their idealized
4 | surfaces are in ideal contact without any clearance between them. The respective geometries of these surfaces in contact determine the freedom of motion between the two links, or the joint kinematics.
5 |
6 | ### Revolute
7 |
8 | The most general form of a revolute joint, often abbreviated as R and sometimes referred to colloquially as a hinge or pin joint, is a lower pair composed of two congruent surfaces of revolution. The surfaces are the same except one of them is an external surface, convex in any plane normal to the axis of revolution, and one is an internal surface, concave in any plane normal to the axis. The position of one body relative to the other may be expressed as the angle between two lines normal to the joint axis, one fixed in each body. Thus, the joint has one degree of freedom (DOF).
9 |
10 | ### Prismatic
11 |
12 | The most general form of a prismatic joint, often abbreviated as P and sometimes referred colloquially as a sliding joint, is a lower pair formed from two congruent general cylindrical surfaces. A prismatic joint permits only sliding of one of the members joined relative to the other along the direction of extrusion. The position of one body relative to the other is determined by the distance between two points on a line parallel to the direction of sliding, with one point fixed in each body. Thus, this joint also has one degree of freedom.
13 |
14 | ### Helical
15 |
16 | The most general form of a helical joint, often abbreviated as H and sometimes referred to colloquially as a screw joint, is a lower pair formed from two helicoidal surfaces formed by extruding any curve along a helical path. The simple example is a bolt and nut wherein the
17 | basic generating curve is a pair of straight lines.
18 |
19 | Other types of joints include Planar, [Spherical](https://www.sciencedirect.com/topics/engineering/spherical-joint), [Cylindrical](https://en.wikipedia.org/wiki/Cylindrical_joint), etc.
20 |
21 | ## 6-DOF Joint
22 |
23 | The motion of two bodies not jointed together can be modeled as a six-degree-of-freedom joint that introduces no constraints. This is particularly useful for mobile robots, such as aircraft, that make at most intermittent contact with the ground, and thus, a body in free motion relative to the fixed frame is termed a floating base. Such a free motion joint model enables the position and orientation of a floating base in space to be expressed with six joint
24 | variables.
25 |
26 | # Geometric Representation
27 |
28 | The geometry of a robotic mechanism is conveniently defined by attaching coordinate frames to each link. While these frames could be located arbitrarily, it is advantageous both for consistency and computational efficiency to adhere to a convention for locating the frames on the links. A commonly used convention for selecting frames of reference in robotic applications is the Denavit-Hartenberg, or D-H convention. In this convention, each homogeneous transformation $A_{i}$ is represented as a product of four basic transformations
29 |
30 | {: style="height:250px"}
31 |
32 | where the four quantities $\theta_{i} , a_{i} , d_{i} , \alpha_{i}$ are parameters associated with link i and joint i. The four parameters $a_{i} ,\alpha_{i} ,d_{i} , and \: \theta_{i}$ in are generally given the names link length, link twist, link offset, and joint angle, respectively, three of the above four quantities are constant for a given link, while the fourth parameter, $\theta i$ for a revolute joint and $d_{i}$ for a prismatic joint, is the joint variable.
33 |
34 | Check out this [video](https://www.youtube.com/watch?v=FiKEAdednuo) to know more about how to use DH parameters for geometric representation or go [here](https://robotacademy.net.au/lesson/denavit-hartenberg-notation/) for know about DH notation in more detail.
35 |
36 | {: style="height:350px align:center"}
--------------------------------------------------------------------------------
/docs/mechanical/drive_mechanism.md:
--------------------------------------------------------------------------------
1 | # Drive Mechanism
2 |
3 | Wheeled mobile robots may be classified in two major categories, omnidirectional and nonholonomic.
4 |
5 | **Omnidirectional wheeled mobile robots** typically employ either omniwheels or mecanum wheels. An omniwheel is a typical wheel augmented with rollers on its outer circumference. These rollers spin freely about axes in the plane of the wheel and tangential to the wheel's outer circumference, and they allow sideways sliding while the wheel drives forward or backward without slip in that direction. Mecanum wheels are similar except that the spin axes of the circumferential rollers are not in the plane of the wheel. The sideways sliding allowed by omniwheels and mecanum wheels ensures that there are no velocity constraints on the robot's chassis.
6 |
7 | **Nonholomic wheeled robots** are subject to a single Pfaffian velocity constraint i.e. they cannot move sideways or parallel to the axis of the axel. Example for a nonholomic wheeled robot is a car and despite this velocity constraint, a car can reach any $(\phi,x,y)$ configuration in an obstacle-free plane. In other words, the velocity constraint cannot be integrated to an equivalent configuration constraint, and therefore it is a nonholonomic constraint.
8 |
9 | If we want to prescribe the robot’s movements in the environment, we need to know how the robot variables relate to the primary variables we can control: the angular positions and velocities of the wheel shafts. Therefore, a kinematical model of the robot has to be developed.
10 |
11 | ## Modeling of an Omnibase Robot
12 |
13 | Generally Omni wheeled robots use either a three wheeled platform or a four wheeled platform. Each design has its own advantages and disadvantages. In a three wheel design, wheels are at $120^{\circ}$ from each other and they offers greater traction as any reactive force is distributed through only three points and the robot is well balanced even on uneven terrain.
14 |
15 | 
16 |
17 | The configuration of a robot is defined in the form $q = (x,y,\theta)$, $d$ is the distance between wheels and the center of the robot $v_i$ and $\omega_i$ are the linear and angular velocity of the $i^{th}$ wheel respectively. $v, v_n$ are the two components of the linear velocity of the robot and $\omega$ is the angular velocity. The well known kinematic model of an omnidirectional robot located a $(x,y,\theta)$ can be written as $v_x(t) = dx(t)/dt , v_y(t) = dy(t)/dt$ and $\omega(t) = d\theta(t)/dt$. For a three wheeled robot
18 |
19 | $$ \begin{bmatrix} v_0(t)\\ v_1(t)\\ v_2(t) \end{bmatrix} = \begin{bmatrix} -sin\pi/3 & cos\pi/3 & d\\ 0 & -1 & d\\ sin\pi/3 & cos\pi/3 & d \end{bmatrix} \begin{bmatrix} v(t)\\ v_n(t)\\ \omega(t) \end{bmatrix} $$
20 |
21 | Applying the inverse kinematics is possible to obtain the equations that determine the robot speeds related the wheels speed. Solving in order of $v$, $v_n$ and $\omega$, the following can be found
22 |
23 | $$ v(t) = (\sqrt{3}/3)(v_2(t) - v_0(t))\]
24 | \[v_n(t)=(1/3)(v_2(t) +v_0(t))−(2/3)v_1(t)\]
25 | \[\omega(t)=(1/(3d))(v_0(t) +v_1(t) +v_2(t)) $$
26 |
27 | ## Modeling of a Nonholomic Robot
28 |
29 | A nonholomic robot is modelled in differnet ways which will then dictate the drive mechanism that can be applied on the robot. Differnet drive mechanism and modelling for a nonholomic robot are:
30 |
31 | * Unicycle model
32 | * Differential Drive
33 | * Ackermann Steering
34 |
35 | ### Unicycle Model
36 |
37 | The simplest wheeled mobile robot is a single upright rolling wheel, or unicycle. The configuration of a robot with a wheel of radius $r$ can be written in the form $q = (\phi,x,y,\theta)$, where $(x,y)$ is the contact point, $\phi$ is the heading direction, and $\theta$ is the rolling angle of the wheel. The kinematic equations can be written as
38 |
39 | 
40 |
41 | $$ \dot{q} = \begin{bmatrix} \dot{\phi}\\ \dot{x}\\ \dot{y}\\ \dot{\theta} \end{bmatrix} = \begin{bmatrix} 0 & 1\\ rcos\phi & 0\\ rsin\phi & 0\\ 1 & 0 \end{bmatrix} \begin{bmatrix} u_1\\ u_2 \end{bmatrix} = G(q)u = g_1(q)u_1 + g_2(q)u_2 $$
42 |
43 | The control inputs are $u = (u_1,u_2)$, with $u_1$ the wheel's forward-backward driving speed and $u_2$ the heading direction turning speed.
44 |
45 | Three things to notice about these models are: (1) there is no drift - zero controls mean zero velocity; (2) the vector fields $g_i(q)$ are generally functions of the configuration $q$; and (3) $\dot{q}$ is linear in the controls.
46 |
47 | ### Differnetial Drive
48 |
49 | A differential drive is the most basic drive, which consists of two sets of wheels that can be driven independently. This is the most commonly used form of locomotion system used in robots as it’s the simplest and easiest to implement.
50 |
51 | A differential drive robot consists of two independently driven wheels of radius $r$ that rotate about the same axis, as well as one or more caster wheels, ball casters, or low-friction sliders that keep the robot horizontal. If both the wheels are driven in the same direction and speed, the robot will go in a straight line.
52 |
53 | 
54 |
55 | If both wheels are turned with equal speed in opposite directions, as is clear from the diagram shown, the robot will rotate about the central point of the axis. Otherwise, depending on the speed of rotation and its direction, the center of rotation may fall anywhere on the line defined by the two contact points of the tires.
56 |
57 | 
58 |
59 | Let the distance between the driven wheels be $2d$ and choose the $(x,y)$ reference point halfway between the wheels. Writing the configuration as $q = (\phi,x,y,\theta_L,\theta_R)$, where $\theta_L$ and $\theta_R$ are the rolling angles of the left and right wheels, respectively, the kinematic equations are
60 |
61 | $$ \dot{q} = \begin{bmatrix} \dot{\phi}\\ \dot{x}\\ \dot{y}\\ \dot{\theta_L}\\ \dot{\theta_R} \end{bmatrix} = \begin{bmatrix} -r/2d & r/2d\\ \frac{r}{2}cos\phi & \frac{r}{2}cos\phi\\ \frac{r}{2}sin\phi & \frac{r}{2}sin\phi\\ 1 & 0\\ 0 & 1 \end{bmatrix} \begin{bmatrix} u_L\\ u_R \end{bmatrix} $$
62 |
63 | where $u_L$ is the angular speed of the left wheel and $u_R$ that of the right. A positive angular speed of each wheel corresponds to forward motion at that wheel.
64 |
65 | While we can vary the velocity of each wheel, for the robot to perform rolling motion, the robot must rotate about a point that lies along their common left and right wheel axis. The point that the robot rotates about is known as the ICC - Instantaneous Center of Curvature.
66 |
67 | By varying the linear velocity of the wheels $V_R$ and $V_L$, we can vary the radius of curvature $R$ that the robot follows. Because the rate of rotation $\omega$ about the ICC must be the same for both wheels, we can write the following equations
68 |
69 | $$ \omega(R + d) = V_R\]
70 | \[\omega(R - d) = V_L $$
71 |
72 | A differential drive robot cannot move in the direction along the axis - this is a singularity. Differential drive vehicles are very sensitive to slight changes in velocity in each of the wheels. Small errors in the relative velocities between the wheels can affect the robot trajectory.
73 |
74 | ### Ackermann Steering
75 |
76 | Drawbacks of the differential drive are its reliance on a caster wheel, which performs poorly at high speeds, and difficulties in driving straight lines as this requires both motors to drive at the exact same speed. These drawbacks are mitigated by car-like mechanisms, which are driven by a single motor and can steer their front wheels. This mechanism is known as Ackermann steering.
77 |
78 | 
79 |
80 | To define the configuration of the car, we ignore the rolling angles of the four wheels and write $q = (\phi,x,y,\psi)$, where $(x,y)$ is the location of the midpoint between the rear wheels, $\phi$ is the car's heading direction, and $\psi$ is the steering angle of the car, defined at a virtual wheel at the midpoint between the front wheels. The controls are the forward speed $v$ of the car at its reference point and the angular speed $\omega$ of the steering angle. The car's kinematics are
81 |
82 | $$ \dot{q} = \begin{bmatrix} \dot{\phi}\\ \dot{x}\\ \dot{y}\\ \dot{\psi} \end{bmatrix} = \begin{bmatrix} (tan\psi)/l & 0\\ cos\phi & 0\\ sin\phi & 0\\ 0 & 1 \end{bmatrix} \begin{bmatrix} v\\ \omega \end{bmatrix} $$
83 |
84 | Disadvantages Of Ackermann Steering : The turning mechanism must be accurately controlled. A slight inaccuracy may cause large odometry errors The system is Non – Holonomic hence path planning is extremely difficult as well as inaccurate There are no direct directional actuators.
85 |
86 | ## Other type of Drive Mechanism
87 |
88 | There are many different ways in which a robot can be modelled and controlled, some other drive mechanism used in various systems are
89 |
90 | * **Skid Steering -** The left and right wheels are driven independently. Steering is accomplished by actuating each side at a different rate or in a different direction, causing the wheels or tracks to slip, or skid, on the ground. The wheels typically have no separate steering mechanism and hold a fixed straight alignment on the body of the machine. By turning the left and right wheel pairs at different speeds, the machine turns by skidding, or dragging its fixed-orientation wheels across the ground.
91 |
92 | * **Synchronous Drive -** This system uses synchronous rotation of its wheels to achieve motion & turns. It is made up of a system of motors. One set of which drive the wheels and the other set turns the wheels in a synchronous fashion The two sets can be directly mechanically coupled as they always move in the same direction with same speed.
93 |
94 | * **Articulated Drive -** Similar to Ackerman Steering concept, Articulated method drives a robot by deforming the entire chassis or frame to turn instead of just the wheels. This is generally used for industrial robots where a four wheeled robot is split into two, the front part and the rear part which is connected by a vertical hinge. A motor changes the angle of front part of chassis which turns the robot in a required direction and other motor drives it.
95 |
96 | ## References
97 |
98 | * For more details on these drive mechanisms refer Chapter 13 of the **Modern Robotics - Mechanics, Planning, And Control** by *Kevin M. Lynch and Frank C. Park*, a video playlist of the same can be found [here](https://www.youtube.com/playlist?list=PLggLP4f-rq00uzTEwsywVcTF2fJ2YqAXX).
99 | * A video on Differential Drive mechanism from **Control of Mobile Robots** course by *Dr. Magnus Egerstedt* can be found [here](https://youtu.be/wqUwmnKskJU).
100 | * More information on Designing of Ackermann Steering can be read from this [paper](https://www.researchgate.net/publication/265755401_Design_of_an_Ackermann_Type_Steering_Mechanism).
--------------------------------------------------------------------------------
/docs/mechanical/images/Inverse_Kinematics.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/Inverse_Kinematics.jpg
--------------------------------------------------------------------------------
/docs/mechanical/images/dh_parameters.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/dh_parameters.jpg
--------------------------------------------------------------------------------
/docs/mechanical/images/drive0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/drive0.png
--------------------------------------------------------------------------------
/docs/mechanical/images/drive1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/drive1.png
--------------------------------------------------------------------------------
/docs/mechanical/images/drive2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/drive2.jpg
--------------------------------------------------------------------------------
/docs/mechanical/images/drive3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/drive3.png
--------------------------------------------------------------------------------
/docs/mechanical/images/drive4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/drive4.png
--------------------------------------------------------------------------------
/docs/mechanical/images/forward_kinematics.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/forward_kinematics.jpg
--------------------------------------------------------------------------------
/docs/mechanical/images/gears1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears1.png
--------------------------------------------------------------------------------
/docs/mechanical/images/gears10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears10.png
--------------------------------------------------------------------------------
/docs/mechanical/images/gears2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears2.png
--------------------------------------------------------------------------------
/docs/mechanical/images/gears3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears3.png
--------------------------------------------------------------------------------
/docs/mechanical/images/gears4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears4.png
--------------------------------------------------------------------------------
/docs/mechanical/images/gears5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears5.png
--------------------------------------------------------------------------------
/docs/mechanical/images/gears6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears6.png
--------------------------------------------------------------------------------
/docs/mechanical/images/gears7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears7.png
--------------------------------------------------------------------------------
/docs/mechanical/images/gears8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears8.png
--------------------------------------------------------------------------------
/docs/mechanical/images/gears9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/gears9.png
--------------------------------------------------------------------------------
/docs/mechanical/images/link_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/link_1.png
--------------------------------------------------------------------------------
/docs/mechanical/images/link_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/link_2.png
--------------------------------------------------------------------------------
/docs/mechanical/images/spurgear.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/spurgear.jpg
--------------------------------------------------------------------------------
/docs/mechanical/images/why_ik.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RISC-IITBBS/risc-handbook/def6a88b20c09a9529ee535eda444a4bc49a7e17/docs/mechanical/images/why_ik.png
--------------------------------------------------------------------------------
/docs/mechanical/intro.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 | Designing, creating, and testing mechanical sensors and devices for a robot are all part of the mechanical side of robotics.
3 | Among many other factors that go into the development of a new robot, this includes the robot's design, kind of robot, joint mechanics, axes, heat transfer properties, mounting places, and many others.A novel robot concept and its optimum manufacturing methods are developed using CAD or other design tools.The kinematics and dynamics equations of the robot must be solved as part of mechanical design in order for robots to do any task at all.
--------------------------------------------------------------------------------
/docs/mechanical/position and orientation.md:
--------------------------------------------------------------------------------
1 | # POSITION AND ORIENATION REPRESENTATION
2 |
3 | ### Position and translation
4 |
5 | The minimum number of coordinates required to locate a body in Euclidean space is six. A coordinate frame i consists of an origin, denoted $O_{i}$ and a triad of mutually orthogonal basis vectors, denoted $(\hat x_{i} \hat y_{i } \hat z_{i})$, that are all fixed within a particular body. The pose of a body will always be expressed relative to some other body, so it can be expressed as the pose of one coordinate frame relative to another. Similarly, rigid-body displacements can be expressed as displacements between two coordinate frames, one of which may be referred to as moving, while the other may be referred to as fixed.
6 |
7 | The position of the origin of coordinate frame i relative to coordinate frame j can be denoted by the 3 X 1 vector
8 |
9 | $$ ^{j} \textbf {p} _{i} = \begin{pmatrix} ^{j} p^{x} _{i} \\ ^{j} p^{y} _{i} \\ ^{j} p^{z} _{i} \end{pmatrix}$$
10 |
11 | The components of this vector are the Cartesian coordinates of $O_{i}$ in the j frame, which are the projections of the vector $^{j} \textbf {p} _{i}$ onto the corresponding axes.
12 |
13 | ### Orientation and Rotation
14 |
15 | A rotation is a displacement in which at least one point in the rigid body remains in its initial position and not all lines in the body remain parallel to their initial orientations. The orientation of coordinate frame i relative to coordinate frame j can be denoted by expressing the basis vectors .$( \hat x_{i} \hat y_{i} \hat z_{i})$ in terms of the basis vectors ,$( \hat x_{j} \hat y_{j} \hat z_{j})$.This yields, $( ^{j}\hat x_{i} ^{j}\hat y_{i} ^{j}\hat z_{i})$ which when written together as a 3X3 matrix is known as the rotation matrix. The components of $^{j}R_{i}$ are the dot products of the basis vectors of the two coordinate frames.
16 |
17 | $^{j}R_{i}$ = $\begin{pmatrix} \hat x _{i}.\hat x _{j} & \hat y _{i}.\hat x _{j} & \hat z _{i}.\hat x _{j} \\ \hat x _{i}.\hat y _{j} & \hat y _{i}.\hat y _{j} & \hat z _{i}.\hat y _{j} \\ \hat x _{i}.\hat z _{j} & \hat y _{i}.\hat z _{j} & \hat z _{i}.\hat z _{j} \end{pmatrix}$
18 |
19 | Because the basis vectors are unit vectors and the dot product of any two unit vectors is the cosine of the angle
20 | between them, the components are commonly referred to as direction cosines. An elementary rotation of frame i about the $z_{j}$ axis through an angle $\theta$ is
21 |
22 | $R_{z}(\theta) = \begin{pmatrix} \cos(\theta) & -\sin(\theta) & 0\\ \sin(\theta) & \cos(\theta) & 0\\ 0 & 0 & 1\end{pmatrix}$
23 |
24 | while the same rotation about $\hat y_{j}$ axis is
25 |
26 | $R_{Y}(\theta) = \begin{pmatrix} \cos(\theta) & 0 & \sin(\theta)\\ 0 & 1 & 0\\ -\sin(\theta) & 0 & \cos(\theta)\end{pmatrix}$
27 |
28 | and about the axis $\hat x_{j}$ is
29 |
30 | $R_{X}(\theta) = \begin{pmatrix} 1 & 0 & 0\\ 0 & \cos(\theta) & -\sin(\theta)\\ 0 & \sin(\theta) & \cos(\theta)\end{pmatrix}$
31 |
32 | Rotation matrices are combined through simple matrix multiplication such that the orientation of frame i relative to frame k can be expressed as
33 |
34 | $^{k}R_{i} = ^{k}R_{j} ^{j}R_{i}$
35 |
36 | ### Euler Angles
37 |
38 | For a minimal representation, the orientation of coordinate frame i relative to coordinate frame j can be denoted as a vector of three angles $(\alpha , \beta , \gamma)^{T}$. These angles are known as Euler angles when each represents a rotation about an axis of a moving coordinate frame. In this way, the location of the axis of each successive rotation depends upon the preceding rotation(s), so
39 | the order of the rotations must accompany the three angles to define the orientation.
40 |
41 | There are many other representations for orientation such as [Fixed-Angles](https://www.youtube.com/watch?v=uG0P9RX65Ek), [Quaternions](https://robotacademy.net.au/lesson/quaternions-representation-of-rotation-in-3d/) and [Angle-Axis](https://www.youtube.com/watch?v=-TUTqVOGSa8).
42 |
43 | ### Homogeneous Transformations
44 |
45 | With homogeneous transformations, position vectors and rotation matrices are combined together in a compact notation.
46 | Any vector $^{i}r$ expressed relative to the i coordinate frame can be expressed relative to the j coordinate frame if the position and orientation of the i frame are known relative to the j frame.
47 |
48 | $^{j}r = ^{j}R_{i} ^{i}r + ^{j}p_{i}$
49 |
50 | where $^{j}p_{i}$ is the position of the origin of coordinate frame i relative to coordinate frame j and $^{j}R_{i}$ is the orientation of frame i relative to frame j .
51 |
52 | The above equation can be written as
53 |
54 | $\begin{pmatrix} ^{j}r \\ 1 \end{pmatrix}$ = $\begin{pmatrix} ^{j}R_{i} & ^{j}p_{i}\\ 0^{T} & 1 \end{pmatrix}\begin{pmatrix} ^{i}r \\ 1 \end{pmatrix}$
55 |
56 | where
57 |
58 | $^{j}T_{i} = \begin{pmatrix} ^{j}R_{i} & ^{j}p_{i}\\ 0^{T} & 1 \end{pmatrix}$
59 |
60 | is the 4X4 homogeneous transformation matrix . Just like Rotation matrices, homogeneous transformation matrices can also be transformed using matrix cross-multiplication.
61 |
62 | $^{k}T_{i} = ^{k}T_{j} ^{j}T_{i}$
--------------------------------------------------------------------------------
/mkdocs.yml:
--------------------------------------------------------------------------------
1 | # Website details
2 |
3 | site_name: RISC Handbook
4 | site_url: https://risc-iitbbs.github.io/risc-handbook/
5 |
6 | site_description: A beginners guide to Robotics
7 | site_author: Robotics and Intelligent Systems Club (RISC), IIT Bhubaneswar
8 |
9 | copyright: 'Copyright & copy; 2022 Robotics and Intelligent Systems Club (RISC), IIT Bhubaneswar'
10 |
11 |
12 | # mkdocs setup
13 |
14 | theme:
15 | name: 'material'
16 | language: en
17 | icon:
18 | logo: material/book-variant
19 | favicon: images/RISC Logo Dark Blue.png
20 | features:
21 | - tabs
22 | - navigation.sections
23 | palette:
24 | primary: black
25 | accent: indigo
26 |
27 | repo_name: 'RISC-IITBBS/risc-handbook'
28 | repo_url: https://github.com/RISC-IITBBS/risc-handbook
29 |
30 | extra:
31 | social:
32 | - icon: fontawesome/brands/linkedin
33 | link: https://www.linkedin.com/company/robotics-and-intelligent-systems-club/
34 |
35 | - icon: fontawesome/brands/facebook
36 | link: https://www.facebook.com/IIT-Bhubaneswar-Robotics-Club-RISC
37 |
38 | - icon: fontawesome/brands/github
39 | link: https://github.com/RISC-IITBBS
40 |
41 | - icon: fontawesome/brands/instagram
42 | link: https://www.instagram.com/risc.iitbbs/
43 |
44 | analytics:
45 | provider: google
46 | property: G-7DRK873DXE
47 |
48 |
49 | markdown_extensions:
50 | - attr_list
51 | - smarty
52 | - admonition
53 | - codehilite
54 | - admonition
55 | - pymdownx.arithmatex:
56 | generic: true
57 |
58 | extra_javascript:
59 | - javascripts/config.js
60 | - https://polyfill.io/v3/polyfill.min.js?features=es6
61 | - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
62 |
63 |
64 |
65 |
66 | # navigation bar
67 |
68 | nav:
69 | - Home: index.md
70 | - Roadmap: roadmap.md
71 | - Robotics Automation:
72 | - Introduction: automation/intro.md
73 | - ROS:
74 | - Installation: automation/ROS/installation.md
75 | - Getting Started with ROS: automation/ROS/gettingstartedros.md
76 | - Path Planning in Robotics:
77 | - Introduction to Path Planning: automation/PathPlanners/intro.md
78 | - Delibrate Path Planning:
79 | - Graph Based Algorithms:
80 | - A* Algorithm: automation/PathPlanners/Astar.md
81 | - Dijkstra's Algorithm: automation/PathPlanners/Dijkstra.md
82 | - Sampling Based Algorithms:
83 | - RRT: automation/PathPlanners/RRT.md
84 | - PRM: automation/PathPlanners/PRM.md
85 | - Optimization Based Algorithm:
86 | - Genetic Algorithm: automation/PathPlanners/GA.md
87 | - Reactive Path Planning:
88 | - Artificial Potential Fields: automation/PathPlanners/APF.md
89 | - Control Theory:
90 | - Introduction to Control Theory: automation/ControlTheory/Control_Theory.md
91 | - PID Controller: automation/ControlTheory/PID_Controller.md
92 | - Linear Quadratic Regulator: automation/ControlTheory/LQR.md
93 | - Model Predictive Control: automation/ControlTheory/MPC.md
94 | - Simulation:
95 | - Introduction: automation/simulation/intro.md
96 | - Gazebo:
97 | - Basics of Gazebo: automation/simulation/gazebo/basics.md
98 | # - STDR Simulator:
99 | # - Basics of STDR: automation/simulation/stdr/Basics.md
100 |
101 | - Electronics:
102 | - Introduction: electronics/intro.md
103 | - Single Board Computers:
104 | - Raspberry Pi: electronics/Single_board_computer/Raspberrypi.md
105 | - Nvidia Jetson Nano: electronics/Single_board_computer/Jetsonnano.md
106 | - Sensors:
107 | - LIDAR: electronics/Sensors/lidar.md
108 | - Microcontroller Development Boards:
109 | - Arduino: electronics/Development_Boards/Arduino.md
110 | - ESP32 : electronics/Development_Boards/ESP32.md
111 | - BluePill - STM32F103C8T6 : electronics/Development_Boards/STM32.md
112 | - Pyboard - (STM32F405)MicroPython : electronics/Development_Boards/Pyboard.md
113 | - Modules:
114 | - ESP8266 - Wifi Module: electronics/Modules/ESP8266.md
115 | - Motors :
116 | - Servo Motors: electronics/Motors/ServoMotor.md
117 | - Mechanical Systems:
118 | - Introduction: mechanical/intro.md
119 | - Gears: mechanical/Gears.md
120 | - Drive Mechanism: mechanical/drive_mechanism.md
121 | - Kinematics and Dynamics:
122 | - Position and Orientation: mechanical/position and orientation.md
123 | - Kinematics:
124 | - Joint Kinematics: mechanical/Joint Kinematics.md
125 | - Forward and Inverse Kinematics: mechanical/Forward and Inverse Kinematics.md
126 | - Dynamics:
127 | - Introduction to Dynamics: mechanical/Introduction to Dynamics.md
128 |
129 |
130 | - About Us: about.md
131 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------