Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
localization VROB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Böttger
localization VROB
Commits
195dca30
Commit
195dca30
authored
1 year ago
by
Jessica Dreyer
Browse files
Options
Downloads
Patches
Plain Diff
Corrected spelling mistakes
parent
13a96add
No related branches found
No related tags found
1 merge request
!1
Development
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
localization.py
+16
-16
16 additions, 16 deletions
localization.py
with
16 additions
and
16 deletions
localization.py
+
16
−
16
View file @
195dca30
...
...
@@ -8,7 +8,7 @@ Created on Mon May 1 14:48:45 2023
import
numpy
as
np
import
pandas
as
pd
#%% constans
#%% constan
t
s
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:
# The race track is given during the creati
o
n 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 an can be choosen individually.
The sectiontyp is an int an can be one of the states:
The name of the section is a string an
d
can be choosen individually.
The sectiontyp is an int an
d
can be one of the
following
states:
0 = straight; 1 = right turn; 2 = left turn
Th
is
three values are saved in the const-variables S, R and L.
Th
ese
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 stand for one of the three states S, R or L.
Each int stand
s
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 get
s
a set of sections and a boolean value for debug
g
ing.
"""
def
__init__
(
self
,
sections
,
debug
=
False
):
self
.
sections
=
sections
...
...
@@ -115,9 +115,9 @@ class Localizer:
return
track
"""
# This function updates the object values depending o
f
the section type which is provided.
If the section type is the same
like
befor nothing change.
If the section type ha
va
changed, all object variables are updated and the variable
"
enter_new_section
"
is set to true.
# This function updates the object values depending o
n
the section type which is provided.
If the section type is the same
as
befor
e
nothing change
s
.
If the section type ha
s
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 recogni
c
ed sections and the current recogni
c
ed section.
# This function calculate
s
the section w
here the robot is located w
ith the highest probability
# The calculation
is
based on a given set of sections, the last five recogni
z
ed sections and the current recogni
z
ed 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 print
s at
the consol.
# This is a
n
intern function which translate
s
the int values to a string.
It is only used for debug
g
ing or print
ing to
the consol.
"""
def
__get_section_type
(
self
,
section_type_int
):
section_type_string
=
""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment