# Hardware-Software Report > Written by Soroush Fazeli > Dec. 05 , 2022 ## Software The main Component of software structure is the controller. In order to be able to make the drone stable during flight, its necesery to use a controller. As it can be seen in the figure the controller has two inputs, Desired state which comes from a human side with RC controller or from a mission planner, that calculates the desired state in order to acompolish the mission autonomously. On the other hand, Controller tries to calculate th errors and decide required actions that needs to be taken. In our case, controller sends the calculated rpms to motors. During flight testing we tried thre different controllers: ![controller](https://ledin.com/wp-content/uploads/2014/12/image018-e1419127604485.png) - <strong>Geometric Controller:</strong> This controller for the quadrotor is generally based on the principle of solving control problems with the geometry of the state space. <img src="https://www.researchgate.net/profile/Fadri-Furrer/publication/309291237/figure/fig3/AS:419238109040641@1476965562674/Controller-sketch-with-the-desired-position-p-d-and-the-desired-yaw-angle-ps-d-Usually.png" width="450" height="180"> - <strong>PID Controller:</strong> A proportional–integral–derivative controller (PID controller or three-term controller) is a control loop mechanism employing feedback that is widely used in industrial control systems and a variety of other applications requiring continuously modulated control. A PID controller continuously calculates an error value e(t) as the difference between a desired setpoint (SP) and a measured process variable (PV) and applies a correction based on proportional, integral, and derivative terms (denoted P, I, and D respectively) <img src="https://www.researchgate.net/publication/344378374/figure/fig3/AS:939658443751424@1601043439297/The-Model-of-a-PID-Controller-Configuration-From-Figure-3-the-mathematical-expression.png" width="450" height="180"> - <strong>Ardupilot:</strong> ArduPilot is an open source, unmanned vehicle Autopilot Software Suite, capable of controlling autonomous drones.The ArduPilot software suite consists of navigation software (typically referred to as firmware when it is compiled to binary form for microcontroller hardware targets) running on the vehicle (either Copter, Plane, Rover, AntennaTracker, or Sub), along with ground station controlling software including Mission Planner, APM Planner, QGroundControl. ## Middleware Robot Operating System (ROS) is an open-source robotics middleware suite. Although ROS is not an operating system (OS) but a set of software frameworks for robot software development, it provides services designed for a heterogeneous computer cluster such as hardware abstraction, low-level device control, implementation of commonly used functionality, message-passing between processes, and package management. ROS makes communication processes, known as nodes, extremely easy through the use of ROS topics which can be published and subscribed to. Each topic has a certain message type that tells the publisher or subscriber what kind of data can be sent and received from over a topic. In this case it would be possible for the software to comunicate with the hardware components such actuators and sensors. <img src="https://docs.emlid.com/navio2/assets/images/scheme2-d077c1141a4efd8b460aa4d4096c17d2.png" width="" height="400"> ## hardware Every drone has essential hardware components in order to fly, such as flight controller, on-board computer, ESC, Motors, Propellers and Battery. - <strong>Flight Controller:</strong> The main function of the Flight Controller is to provide control for the Electronic Speed Controller (ESC) to direct the rpm of motors based on inputs from the on-board computer. It has sensors on the board so it can understand how the craft is moving. Using the data provided by these sensors, the FC uses algorithms to calculate how fast each motor should be spinning for the craft to behave - <strong> On-Board Computer:</strong> Raspberry Pi is a micro-computer at the size of an average credit card for data processing. With the General Purpose Input Output (GPIO) pins, the Raspberry Pi has high processing capability to run functions like flying a drone. All the algorithms and middleware software are implemented on rasspberry pi. Also on-board computer is connected to flight controller in order to getting the sensor data and sending commands. - <strong> ESC:</strong> An ESC is a device that interprets signals from the flight controller, and translates those signals into phased electrical pulses to determine the speed of a brushless motor. The ESC is graded with the maximum amount of current that it allows to pass through. In this project, a 4-in-1 ESC is been used. A 4 in 1 brushless ESC allows you to move ESCs from the arms of your quadcopter into the centre stack with your flight controller. Compact builds can benefit, as they make wiring a lot simpler, removing the need for a power distribution board and separate BEC in some cases. - <strong> Motors:</strong> The motors are the main drain of battery power on your quad, therefore getting an efficient combination of propeller and motor is very important. Motor speed is rated in kV, generally a lower kV motor will produce more torque and a higher kV will spin faster - <strong> Propellers:</strong> Propellers for Drones and UAVs. Propellers are devices that transform rotary motion into linear thrust. Drone propellers provide lift for the aircraft by spinning and creating an airflow, which results in a pressure difference between the top and bottom surfaces of the propeller. - <strong> Battery:</strong> LiPo batteries are the power sources of the quadcopters. LiPo is used because of the high energy density and high discharge rate. LiPo batteries are rated by their nominal voltage (3.7v per cell), cell count in series,, capacity in mAh (ie.1300mAh) and discharge rate (ie. 75C).