Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CPS_project_group13
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hierck, J.J. (Jelle, Student M-BME,M-EMSYS)
CPS_project_group13
Commits
b4bbb33e
Commit
b4bbb33e
authored
4 years ago
by
jhierck laptop
Browse files
Options
Downloads
Patches
Plain Diff
Added some variables to add clarity
parent
747299f0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mappingbot/encoder.py
+4
-1
4 additions, 1 deletion
mappingbot/encoder.py
with
4 additions
and
1 deletion
mappingbot/encoder.py
+
4
−
1
View file @
b4bbb33e
...
...
@@ -7,6 +7,9 @@ print(GPIO.VERSION)
class
Encoder
:
PULSES_PER_ROTATION
=
40
# How many edges you would detect in a full rotation
WHEEL_DIAMETER
=
6
# TODO: Move this into another file which holds constants like this
def
__init__
(
self
,
name
,
encoder_pin
:
int
):
"""
Initialize some stuff
"""
self
.
name
=
name
...
...
@@ -50,7 +53,7 @@ class Encoder:
def
get_speed
(
self
)
->
float
:
"""
Convert pulse speed to cm/s
"""
pulse_per_second
=
self
.
get_current_pulse_speed
()
return
pulse_per_second
*
(
6
*
2
*
math
.
pi
)
/
40
return
pulse_per_second
*
(
self
.
WHEEL_DIAMETER
*
2
*
math
.
pi
)
/
self
.
PULSES_PER_ROTATION
def
init_callback
(
self
):
"""
Initialize the interrupt
"""
...
...
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