Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
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
flow3r
flow3r firmware
Commits
79af48df
Commit
79af48df
authored
1 year ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
imu: make available via standard input state
parent
04deefff
No related branches found
No related tags found
No related merge requests found
Pipeline
#6049
failed
1 year ago
Stage: check
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
python_payload/mypystubs/imu.pyi
+5
-0
5 additions, 0 deletions
python_payload/mypystubs/imu.pyi
python_payload/st3m/input.py
+17
-0
17 additions, 0 deletions
python_payload/st3m/input.py
sim/run.py
+1
-0
1 addition, 0 deletions
sim/run.py
with
23 additions
and
0 deletions
python_payload/mypystubs/imu.pyi
+
5
−
0
View file @
79af48df
...
...
@@ -5,6 +5,11 @@ def acc_read() -> Tuple[float, float, float]:
Returns current x, y, z accelerations in m/s**2.
"""
...
def
gyro_read
()
->
Tuple
[
float
,
float
,
float
]:
"""
Returns current pressure in Pa and temperature in degree C.
"""
...
def
pressure_read
()
->
Tuple
[
float
,
float
]:
"""
...
...
This diff is collapsed.
Click to expand it.
python_payload/st3m/input.py
+
17
−
0
View file @
79af48df
...
...
@@ -3,6 +3,7 @@ from st3m.ui.ctx import Ctx
import
hardware
import
captouch
import
imu
import
math
...
...
@@ -327,6 +328,19 @@ class TriSwitchState:
self
.
middle
.
_ignore_pressed
()
self
.
right
.
_ignore_pressed
()
class
IMUState
:
__slots__
=
(
"
acc
"
,
"
gyro
"
,
"
pressure
"
,
"
temperature
"
)
def
__init__
(
self
)
->
None
:
self
.
acc
=
(
0.
,
0.
,
0.
)
self
.
gyro
=
(
0.
,
0.
,
0.
)
self
.
pressure
=
0.
self
.
temperature
=
0.
def
_update
(
self
,
ts
:
int
,
hr
:
InputState
)
->
None
:
self
.
acc
=
imu
.
acc_read
()
self
.
gyro
=
imu
.
gyro_read
()
self
.
pressure
,
self
.
temperature
=
imu
.
pressure_read
()
class
InputController
:
"""
...
...
@@ -344,6 +358,7 @@ class InputController:
"
captouch
"
,
"
left_shoulder
"
,
"
right_shoulder
"
,
"
imu
"
,
"
_ts
"
,
)
...
...
@@ -351,6 +366,7 @@ class InputController:
self
.
captouch
=
CaptouchState
()
self
.
left_shoulder
=
TriSwitchState
(
TriSwitchHandedness
.
left
)
self
.
right_shoulder
=
TriSwitchState
(
TriSwitchHandedness
.
right
)
self
.
imu
=
IMUState
()
self
.
_ts
=
0
def
think
(
self
,
hr
:
InputState
,
delta_ms
:
int
)
->
None
:
...
...
@@ -358,6 +374,7 @@ class InputController:
self
.
captouch
.
_update
(
self
.
_ts
,
hr
)
self
.
left_shoulder
.
_update
(
self
.
_ts
,
hr
)
self
.
right_shoulder
.
_update
(
self
.
_ts
,
hr
)
self
.
imu
.
_update
(
self
.
_ts
,
hr
)
def
_ignore_pressed
(
self
)
->
None
:
"""
...
...
This diff is collapsed.
Click to expand it.
sim/run.py
+
1
−
0
View file @
79af48df
import
importlib
import
importlib.abc
import
importlib.machinery
from
importlib.machinery
import
PathFinder
,
BuiltinImporter
import
importlib.util
...
...
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