diff --git a/localization.py b/localization.py index b9249bc0f0e8ff764932470eec1ba1f3f9e7dfe0..c02cce718a24b8ffa0e94a30383c5efa3c2c6e24 100644 --- a/localization.py +++ b/localization.py @@ -8,7 +8,7 @@ Created on Mon May 1 14:48:45 2023 import numpy as np import pandas as pd -#%% constans +#%% constants S = 0 # Value for a straight part of the track R = 1 # Value for a right turn L = 2 # Value for a left turn @@ -17,19 +17,19 @@ L = 2 # Value for a left turn #%% Classes """ # This class provides methods to localize a robot on a given race track. -# The race track is given during the creatin of the object and contains the following structure: - [name of the section, sectiontype, array of the last sectiontypes] - The name of the section is a string an can be choosen individually. - The sectiontyp is an int an can be one of the states: +# The race track is given during the creation of the object and contains the following structure: + [name of the section, section type, array of the last section types] + The name of the section is a string and can be choosen individually. + The sectiontyp is an int and can be one of the following states: 0 = straight; 1 = right turn; 2 = left turn - This three values are saved in the const-variables S, R and L. - The array of the last sectiontypes is a simple array which contains a set of ints. - Each int stand for one of the three states S, R or L. + These three values are saved in the const-variables S, R and L. + The array of the last section types is a simple array which contains a set of ints. + Each int stands for one of the three states S, R or L. """ class Localizer: """ - # The constructor get a set of sections and a boolean value for debuging. + # The constructor gets a set of sections and a boolean value for debugging. """ def __init__(self, sections, debug = False): self.sections = sections @@ -115,9 +115,9 @@ class Localizer: return track """ - # This function updates the object values depending of the section type which is provided. - If the section type is the same like befor nothing change. - If the section type hava changed, all object variables are updated and the variable "enter_new_section" is set to true. + # This function updates the object values depending on the section type which is provided. + If the section type is the same as before nothing changes. + If the section type has changed, all object variables are updated and the variable "enter_new_section" is set to true. """ def update_position(self, section_type): if self.current_section_type is not section_type: @@ -129,8 +129,8 @@ class Localizer: self.enter_new_section = False """ - # This function calculate the section with the highest probability to the current section the robot are on. - # The calculation based on a given set of sections, the last five recogniced sections and the current recogniced section. + # This function calculates the section where the robot is located with the highest probability + # The calculation is based on a given set of sections, the last five recognized sections and the current recognized section. """ def localize(self): if(self.debug): @@ -216,8 +216,8 @@ class Localizer: return possible_sections """ - # This is a intern function which translate the int values to a string. - It is only used for debuging or prints at the consol. + # This is an intern function which translates the int values to a string. + It is only used for debugging or printing to the consol. """ def __get_section_type(self, section_type_int): section_type_string = ""