Question

In: Computer Science

Terrain navigation is a key component in the design of unmanned aerial vehicles (UAVs). Vehichles such...

Terrain navigation is a key component in the design of unmanned aerial vehicles (UAVs). Vehichles such as a robot or a car, can travel on land; and vehiches such as a drone or a plane can fly above the land. A UAV system contains an on board computer that has stored the terrain information for the area in which it is to be operated, Because it knows where it is at all times (often using a global positioning system (GPS) receiver), the vehicle can then select the best path to get to a designed spot. If the destination changes, the vehicle can refer to its internal maps and recompute the new path. The computer software that guides these vechicles must be tested over a variety of land formations and topologies. Elevvation information for large grids of land is available in computer databases. One way of measuring the "difficulty" of a lanad grid with respect to terrain navigation is to determine the number of peaks in the grid, where a peak is a point that has lower elevations all around it. For this problem, we want to determine whether the value in grid position [m] [n] is peak. Assume that the values in the four positions shown are adjacent to grid position [m] [n]

grid [m-1] [n]
grid [m][n-1] grid [m][n]    grid [m][n+1]
grid [m+1] [n]

Write a program in C PROGRAMMING that reads elevation data from a data file named grid1. txt. (this file you have to create and name it as grid 1.txt.) data as shown below which represent elevation for a grid that has 6 points along the side and seven points along the top ( the peaks have been highlighted and underlined):

5039 5127 5238 5259 5248 5310 5299

5150 5392 5410 5401 5352 5820 5321

5290   5560    5490 5421 5530 5831    5210

5110 5429 5430 5411 5459 5630 5319

4920 5129 4921   5821 4722 4921 5129

5023 5129 4822 4872 4794 4862 4245

Then prints the number of peaks and their locations. Assume that the first line of the data file contains the number of rows and the number of columns for the grid of information. These values are then followed by the elevation values, in row order. The maximum size of the grid is 25 rows by 25 columns.

Hints:

  1. Define and print the number of peaks and their locations in an elevation grid.
  2. input is a file containing the elevation data and the output is a listing of the location of the peaks.
  3. to specify the location of the peaks, you need to assign an addressing scheme to the data because you are going to implement this solution in c. Therefore, choose its 2D array subscripting notation.
  4. assume the top left corner is position [0][0], the row numbers increase by 1 as move down the page and the column numbers increase by 1 as move to the right.
  5. These peaks then occur at position[2][1], [2][5], and [4][3].
  6. To determine the peaks, compare a potential peak with its four neighbouring points.
  7. if all four neighboring points are less that the potential peak, then the potential peak is a real peak.
  8. the points on the edges of the array or grid cannot be potential peaks because do not have elevation information on all four sides of the points.

#Need solution c/c++ programmme

Solutions

Expert Solution

Answer :

The required c code is

code :

#include <stdio.h>
#include <stdlib.h>
#define SIZE 25
int main()
{
FILE *fp = fopen("Text.txt","r");
int grid[SIZE][SIZE];
int rows, cols, i , j;
int num_peaks = 0;
if(fp != NULL)
{
fscanf(fp,"%d %d",&rows,&cols);
for(int i=0;i<rows;i++)
{
for(int j=0;j<cols;j++)
{
fscanf(fp,"%d",&grid[i][j]);
}
}
fclose(fp);
for(int i=1;i<rows-1;i++)
{
for(int j=1;j<cols-1;j++)
{
if((grid[i][j] > grid[i-1][j]) && (grid[i][j] > grid[i+1][j]) && (grid[i][j] > grid[i][j-1]) && (grid[i][j] > grid[i][j+1]))
num_peaks++;
}
}
printf("\nTotal number of peaks: %d",num_peaks);
printf("\nCurrent positions of the peaks: ");
for(int i=1;i<rows-1;i++)
{
for(int j=1;j<cols-1;j++)
{
if((grid[i][j] > grid[i-1][j]) && (grid[i][j] > grid[i+1][j]) && (grid[i][j] > grid[i][j-1]) && (grid[i][j] > grid[i][j+1]))
printf("\n[%d][%d]",i,j);
}
}
printf("\n");

get
}
else
printf("Unable to open file: Text.txt");
getch();
}

Result:

=======================================================================================

ANSWERED AS PER MY KNOWLEDGE

