Thank you for visiting You are to write a program that will assist in tracking vehicles The overall system consists of three parts 1 GPS device vehicle laptop 2. This page is designed to guide you through key points and clear explanations related to the topic at hand. We aim to make your learning experience smooth, insightful, and informative. Dive in and discover the answers you're looking for!

You are to write a program that will assist in tracking vehicles. The overall system consists of three parts:

1. GPS device, vehicle laptop
2. Server program which maintains a list of all vehicles and locations
3. Mapping program which will map the vehicles

You will only be responsible for the second part: the program to maintain a list of vehicles. This will require reading position messages from 'vehicles' and responding to vehicle information from the mapping program.

**Vehicle Messages:**

The 'vehicle' will send in positions using a modified NMEA 0183 format, specifically the RMC command (Recommended Minimum command). An RMC message looks like:

`$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A`

Where:

- RMC: Recommended Minimum sentence
- 123519: Fix taken at 12:35:19 UTC
- A: Status A=active or V=Void
- 4807.038,N: Latitude 48 deg 07.038' N
- 01131.000,E: Longitude 11 deg 31.000' E
- 022.4: Speed over the ground in knots
- 084.4: Track angle in degrees True
- 230394: Date - 23rd of March 1994
- 003.1,W: Magnetic Variation
- *6A: The checksum data, always begins with *

An NMEA sentence will always end with an endline (\n). The checksum is a XOR of all the bytes between the $ and *.

The modification will be an extra field indicating vehicle identifier added just before the checksum. For example, if the vehicle identifier is V101, the message would be:

`$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W,V101*30`

Your program should listen on UDP port 9099 for these modified RMC messages. You should ensure that the checksum is correct and discard any messages with an invalid checksum, providing error messages as appropriate.

Vehicles may go to places where regular updates do not occur. In the absence of updates, keep the last known position/status of a vehicle for up to 30 seconds. If you have not received an update from a vehicle for 30 seconds, drop the vehicle from the list of vehicles. You do not need to use the time in the RMC message. You can use system times, such as LocalTime.now().

Answer :

Final answer:

To track vehicles using a program, you need to establish a system that can receive and process position messages from the vehicles. The program should validate the checksum of each message to ensure its integrity. It should also keep track of the last known position and status of each vehicle for up to 30 seconds.

Explanation:

To track vehicles using a program, you need to establish a system that can receive and process position messages from the vehicles. In this case, the program will listen on UDP port 9099 for modified RMC messages. These messages contain information about the vehicle's position, status, speed, and other relevant data.

The program should validate the checksum of each message to ensure its integrity. The checksum is calculated by performing an XOR operation on all the bytes between the '$' and '*' characters in the message. If the calculated checksum does not match the checksum provided in the message, the program should discard the message and display an appropriate error message.

In addition to validating the checksum, the program should keep track of the last known position and status of each vehicle for up to 30 seconds. This ensures that even in the absence of updates, the program retains the most recent information about each vehicle. To determine if a vehicle has not been updated within 30 seconds, the program can use the system time. By comparing the current time with the time of the last received update, the program can identify vehicles that require removal from the list.

By maintaining a list of vehicles and their locations, the program can provide real-time tracking information. This information can be used to monitor the fleet of vehicles, track their movements, and assist in managing their operations effectively.

Learn more about tracking vehicles with a program here:

https://brainly.com/question/34755415

#SPJ14

Thank you for reading the article You are to write a program that will assist in tracking vehicles The overall system consists of three parts 1 GPS device vehicle laptop 2. We hope the information provided is useful and helps you understand this topic better. Feel free to explore more helpful content on our website!

Rewritten by : Jeany