Cooperative navigation of multiple Marine Robotic Vehicles
Full text
FACULDADE DE ENGENHARIA DA UNIVERSIDADE DO PORTO Cooperative navigation of multiple Marine Robotic Vehicles Nuno Alberto Moreira Maia Mestrado Integrado em Engenharia Eletrotécnica e de Computadores Supervisor: António Pedro Aguiar July 31, 2013
© Nuno Maia, 2013
Resumo Com a constante evolução da navegação e exploração, a humanidade sempre quis alcançar mais e elevar o conhecimento humano acerca do mundo para além dos seus limites. Tendo explorado cada continente, muito há ainda por descobrir no fundo dos oceanos. Devido a custos monetários e a ser pouco viável no que diz respeito a dispendiosos recursos humanos, a exploração de ambientes subaquáticos é feita através da utilização de veículos robóticos autónomos. Esta possibilidade não só é mais segura, não colocando em risco vidas humanas em territórios inóspitos, mas também é, em alguns aspectos, mais fácil de implementar. Como estes veículos são não tripulados, eles precisam de ser autónomos e vigiados à distância. Isto levou à importância do desenvolvimento de técnicas de navegação. Em terra, esta navegação é possível através do sistema de posicionamento já bem conhecido, GPS. No entanto, debaixo de água é impossível usar este sistema devido ao facto de esses sinais não se propagarem bem neste meio. Há a necessidade de utilizar outro tipo de sinais, que neste momento são ondas acústicas pois se propagam bem nesse meio. Para calcular a localização do veículo subaquático, a ideia principal é usar o sistema de emissores/receptores que enviam e recebem do veículo o sinal acústico. Através da medida do tempo de viagem e sabendo a velocidade do sinal acústico, é então possível encontrar a localização do objecto. Em 2D (ou seja, sabendo a profundidade) só são necessários três emissores/receptores (assumindo certas condições espaciais) para descobrir a localização: um dá uma circunferência de possíveis localizações, dois dão duas circunferências interceptadas em dois pontos, o que significa duas localizações possíveis, e o terceiro intercepta uma destas localizações, que é a localização correta do veículo, este processo é designado trilateração. No entanto, o vasto número de emissores/receptores que são usados é dispendioso, sentindo-se a necessidade de encontrar uma maneira de calcular a localização de veículos utilizando menos emissores/receptores. Com a utilização de apenas um emissor/receptor e implementando um algoritmo que calcula o deslocamento do veículo em diferentes tempos, é possível criar uma rede virtual de emissores/receptores que vai ajudar a encontrar uma estimativa da posição do veículo. Esta estimativa da localização é mais tarde filtrada usando o filtro de Kalman. O papel deste filtro é, não só filtrar o ruido, mas também complementar o resultado da trilateraçao com informação da velocidade linear relativa obtida por um doppler e para lidar com possíveis perturbações desconhecidas tais como as correntes. De facto, testes foram feitos e mostraram que sem a utilização do filtro de Kalman e sob a influência destas correntes, o algoritmo utilizado diverge, não dando os resultados pretendidos. Depois de ter o algoritmo de navegação implementado para um veículo, mais uma camada de complexidade foi adicionada ao incluir outro veículo com o papel de emissor/receptor (emissor/receptor com movimento) no sentido de tornar a navegação cooperativa. O veículo que funciona como emissor/receptor para outros veículos pode ser um veículo robótico de superfície e por isso, deste modo, ser capaz de utilizar o sistema GPS. Pode também ser um veículo submarino robótico autónomo que serve de emissor/receptor a outros e dos quais a sua posição também pode ser calculada usando uma lógica semelhante à utilizada na navegação singular. i
ii
Abstract With the increased evolution in navigation and exploration, mankind always aimed to go further and push the human knowledge of the world to its limits. Having explored every continent and land surface, much is still left to be discovered underneath the oceans. Due to monetary costs and not being viable due to being too costly in human resources, the exploration of underwater territories is being carried out through the use of autonomous robotic vehicles. This possibility not only is safer, not endangering human lives in inhospitable locations, but it also is in some aspects easier to implement. As these vehicles are unmanned, they need to be autonomous and surveyed from a distance. This led to the importance of the development of navigation techniques. On land, this navigation is possible through the well-known GPS system. However, underwater it is impossible to use this system due to the fact that those signals do not propagate well in such an environment. There is the need to use another type of signals, which presently turns out to be acoustic waves since these signals propagate well in this environment. To compute the location of an underwater vehicle, the main idea is to use a system of transponders/beacons that send to and receive from the vehicle an acoustic signal. By measuring the time of travel and knowing the speed of the underwater acoustic signal (AS) it is then possible to find the location of the object. In 2D, (which means knowing the depth) it only takes three beacons (under some spatial assumptions) to find out the location: one gives a circumference of possible locations, two give 2 circumferences which are intercepted in two places, which mean two possible locations and the third one intercepts one of these locations, which is the right location of the vehicle, this process is called trilateration. However, the vast amount of transponders (beacons) that are used is very costly, so there is a need to find a way to compute the location of the vehicles using fewer resources. With the use of only one beacon, and implementing an algorithm that computes the displacement of the vehicle in different times, it is possible to create a virtual net of beacons which will help finding out an estimate of the vehicle location. This estimate of the location is later filtered using a Kalman Filter (KF). The role of this filter is to not only filter out the noise, but it is also to complement the result of the trilateration with the relative linear velocity information provided by a doppler and to deal with possible unknown underwater current disturbances. In fact, tests were done that showed that without using the KF and under the influence of currents, the algorithm would diverge, not producing the results intended. After having the Single Beacon Navigation (SBN) for one vehicle implemented, one more layer of complexity was added by including another vehicle with the role of the beacon (moving beacon) in order to make the navigation cooperative. The vehicle that works as a beacon to the other vehicles can be an Autonomous Surface Craft (ASC) which floats at the surface of the sea and therefore uses the GPS system. It can also be an Autonomous Underwater Vehicle (AUV) which serves as a beacon to others and whose position is computed using a similar logic as the one in the SBN algorithm. iii
iv
Acknowledgements An enormous thank you to my supervisor António Pedro Aguiar, for his patience, support, guidance, and availability, despite always having a full schedule. It was important to have a good supervisor, since I knew little about this topic and programming was never my best skill (which is why this dissertation helped me so much in improving my skills and knowledge as I knew close to nothing about what to do). A big cheers to my father, who was my -’at home’ supervisor, helping me understand some important aspects of what I had to do and helping me think when I couldn’t find the right way alone. I would like to thank my family for their help, not only during this semester, while I was doing the dissertation, but also for supporting my choices, even if it meant going to Romania and Brazil for six months each. Thanks to Agostinho Rocha, André Reis and José Oliveira, for their help in some aspects I needed to learn about in order to complete this dissertation. And finally, thanks for these great years in college, Tiago Maia, Fabio Silva, Alexandre Santos, Miguel Ribeiro, Luciano Santos, Nuno Guimarães, Bruno Pereira, and the list goes on; without a doubt these years will be missed and remembered with the willingness to go back and relive it all. Nuno Alberto Moreira Maia v
vi
”Life begins at the end of your comfort zone.” Neale Donald Walsch vii
xiv LIST OF TABLES
Nomenclature AS Acoustic Signal ASC Autonomous Surface Craft ASV Autonomous Surface Vehicles AUV Autonomous Underwater Vehicle CN Cooperative Navigation COTS Commercial off-the-shelf DE Doppler Effect FEUP Faculdade de Engenharia da Universidade do Porto GDM Gradient Descent Method GPS Global Positioning System ISR Robotic Systems Institute KF Kalman Filter LAUV Light Autonomous Underwater Vehicle LBL Long Baseline LSTS Underwater Systems and Technology Laboratory MARES Modular Autonomous Robot for Environment Sampling MER Mars Exploration Rover NIBs Navigation and Instrumental Buoys NM Newtow’s Method NP Noptilus Project OM Optimization Method RV Robotic Vehicles SB Single Beacon SBN Single Beacon Navigation SN Single Navigation VNB Virtual Net Beacon VB Virtual Beacon Symbols ωAngular Velocity sSeconds νLinear Velocity xv
Chapter 1 Introduction With the increasing number of unmanned vehicles used in hardly accessible locations in missions, reconnaissance or other exploration objectives, it began to be felt a need for cooperation between those vehicles, and in particular, the use (directly or implicitly) of the navigation sensors from the neighbour vehicles to obtain better navigation performance. The concept of navigation is the act of computing for a vehicle the evolution of its linear and rotational positions and velocities. In the underwater medium, this is a challenging task because GPS is not available. To counter this problem we will use Acoustic Signals (ASs), combined with the Doppler Effect and measurements provided by inertial measurement unit sensors to be able to track the underwater location of the vehicle. After the navigation problem is sorted out we can start implementing cooperative behaviour (Figure 1.1) in the vehicles, such as location feedback, formation abilities and many other possibilities are unlocked. Figure 1.1: AUV fleet in underwater exploration (Source: [1] ) 1
2Introduction 1.1 Motivation Underwater navigation is a critical and difficult task (Fig. 1.2). In this thesis we propose a navigation algorithm for AUVs that relies on single beacon acoustic navigation techniques and takes into account the presence of unknown ocean currents. This idea has advantages compared to the usual method implemented that uses three beacons since relying on multiple beacons means the need to survey more locations, and the deploy, survey and recovery of these beacons,which is costly and time expensive. After implementing the SNB approach it is then possible to make the navigation cooperative which enables a set of different abilities for the group of vehicles. Figure 1.2: Communication between AUV, ASC and station unit (Source: htt p ://goo.gl/Qrb2t) 1.2 Objectives The main objective of this work was to to study, develop and implement cooperative navigation algorithms for marine vehicles. In particular, the following tasks were addressed: • Literature review and study of estimation algorithms for navigation. • Study and implementation in Matlab of a single beacon acoustic navigation algorithm. • Study and design of cooperative estimation strategies for navigation of multiple autonomous Robotic Vehicles (RVs). • Implementation and evaluation of the algorithms developed through computer simulations. 1.3 Main contribution The main contributions of this thesis are twofold:
1.4 Thesis Outline 3 • Implementation and performance evaluation through computer simulations of a single beacon navigation algorithm for single AUVs based on the work of [2]. The algorithm is composed by two main components: the construction of net of virtual beacons and the computation of a first rough position through trilateration, and second a fine estimation of the position using a Kalman filter. • The extension of the single navigation system to cooperative navigation where in this case we have at least one vehicle playing the role of a moving beacon (contrary to the first case where the beacon is stationary) serving other vehicles for navigation that interact with it. 1.4 Thesis Outline The remainder of this dissertation is organized as follows: • Chapter 2 describes the State of the Art starting with a brief historical explanation as well as the present technologies of this topic. • Chapter 3 presents the implementation of the SBN. • Chapter 4 describes the extension of the SB algorithm to multiple vehicles using a cooperative strategy. Two cases are studied in detail: CN with AUV/ASC and CN with two AUVs. • Chapter 5 presents the results and the critical analysis of the algorithm simulations. • Chapter 6 concludes this thesis with a summary of the results obtained and benefits and drawbacks of the methods proposed, and suggests directions for future investigation.
4Introduction
Chapter 2 State of the Art 2.1 Some well-known historic examples Throughout the history of exploration and navigation, there are some marks that are worth mentioning. Without a doubt, exploration has been in the eager mind of mankind all along. At first, even though the navigation and the positioning systems of the time were not very precise or sophisticated, the need to travel beyond the unknown pushed us through the oceans and, continent after continent, zone after zone, the knowledge of the entire planet started adding up and fitting in like pieces of a puzzle. We can say that this helped greatly in technological progress, not only due to the instruments that were invented to make travelling possible and finding the way people wanted to travel; but also by making the world more united and enabling the findings of each country, zone, place available everywhere. 2.1.1 Space The most recent and remarkable event of exploration and navigation is the Mars Exploration Rover Mission (MER) conducted by NASA, which consisted in sending two rovers, Spirit (MER-A) and Opportunity (MER-B) to explore Mars’ surface and geology. See Figure 2.1. Basically, the goal of this mission is research related to the past existence of water activity (always mankind’s number one goal because it is intimately related to life and the possibility of Mars being a future place for people to live in). This project is a very costly investment in exploration, summing up to several hundreds of million dollars. 5
6State of the Art Figure 2.1: MER exploring Mars surface (Source: htt p ://goo.gl/ILOzi) 2.1.2 Land Robots are used to explore places that are dangerous to man. An example of this are the robots used to explore volcanoes and big, deep caves that are at risk of collapsing. Many projects are currently under development for monitoring volcanic activity, which would otherwise be close to impossible. See Figure 2.2. They are used to make crucial observations and taking measures which can determine the future activity of the volcanoes, knowledge that can therefore save more lives in the future. These kinds of robots have got a wide set of tools which help in making eruption scouting possible, such as ways to collect samples, sensors for data acquisition and such. The very first robotic prototypes were used in this field, and after scientists saw their success and potential, the idea of exploring other planets in a similar way, with the improvement of technology, came to mind. [3] Another more recent example used in volcano exploration is the Robovolc, a versatile robot with more mobility and independence than its counterpart, with a better set of tools and which does not rely as much on other devices and works wireless. [4]
2.1 Some well-known historic examples 7 Figure 2.2: One of the first robotic volcanoes explorers (Source: htt p ://goo.gl/8Ts6A) 2.1.3 Air There is also a very important use for air vehicles, in robotic navigation. For instance, there are some tasks that regularly require the use of unmanned aerial vehicles. For example, they are used for ground surveillance, space reconnaissance, to find people in rescue operations and to monitor traffic. See Figure 2.3. For such operations it is common to use not single unmanned vehicles but fleets, which do CN with one another. This kind of navigation enables formation flight that is very useful for scouting wider areas and allows air-refuelling. [5]
14 State of the Art Figure 2.11: FEUP AUV MARES (Source: htt p ://goo.gl/pxa1B) One AUV, called Modular Autonomous Robot for Environment Sampling (MARES), was developed by "The Ocean Systems Group"(Oceansys) of FEUP, together with ISR-Porto (Robotic Systems Institute). See Figure 2.11. [16] According to OceanSys, MARES (Modular Autonomous Robot for Environment Sampling) is a highly modular autonomous underwater vehicle, designed for shallow water operations. The vehicle can be configured to carry a wide variety of oceanographic sensors and includes a set of navigation sensors to ensure that the predefined trajectories are followed. The characteristics of MARES are in the table 2.1 Table 2.1: Characteristics of MARES Characteristics of MARES Length 1.5m Diameter 20 cm Weight in Air 32 kg Depth Rating 100 m Horizontal Velocity 0−2m/s,variable Autonomy/Range about 10 hrs / 40 km MARES has a very particular feature - the horizontal motion and the vertical motion are completely independent because it is propelled by two vertical thrusters and two horizontal ones. This rare feature makes it possible for the AUV to stay still in the ocean, underwater. Some features of MARES include: • On-board location sensors and movement aid; • Modular construction, with reconfigurable sections; • Spare ports to accommodate payload sensors; • Compact and lightweight - fits the trunk of a car;
2.3 Current Underwater Navigation Systems 15 • Robust, with fully shrouded moving parts; • Operates in confined areas - can ascend/descend in the vertical; • Autonomous operation, with simple mission definition; • Rechargeable Li-Ion batteries. Another very interesting AUV is the Light Autonomous Underwater Vehicle (LAUV) (Fig. 2.12 developed by the Underwater Systems and Technology Laboratory (LSTS). [17] According to LSTS, the LAUV is an Autonomous Underwater Vehicle targeted at innovative standalone or networked operations for cost-effective oceanographic, hydro-graphic and security and surveillance surveys. This lightweight vehicle can be easily launched, operated and recovered with a minimal operational setup. The operation of the LAUV does not require extensive operator’s training. It is an affordable, highly operational and effective surveying tool. Starting at a basic functional system that includes communications, computational system and basic navigation sensors, the LAUV capabilities are built up adding optional payload modules. [18] Figure 2.12: Light Autonomous Underwater Vehicle (Source: htt p ://goo.gl/mrXai)
16 State of the Art Table 2.2: Characteristics of LAUV Characteristics of LAUV Length Starting at 110 cm (depends on con figuration) Diameter 15 cm Weight Starting at 18 kg Endurance U p to 8hours @ 3 knots WiFi 2.4GHz and/or 5GHz GSM/HSDPA Quad −band 3G module Maximum Depth 100 meters INS MGB : 1 degree per hour CTD U p to 6Hz sampling rate Echo Sounder Frequency : 675 kHz (Mounting pointing f orward) Camera Resolution : 720p in H.264 and near 1080p in JPEG Multibeam Frequency : 260 kHz.Range : 100 meters SideScan Sonar Single or dual f requency Some features of the LAUV are: • Security and Surveillance; • Oceanography; • Hydrography; • Inertial Navigation. 2.3.2.2 ASVs or ASCs FEUP has also developed small size autonomous surface vehicles (Zarco and Gama), with a catamaran shape, designed to operate in quiet waters (rivers, lakes, dams).As mentioned in OceanSys, in its basic configuration, each vehicle weights around 50 kg, and has an additional payload capacity of 20 kg. See figure 2.13. The vehicle is actuated by two electrical thrusters and can operate at speeds up to 3 knots. It carries an on-board computer to run fully autonomous or remotely controlled missions, while storing all internal and payload data. A WiFi link connects the ASV to a shore station, allowing for real-time data transmission and mission supervision.
2.3 Current Underwater Navigation Systems 17 Figure 2.13: ASV Zarco (Source: htt p ://goo.gl/pxa1B) Table 2.3: Characteristics of the ASVs or ASCs Characteristics of the ASVs or ASCs Length 1.5m Width 1m Weight in Air 50 kg Net Buoyancy 50 kg Horizontal Velocity 0−3knts,variable Some features of ASCs or AUVs: • Modular mechanical structure, using COTS elements; • Separation of major modules without tools; • Spare ports to accommodate payload sensors; • Very stable platform; • Can operate autonomously or remotely controlled; • Real-time transmission of data to shore. 2.3.2.3 Buoys The Buoys that are used for navigation and instrumentation are called Navigation and Instrumentation Buoys (NIBs). See figure 2.14 NIBs are moored floating platforms with on-board electronics and energy management system. The basic configuration includes rechargeable Lead-acid batteries, a compact GPS receiver and a
18 State of the Art low-power radio modem. NIBs can carry a great variety of sensors and transmit data in real time to a shore station using the radio link. Figure 2.14: Navigation Instrumentation Buoy (Source: htt p ://goo.gl/pxa1B) NIBs, based on OceanSys, are used as acoustic navigation beacons for the AUVs. In this scenario, they have electronic boards to receive and decode acoustic signals sent by the vehicle and respond by transmitting other coded pings into the water. Since they are deployed in known positions, the vehicle can determine its position by triangulation. During an AUV mission, the buoys also relay navigation information back to a mission control station, allowing for vehicle tracking and mission supervision. [16] Table 2.4: Characteristics of the Buoy Characteristics of the Buoy Overall Diameter 75 cm Weight in Air 30 kg Net Buoyancy 20 kg Antenna Height 1m 2.3.3 Recent Projects There are many projects currently being worked on related to AUVs in general and evolving towards multi-AUVs systems.
2.3 Current Underwater Navigation Systems 19 2.3.3.1 Noptilus Project One good example of this is the Noptilus Project (NP). The evolution of multi-AUV systems is still in progress of maturing and it still has some flaws when faced with real-life complex situationawareness operations. These types of operations often involve complex reasoning and demand the ability to make decisions and, as such rely on human beings. As we are well aware of, any system that involves human beings is bound to have flaws related to the very condition of mankind. NOPTILUS is a project to fight this flaws. It represents an effective completely autonomous multi-AUV concept which is 100 percent autonomous, thus not relying on humans. Referring to their own words, in order for this to happen, some advances are required on some aspects: • Cooperative and cognitive-based communications and sonars (low level); • Gaussian Process-based estimation ; • Perceptual sensory-motor; • Learning motion control (medium level): • Learning/cognitive-based situation understanding and motion strategies (high level). Of extreme importance is the integration of all these advances and the demonstration of the NOPTILUS system in a realistic environment at the Port of Leixões, utilizing a team of 6 AUV’s that will be operating continuously on a 24hours/7days-a-week basis. Evaluation of the performance of the overall NOPTILUS system will be performed with emphasis on its robustness, dependability, adaptability and flexibility especially when it deals with completely unknown underwater environments and unpredictable situations as well as its ability to provide with close to optimal performance. [19]
20 State of the Art
Chapter 3 Navigation for single Marine Robotic Vehicles This chapter describes the single beacon navigation algorithm for single AUVs based on the work of [2]. The algorithm can be split into two main components: the Trilateration and the KF. 3.1 System overview The system is composed by some principal blocks which constitute the navigation process. See Figure 3.1. Robotic Vehicle Kalman Filter Trilateration Range Computations Construction of the Virtual Net of Beacons Optimization Position Velocity Optimization output Desired Velocities Estimated Position Velocity Figure 3.1: System block diagram 21
22 Navigation for single Marine Robotic Vehicles 3.2 Kinematic vehicle model To test the single beacon navigation algorithm in Matlab, first a kinematic model of an AUV (in the horizontal plane), was implemented. To this end, a subsystem was defined and implemented as a Matlab block. The inputs of the vehicle block are the linear and angular velocities. The block implements the following equations: ˙x=vsin(ψ)+vcx (3.1) ˙y=vcos(ψ)+vcy (3.2) ˙ ψ=w(3.3) where (x,y)is the vehicle position and ψits orientation. For simplicity we omitted the third position coordinate zin the formulation. We assume that the AUVs are equipped with pressure sensors that provide the underwater depth. In the equations 3.1, 3.2 and 3.3, we have included explicitly the current vc= (vcx,vcy), which is assumed to be constant but unknown from the navigation algorithm. 3.3 Trilateration Trilateration is the process of determining absolute or relative locations of points by measurement of distances, using the geometry of circles, spheres or triangles. This section describes the several components of the trilateration system. Firstly, there is the formation of the Virtual Net of Beacons, using ranges and displacements that occur in the system AUV-beacon. With this set, we then compute the position of the virtual beacons, which will later be used in an optimization process that gives an estimation of the position of the vehicle that we are looking for. 3.3.1 Forming the Virtual Net of Beacons To obtain a virtual net of beacons, firstly we proceed to compute the spatial movement of the vehicle from each position to the following one. To do this we integrate the values of the relative linear velocity of the vehicle. In Matlab this was done by implementing the simple discrete formula pk+1=pk+δvkwhere p is the position of the vehicle, δis the sampling time (which in our case is δ=0.1s) and vthe linear velocity.[2] The navigation system used consists in one beacon, as mentioned before. However in the process of determining the various positions of the AUV over time, some virtual beacons (VBs)
3.3 Trilateration 23 Figure 3.2: Network of beacons creation (Source: [2]) are created and used in order to make the determination of its location possible. In what follows, we consider a virtual net of beacons composed by N=4 beacons. The process begins in the real beacon (P4) that creates the VBs using the displacement made by the vehicle. This is done over 4 different times in 3 different directions. As it is clear from Figure 3.2. The vehicle obtains the range to the beacon every T seconds (which in our case is T=4s). This is done by sending an AS, and knowing its speed and time of travel. During the intervals between the range measurements, the vehicle displacement is also saved by integrating the velocity. After the 4 distances to the beacon are computed, the VBs are created. Firstly, P3is placed, by doing the inverse motion that the AUV did from t3to t4. This motion corresponds to v(t4−t3). Once computed this motion, and summing to the beacon (P4) we find the position of the first VB (P3). From this new VB we will follow the same logic applying the motion from t3to t2(and computing : v(t3−t2)), creating the VB P2and the same goes for the last interval t2to t1which creates the VB P1. [20] Having the beacons, the next step is to compute, by trilateration, the position of the vehicle.
30 Navigation for single Marine Robotic Vehicles x y vcx vcy k+1 = 1 0 ∆t0 0 1 0 ∆t 0 0 ∆t0 0 0 0 ∆t x y vcx vcy k + ∆t0 0∆t 0 0 0 0 "vrx vry #+ξk "¯x ¯y#k ="1 0 0 0 0 1 0 0 #k x y vcx vcy k +ηk •(x,y)- vehicle position; •(vcx,vcy)- ocean current velocity; •(vrx,vry)- water relative vehicle’s velocity; • ¯p(¯x,¯y)- position measurement; • ˆvcestimative of vcprovided by KF; •∆T- time step; •ξkand ηkare assumed to be discrete stationary, Gaussian, zero mean white noise processes and mutually independent. Figure 3.7 represents, in a block perspective, the different subsystems involved in this SBN system. Subsystem 1 represents the trilateration process, which already "works" in itself but is not at all reliable, needing to be filtered and completed by Subsystem 2, in which the current’s speed enters and the approximation of the position already computed in the previous block. The disturbances represent noise and other errors associated with the process. The output of Subsystem 2 will provide feedback to the system. The first (Trilateration) and second (Kalman) block (subsystems) are intimately related as they share the use of some values. For example, q, computed on the first block depends on the output of the second one (this is due to the need of the ocean’s current for the position estimation computing) and this block, the Kalman one, uses the results of the trilateration, taking in consideration the values of the current and filtering the noise in order to make possible the conversion of the algorithm.
3.4 Kalman Filter 31 Figure 3.7: Algorithm block diagram (Source: [2])
32 Navigation for single Marine Robotic Vehicles
Chapter 4 Cooperative Navigation This chapter addresses the cooperative navigation for multiple marine robotic vehicles. The main idea is to make use of the fact that each individual member of the group could benefit from navigation information obtained from other members. For underwater vehicles cooperative navigation is considerably more challenging but very attractive. Only few vehicles are needed to maintain an accurate estimate of their positions through sophisticated (and expensive) navigation sensors. The other ones can have less sophisticated navigation. [22]. In this chapter, by extending the concept of single beacon navigation for one AUV, we focus in two types of CN: • The one between an ASC and one or more AUVs; • The one between various AUVs. The first one has obvious advantages when it comes to navigation. As there is a ASC located in the sea level, at the surface, it enables the use of GPS to locate the position of the surface, making easier to locate the area where the related AUVs are exploring. These vehicles use, then, another navigation algorithm to compute their location underwater using ASs, in a trilateration system that uses a net of beacons and obtains the location of the vehicle in relation to the ASC. See Figure 4.1. 33
34 Cooperative Navigation Figure 4.1: Cooperative navigation between ASC and AUV (Source: [1]) The second one is used in order to have a permanent communication between AUVs which enables the possibility to explore in formation to cover more area and achieve better goals. Another possibility of this CN technique is to make only one of the vehicles to transmit and receive signals to the beacon system and use this navigation information to control the navigation of the rest of the fleet. See Figure 4.2. Figure 4.2: Underwater fleet navigation (Source: http://goo.gl/D9CJ4) 4.1 CN between AUV and ASC This type of CN is very attractive because the idea is to use an ASC, which is floating on the water, so above sea level, and for this reason it becomes possible to know its coordinates through the GPS system. The setup proposed is to make the ASC to play the role of the beacon as in the case of Chapter 3. However, in this setup, we will have a moving beacon, as the ASC will be able
4.2 CN between AUV and AUV 35 to move and stay still. Moreover, the ASC can in principle make desirable selected movements to allow a better performance on the computation of the position of the AUV, which is working in exploration, rescue, reconnaissance or such missions. By this we get the position of the AUV related to the ASC, which we have previously located through GPS. To extend the SBN to the cooperative setup, some modifications in the algorithm are needed. In particular, the computation of the location of the VBN has to be modified by taking into account the displacement of the beacon. More precisely, in our setup with four (virtual) beacons (N=4) we have p4=pbeacon(12)(4.1) p3=p4+intv34 −[pbeacon(12)−pbeacon(8)] (4.2) p2=p3+intv23 −[pbeacon(8)−pbeacon(4)] (4.3) p1=p2+intv12 −[pbeacon(4)−pbeacon(0)] (4.4) • p(0) - position of the moving beacon at the instant t=0s; • p(4) - position of the moving beacon at the instant t=4s; • p(8) - position of the moving beacon at the instant t=8s; • p(12) - position of the moving beacon at the instant t=12s; 4.2 CN between AUV and AUV For different purposes it becomes an advantage to use an AUV as a beacon reference for other AUVs. This can be used, for instance, to guide multiple vehicles in fleet formation for reconnaissance or rescue purposes. The other vehicles use one AUV as their beacon and can use it as a reference to take their right positions. In environments where few beacons are placed this could have an obvious role and it can also be used mixed with the cooperation with ASCs depending on the purpose we are aiming to. As this type of navigation involves two or more AUVs, we cannot use the same algorithm as with the previous form of cooperation between systems. This is due to the fact that we cannot rely on the GPS, positioning system as both AUVs will be underwater. As the position of both vehicles is unknown, and one of them will be the beacon for the other one, we will have to compute the displacement of the vehicle that will serve as the beacon in a similar process as we did before when we implemented the algorithm for one AUV. Once again, what needs to be changed is how the virtual net beacon is generated and therefore, the calculations of their positions. The integral of the speed of the beacon-AUV will be computed in order to get its respective displacement and later add it to each according P.
36 Cooperative Navigation p4=pbeacon(12)(4.5) p3=p4+intv34 −[pbeacon(12)−pbeacon(8)] (4.6) p2=p3+intv23 −[pbeacon(8)−pbeacon(4)] (4.7) p1=p2+intv12 −[pbeacon(4)−pbeacon(0)] (4.8) In this case, the AUV with the beacon needs to have more sophisticated inertial sensors in order to integrate its velocities without accumulating much error.
Chapter 5 Results and discussion 5.1 Single Navigation In this part, the results obtained throughout the SBN algorithm implementation will be discussed. Some details that should be mentioned about the simulation process are: • Every 12 seconds, we update the Kalman filter with a new location. • The sampling time of the overall algorithm is 0.1 s. This time is defined in the configuration parameters. • It is implicitly assumed that the velocity measurements are obtained at each sampling time. The range measurements are obtained every 4 s. • For this simulations, we run the program 800s, which was a time we considered appropriate for the AUV to travel enough as to make it easier to be tracked. For simulation purposes, the path picked for the AUVs movement is a relatively common one. It contains many of the standard types of movements the AUV can have, turning left and right and heading forward and is also realistic as it is the type of paths these vehicles follow when exploring and other similar types of missions. It is important to stress that several paths were tested during and after implementing the program because the ability to track the right position and for the algorithm to converge it could be concluded that there are some paths that are better than others. This will be shown clearly in the next figures. For example, a path that may have some problems is when when the vehicle moves in a straight line away from the beacon and turns out that in this case the location of the positions of the (virtual) beacons are aligned in that a line parallel to the trajectory. In this case, the algorithm may diverge as there is no way of knowing the real distance between the beacon and the vehicle; we just know it is somewhere along that line. 37
38 Results and discussion For this reason, as we will see further on, when the navigation is cooperative, with the aid of a moving AUV or ASC, we get better results as we can avoid the greater flaws of this system and by moving the beacon in some "good" directions. After realising this, some paths were set for the AUV to follow. As expected some with better results than others, but none yet having the best desired results, which are only achieved in cooperation. 5.1.1 Straight Line Movement Obtained by simply putting the angular speed to zero and keeping the linear speed at 1 m/s. 5.1.1.1 Without noise and without current To start the simulation of the results of the program implemented in Matlab it was wise to start with the simplest of the cases. In this simulation we can observe the movement made by the vehicle which is coloured in green and we can compare it with the estimated movement obtained by superposing the values of the estimated positions(black dots) of the vehicle using the trilateration algorithm and the Kalman response, given in red. See Figure 5.1. −90 −80 −70 −60 −50 −40 −30 −20 −10 0 10 −100 0 100 200 300 400 500 600 700 800 y [m] x [m] AUV Position Estimated Pos Kalman Response Figure 5.1: Line movement without noise or current 5.1.1.2 With noise and without current After the previous simulation we add some noise to make this simulation more realistic since, when tested in the real world these kind of systems always involve noise. This happens in the sensors , under influence of the environment (storms or such), errors in calculations, so adding it up helps considering these factors. See Figure 5.2. This problem is easily solved by the filter and does not introduce too much harm to the functioning of the trilateration.
5.1 Single Navigation 39 −200 −150 −100 −50 0 50 −100 0 100 200 300 400 500 600 700 800 y [m] x [m] AUV Position Estimated Pos Kalman Response Figure 5.2: Line movement with noise and without current 5.1.1.3 With current and without noise Firstly the testing was done without considering the current speed. Later it had to be implemented as it is a crucial factor in this field. The currents affect greatly the vehicle trajectory and if we don’t consider them in the algorithm, it will not work as it diverges and does not bring any good results. To be able to compute the position of the vehicle with current speed it is imperative that we use the KF. Due to its capability to act recursively, the KF is used to estimate the current disturbance and use this estimate in order to find the correct location of the vehicle. See Figure 5.3. −50 0 50 100 150 200 −200 0 200 400 600 800 1000 y [m] x [m] AUV Position Estimated Pos Kalman Response Figure 5.3: Line movement with current and without noise
46 Results and discussion −40 −20 0 20 40 60 80 100 120 140 −100 −80 −60 −40 −20 0 20 40 60 80 100 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.14: Line movement with noise and without current 5.2.1.3 With current and without noise Once again, the current actually improves the result. See Figure 5.15. −100 0 100 200 300 400 500 600 −100 −50 0 50 100 150 200 250 300 350 400 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.15: Line movement with current and without noise 5.2.1.4 With current and noise And the noise causes problems in the curves. See Figure 5.16.
5.2 Cooperative Navigation - Between ASC and AUV 47 −100 0 100 200 300 400 500 600 −100 −50 0 50 100 150 200 250 300 350 400 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.16: Line movement with current and noise 5.2.2 Circular Movement of the ASC With a circular movement we get better results than with the straight line, but these are still not the results we are after. 5.2.2.1 Without noise and without current Still with large deviations, hard to converge. See Figure 5.17. −40 −20 0 20 40 60 80 100 120 −80 −60 −40 −20 0 20 40 60 80 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.17: Circular movement without current or noise 5.2.2.2 With noise and without current Similar to the previous simulation. See Figure 5.18.
48 Results and discussion −40 −20 0 20 40 60 80 100 120 −80 −60 −40 −20 0 20 40 60 80 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.18: Circular movement with noise and without current 5.2.2.3 With current and without noise Current helps the algorithm convergence, giving better results. See Figure 5.19. −50 0 50 100 150 200 250 300 −50 0 50 100 150 200 250 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.19: Circular movement with current and without noise 5.2.2.4 With current and noise Noise does not affect much or, if anything, even makes it better. See Figure 5.20.
5.2 Cooperative Navigation - Between ASC and AUV 49 −50 0 50 100 150 200 250 300 −50 0 50 100 150 200 250 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.20: Circular movement with current and noise Just to show the results with a bigger circular movement. See Figure 5.21. −50 0 50 100 150 200 −150 −100 −50 0 50 100 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.21: Circular movement with current and noise
50 Results and discussion 5.2.3 S Movement of the ASC In this case, the ASC follows the AUV right above it, on the surface. This is the movement we were looking for. 5.2.3.1 Without noise and without current Perfect results. See Figure 5.22. −40 −20 0 20 40 60 80 −80 −60 −40 −20 0 20 40 60 80 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.22: S movement without current or noise 5.2.3.2 With noise and without current Noise is hardly noticeable. See Figure 5.23. −40 −20 0 20 40 60 80 −80 −60 −40 −20 0 20 40 60 80 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.23: S movement with noise and without current
5.2 Cooperative Navigation - Between ASC and AUV 51 5.2.3.3 With current and without noise Tracks well the AUV under the influence of the current. See Figure 5.24. −50 0 50 100 150 200 250 300 −50 0 50 100 150 200 250 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.24: S movement with current and without noise The next extra figure shows what happens when the vehicle wants to turn back against the current, and has the same speed. As expected the vehicle can’t move against it. See Figure 5.25. −40 −20 0 20 40 60 80 −100 0 100 200 300 400 500 600 700 800 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.25: S movement with current and without noise 5.2.3.4 With current and noise Noise does not affect this performance at all.See Figure 5.26.
52 Results and discussion −50 0 50 100 150 200 250 300 −50 0 50 100 150 200 250 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.26: S movement with current and noise 5.2.4 N Movement of the ASC This motion was just tested for curiosity, by far not appropriate. Too many diverging points. 5.2.4.1 Without noise and without current Poor performance. See Figure 5.27. −60 −40 −20 0 20 40 60 80 100 120 140 −80 −60 −40 −20 0 20 40 60 80 100 120 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.27: S movement without current or noise 5.2.4.2 With noise and without current See Figure 5.28.
5.2 Cooperative Navigation - Between ASC and AUV 53 −60 −40 −20 0 20 40 60 80 100 120 140 −150 −100 −50 0 50 100 150 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.28: S movement with noise and without current 5.2.4.3 With current and without noise Improves significantly with the current. See Figure 5.29. −50 0 50 100 150 200 250 300 −50 0 50 100 150 200 250 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.29: S movement current and without noise 5.2.4.4 With current and noise Highly affected by noise. See Figure 5.30.
54 Results and discussion −50 0 50 100 150 200 250 300 −50 0 50 100 150 200 250 y [m] x [m] AUV Position ASC Position Estimated Pos Kalman Response Figure 5.30: S movement with current and noise We conclude that, as we had already foreseen in calculations and reasoning that the best motion for the ASC would be above the AUV. Some more results are added in Appendix 3, related to velocities obtained and when noise is added to them. 5.3 Cooperative Navigation - Between AUV and AUV In the previous chapter we already explained the main difference in the implementation of this system. However, we can’t fully replicate the conditions behind this functioning as the computing would be done in the beacon AUV (integration of its speed) and then sent to the AUV we want to locate. In this case, for easier implementation and just to have some idea of what would happen in the AUV to AUV case, the implementation was done in the same block (which means the same AUV) as the rest. The difference, however, would not be that big, having to consider some delay and error, in fact, but still some approximation of the reality is possible. It does not make sense to print all simulations again as the results are close to the ones represented above.
Chapter 6 Conclusions and Further Research 6.1 Summary To sum up, navigation algorithms together with better and new sensors are continuously evolving at an increasing rate, which is why we cannot yet foresee how it will unravel in the far future. Nowadays and in the near future, navigation is an important role and is constantly evolving with the objective of consuming fewer resources and granting better results. In this work we addressed the way to use fewer beacons in the trilateration process used underwater to track the location of AUVs. This was possible through the use of advanced navigation algorithms. This is one particular case where better technology/knowledge leads to better and cheaper performance. For the algorithm proposed we have realized that the use of a KF was essential, otherwise we could only compute the location of the AUV without ocean current, which would limit considerably its application. The cooperative component is ever becoming more of a must in the evolution of navigation as it unlocks many possibilities. It also is economically viable as it is a way to spare equipment; by using a ASV/AUV as a beacon and give the whole operation more mobility and more effectiveness. Large systems composed by ASC and multiple AUVs all navigating in cooperation can fulfil many important roles. 6.2 Further Research The next immediate step of this project would be to convert the Matlab code to C code and download it to AUVs in order to test it in a controlled environment at first (pool) and later send it on missions, always collecting the data from the missions in order to perfect the code and algorithm used. 55
62 Appendix 1 111 p3x=0; 112 p4x=0; 113 p1y=0; 114 p2y=0; 115 p3y=0; 116 p4y=0; 117 118 f = zeros(2,1); 119 120 p = zeros(2,1); 121 p1 = zeros(2,1); 122 p2 = zeros(2,1); 123 p3 = zeros(2,1); 124 p4 = zeros(2,1); 125 126 int_vy_12 = 0; 127 int_vy_23 = 0; 128 int_vy_34 = 0; 129 130 int_vx_12 = 0; 131 int_vx_23 = 0; 132 int_vx_34 = 0; 133 134 int_v_12 = zeros(2,1); 135 int_v_23 = zeros(2,1); 136 int_v_34 = zeros(2,1); 137 trigger = 0; 138 end 139 trigger = 0; 140 141 % in the beginning of the program, fills in the value of 120 ... velocities, which have entered in the block 142 % this velocities will be used to compute the positions; this happens ... with the integration of the vehicle's displacement 143 144 if (t < 0.1) 145 146 w=1; 147 myflag = 1; 148 149 % myflag is used to make sure the program only uses one velocity every ... 0.1 seconds 150 end 151 152 153 154 if(t≥0.1 && w<121) 155 if (∆== 1 && myflag == 1) 156 vx_array(w) = vx;
A.2 MatLab blocks and modules code 63 157 vy_array(w) = vy; 158 159 if (w==1) 160 d_array(1)=d; 161 PB_0 =[pxB;pyB]; 162 end 163 164 w=w+1; 165 myflag = 0; 166 167 %is put to 0 after writing the value of the velocities to create the ... Rising Edge effect 168 169 end 170 171 myflag=1; 172 end 173 174 175 176 177 %−−WRITTING OF THE D'S−− 178 179 if(w==41) %every 4 seconds, saves the ... value of d and PB 180 t; 181 d_array(2)=d; 182 PB_4 =[pxB;pyB]; 183 184 end 185 if(w==81) 186 t; 187 d_array(3)=d; 188 PB_8 =[pxB;pyB]; 189 end 190 if(w==121) 191 t; 192 d_array(4)=d; 193 PB_12 =[pxB;pyB]; 194 end 195 196 197 d1 = d_array(1) ; 198 d2 = d_array(2) ; 199 d3 = d_array(3) ; 200 d4 = d_array(4) ; 201 202 %−−CODE THAT FOR EVERY PERIOD OF T COMPUTES THE AREA OF THE RESPECTIVE ... INTEGRAL−−
64 Appendix 1 203 %%{ 204 205 206 207 if(w == 121) % after writing all velocities 208 209 % instant from 0 to 4 seconds, calculation of the displacement and ... acquisition of d1 210 for i=1:40 211 212 213 xi = 0.1 *vx + xi; 214 yi = 0.1 *vy + yi; 215 216 217 end 218 219 220 x1 = xi; 221 int_vx_34 = x1; 222 223 y1 = yi; 224 int_vy_34 = y1; 225 226 int_v_34 = [int_vx_34; int_vy_34]; 227 228 xi=0; 229 yi=0; 230 231 % instant from 4 to 8 seconds, calculation of the displacement and ... aquisition of d2 232 233 for i=41:80 234 235 236 xi = 0.1 *vx + xi; 237 yi = 0.1 *vy + yi; 238 239 240 end 241 242 243 x2=xi; 244 int_vx_23= x2; 245 246 y2=yi; 247 int_vy_23= y2; 248 249 int_v_23 = [int_vx_23; int_vy_23];
A.2 MatLab blocks and modules code 65 250 251 xi=0; 252 yi=0; 253 254 % instant from 8 to 12 seconds, calculation of the displacement and ... aquisition of d3 255 256 for i=81:120 257 258 259 xi = 0.1 *vx + xi; 260 yi = 0.1 *vy + yi; 261 262 263 end 264 265 266 %after 12 seconds, aquisition of d4 267 268 x3=xi; 269 int_vx_12=x3; 270 271 y3=yi; 272 int_vy_12=y3; 273 274 int_v_12 = [int_vx_12; int_vy_12]; 275 276 xi=0; 277 yi=0; 278 279 %−−FUNCTION THAT COMPUTES THE P'S THAT WILL BE USED IN THE OPTIMIZATION−− 280 281 p4 = [0;0] + PB_12; 282 p3 = p4 + int_v_34 −(PB_12 −PB_8); 283 p2 = p3 + int_v_23 −(PB_8 −PB_4); 284 p1 = p2 + int_v_12 −(PB_4 −PB_0); 285 286 p4x=p4(1); 287 p3x=p3(1); 288 p2x=p2(1); 289 p1x=p1(1); 290 291 p4y=p4(2); 292 p3y=p3(2); 293 p2y=p2(2); 294 p1y=p1(2); 295 %} 296 297 %−−−−−OPTIMIZATION FUNCTION−−−−−−
66 Appendix 1 298 299 w=1; 300 if (trig == 1 && myflag2 == 0) 301 302 xk=x0; 303 304 305 n=0; 306 nmax=4000; %set max ... number of iterations 307 308 alf = 0.2; 309 bet = 0.5; 310 311 while (n≤nmax) %set ... while−conditions 312 313 314 f =((norm (xk−p1))^2 −d1^2)^2 +((norm (xk−p2))^2 −d2^2)^2 ... +((norm (xk−p3))^2 −d3^2)^2 +((norm (xk−p4))^2 −d4^2)^2; 315 316 hx=4*(px−p1x)*(−(d1.^2) + (p1x −px)^2 + (p1y −py)^2 ) + ... 4*(px−p2x)*(−(d2.^2) + (p2x −px)^2 + (p2y −py)^2 ) + ... 4*(px−p3x)*(−(d3.^2) + (p3x −px)^2 + (p3y −py)^2 ) + ... 4*(px−p4x)*(−(d4.^2) + (p4x −px)^2 + (p4y −py)^2 ); 317 318 hy=4*(py−p1y)*(−(d1.^2) + (p1x −px)^2 + (p1y −py)^2 ) + ... 4*(py−p2y)*(−(d2.^2) + (p2x −px)^2 + (p2y −py)^2 ) + ... 4*(py−p3y)*(−(d3.^2) + (p3x −px)^2 + (p3y −py)^2 )+ ... 4*(py−p4y)*(−(d4.^2) + (p4x −px)^2 + (p4y −py)^2 ); 319 320 gf=[hx;hy]; % parcial primitives of g, x and y; ... gradient 321 dk = −gf; 322 323 tk=1; 324 325 f2 = ((norm (xk + tk*dk−p1))^2 −d1^2)^2 +((norm (xk + ... tk*dk−p2))^2 −d2^2)^2 +((norm (xk + tk*dk−p3))^2 ... −d3^2)^2 +((norm (xk + tk*dk−p4))^2 −d4^2)^2 ; 326 327 aux = f + tk *alf *(gf' *dk); 328 329 330 %computes the value of tk, which becomes smaller every iteration 331 332 while( f2 > aux(1)) 333 334 tk = bet *tk;
A.2 MatLab blocks and modules code 67 335 f2 = ((norm (xk + tk*dk−p1))^2 −d1^2)^2 +((norm (xk + ... tk*dk−p2))^2 −d2^2)^2 + ((norm (xk ... + tk*dk−p3))^2 −d3^2)^2 +((norm (xk + tk*dk−p4))^2 ... −d4^2)^2 ; 336 aux = f + tk *alf *(gf' *dk); 337 338 end 339 340 xk = xk + tk*dk; %update x and n 341 342 px = xk(1); 343 py = xk(2); 344 n=n+1; 345 346 end 347 348 %from the optimization we get a value from the position q, which will ... the the output of the %system 349 350 end 351 352 353 354 355 end 356 myflag2=trig; 357 358 q = [ px;py ]; 359 360 end
68 Appendix 1 Kalman Filter 1 2function [error, xhatOut, xcorrente ] = EXTKALMAN(q,trigger,vr) 3%EXTKALMAN Extended Kalman Filter 4 5 6% Initialization 7persistent P; 8persistent xhat; 9persistent triggerold; 10 11 if isempty(P) 12 13 14 % xhat = [q; vr]; 15 16 xhat=[−50; −30;0;0]; 17 P=1*eye(4); 18 triggerold=0; 19 20 end 21 22 % Radar update time ∆t is inherited from model workspace 23 24 % 1. Compute Phi, Q, and R 25 Phi = [1,0,0.1,0; 26 0,1,0,0.1; 27 0,0,0.1,0; 28 0,0,0,0.1]; 29 30 Q = 0.1 *diag([0.01 0.01 0.01 0.01]); 31 R = 1*diag([1 1]); 32 33 34 B = [0.1,0;0,0.1;0,0;0,0]; 35 M = [ 1,0,0,0;0,1,0,0 ]; 36 37 38 % 2. Propagate the covariance matrix: 39 P = Phi*P*Phi' + Q; 40 41 % 3. Propagate the track estimate:: 42 xhat = Phi*xhat+ B*vr; 43 44 45 % % 4 b). Compute observation vector y and linearized measurement ... matrix M
A.2 MatLab blocks and modules code 69 46 yhat = M *xhat; 47 48 % 4 c). Compute error (Estimation Error) 49 50 error = q −yhat; 51 52 53 %so that the program only runs this every 12 seconds 54 if (trigger == 1 && triggerold == 0 ) 55 56 % 5. Compute Kalman Gain: 57 W=P*M'*inv(M*P*M'+ R); 58 59 % 6. Update estimate 60 xhat = xhat + W*error; 61 62 % 7. Update Covariance Matrix 63 P = (eye(4)−W*M)*P*(eye(4)−W*M)' + W*R*W'; 64 end 65 66 triggerold = trigger; 67 68 xhatOut = [xhat(1);xhat(2)]; 69 xcorrente = [xhat(3);xhat(4)]; Path Implementation 1 2 3function [v,w] = Spath(t) 4 5persistent x; 6 7if isempty(x) 8x=0; 9end 10 11 w=0; 12 13 if(t<50*pi+600) 14 15 v=1 ; 16 17 else 18 19 v=0; 20 end 21 22
70 Appendix 1 23 if(t<100) 24 25 w=0; 26 27 end 28 29 30 if(t ≥100 && t < 10*pi + 100) 31 32 w=0.1; 33 34 end 35 36 if(t ≥10*pi + 100 && t < 10*pi+200) 37 38 w=0; 39 40 end 41 42 if(t ≥10*pi+200 && t < 20*pi+200) 43 44 w=−0.1; 45 46 end 47 48 49 if(t≥20*pi+200 && t < 20*pi+300) 50 51 w=0; 52 53 end 54 55 if(t≥20*pi+300 && t< 30*pi+300) 56 57 w=0.1; 58 59 end 60 61 if(t≥30*pi+300 && t<30*pi+400 ) 62 63 w=0; 64 65 end 66 67 if(t ≥30*pi+400 && t < 40*pi+400) 68 69 w=−0.1; 70 71 end
A.2 MatLab blocks and modules code 71 72 73 if(t≥40*pi+400 && t < 40*pi+500) 74 75 w=0; 76 77 end 78 79 if(t≥40*pi+500 && t< 50*pi+500) 80 81 w=0.1; 82 83 end 84 85 if(t≥50*pi+500 && t < 50*pi+600) 86 87 w=0; 88 89 end 90 91 92 end