IF ANY DOUBTS COMMENT IT


Related Solutions

You are required to solve the problem on Terrain Navigatio. Terrain navigation is a key component...
You are required to solve the problem on Terrain Navigatio. Terrain navigation is a key component in the design of unmanned aerial vehicles (UAVs). Vehichles such as a robot or a car, can travel on land; and vehiches such as a drone or a plane can fly above the land. A UAV system contains an on board computer that has stored the terrain information for the area in which it is to be operated, Because it knows where it is...
In the use of unmanned aerial vehicles (UAVs) that will shape the future of UAV applications,...
In the use of unmanned aerial vehicles (UAVs) that will shape the future of UAV applications, an online shopping company has purchased a group of UAVs for $79000. The market value is expected to decrease by $9000 per year. Also, the UAVs will be depreciated within a 5 years. As cargo drones are a proven technology for the logistics industry, it is expected that the purchase of the group of UAVs will increase the company’s revenue by $10000 annually. Although,...
In the use of unmanned aerial vehicles (UAVs) that will shape the future of UAV applications,...
In the use of unmanned aerial vehicles (UAVs) that will shape the future of UAV applications, an online shopping company has purchased a group of UAVs for $84000. The market value is expected to decrease by $4000 per year. Also, the UAVs will be depreciated within 6 years. As cargo drones are a proven technology for the logistics industry, it is expected that the purchase of the group of UAVs will increase the company’s revenue by $16000 annually. Although, there...
Landmark Systems Inc. designs and manufactures global positioning navigation systems for all-terrain vehicles and watercraft. It...
Landmark Systems Inc. designs and manufactures global positioning navigation systems for all-terrain vehicles and watercraft. It has two support departments: Design and Engineering; and, two production departments, Vehicle Systems and Water Craft Systems. The budgeted level of service relationships at the start of the year was: Used by: Design Engineering Vehicles Water Craft Supplied by:   Design 0.10 0.40 0.50   Engineering 0.05 0.35 0.60 Landmark Systems Inc. collects fixed costs and variable costs of each support department in separate pools. The...
Search the Internet for pertinent information that supports the integration of unmanned aerial systems into the...
Search the Internet for pertinent information that supports the integration of unmanned aerial systems into the National Airspace Plan and the Air Traffic Control system. Summarize, describing how ATC Interoperability can be smoothly integrated and also discuss problems associated with this integration. Some subjects to consider are human factors, low altitude operations safety, noise reduction, UAS traffic management, and UAS wake separation standards for UAS integration into the NAS.
Discuss the application of Unmanned Aerial Systems (UAS) in various industries and the benefits of using...
Discuss the application of Unmanned Aerial Systems (UAS) in various industries and the benefits of using UAS in those industries.
Discuss the application of Unmanned Aerial Systems (UAS) in various industries and the benefits of using...
Discuss the application of Unmanned Aerial Systems (UAS) in various industries and the benefits of using UAS in those industries.
Discuss the application of Unmanned Aerial Systems (UAS) in various industries and the benefits of using...
Discuss the application of Unmanned Aerial Systems (UAS) in various industries and the benefits of using UAS in those industries.
Suppose that the U.S. military deploys the X-47B, an unmanned aerial drone capable of sensing, tracking,...
Suppose that the U.S. military deploys the X-47B, an unmanned aerial drone capable of sensing, tracking, identifying, targeting, and destroying an enemy target with very limited human oversight—assume it is a human-on­-the-loop weapon. As a weapon in the ongoing conflict with the Islamic State (ISIS) terrorist organization, X-47B is tasked with missions to target and kill senior ISIS operatives. Now imagine a particular mission, in which an X-47B is given a programmed mission to carry out a targeted strike on...
Polarix is a retailer of ATVs (all-terrain vehicles) and accessories. An income statement for its Consumer...
Polarix is a retailer of ATVs (all-terrain vehicles) and accessories. An income statement for its Consumer ATV Department for the current year follows. ATVs sell for $4,000 each. Variable selling expenses are $210 per ATV. The remaining selling expenses are fixed. Administrative expenses are 50% variable and 50% fixed. The company does not manufacture its own ATVs; it purchases them from a supplier for $1,830 each. POLARIX Income Statement—Consumer ATV Department For Year Ended December 31, 2017 Sales $ 652,000...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT