Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Debugging Gitlab issue fix
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
Service Desk
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
Phileas
Debugging Gitlab issue fix
Commits
2ce81d0b
Commit
2ce81d0b
authored
1 year ago
by
moon2
Browse files
Options
Downloads
Patches
Plain Diff
sensors: more fun physics
parent
14dc659b
No related branches found
No related tags found
1 merge request
!627
sensors: more fun physics
Pipeline
#12569
passed
1 year ago
Stage: check
Stage: build
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python_payload/apps/sensors/__init__.py
+17
-9
17 additions, 9 deletions
python_payload/apps/sensors/__init__.py
with
17 additions
and
9 deletions
python_payload/apps/sensors/__init__.py
+
17
−
9
View file @
2ce81d0b
...
...
@@ -48,6 +48,9 @@ class App(Application):
self
.
data_exists
=
False
self
.
rotate
=
0
self
.
alt_smooth
=
None
self
.
rot_velo
=
0
self
.
rot_mass
=
2
self
.
rot_friction
=
0.93
def
draw_background
(
self
,
ctx
):
ctx
.
rgb
(
0
,
0
,
0
).
rectangle
(
-
120
,
-
120
,
240
,
240
).
fill
()
...
...
@@ -106,16 +109,21 @@ class App(Application):
damp
=
0.69
if
self
.
data_exists
:
inc
=
inclination
(
self
.
acc
)
if
(
inc
>
0.3
)
and
(
inc
<
3.11
):
delta
=
azimuth
(
self
.
acc
)
-
self
.
rotate
if
delta
>
3.14
:
delta
-=
6.28
elif
delta
<
-
3.14
:
delta
+=
6.28
self
.
rotate
+=
(
1
-
damp
)
*
delta
inc
=
inclination
(
self
.
acc
)
/
3.14
delta
=
azimuth
(
self
.
acc
)
-
self
.
rotate
if
delta
>
3.14
:
delta
-=
6.28
elif
delta
<
-
3.14
:
delta
+=
6.28
delta
/=
3.14
# normalize to 1
if
delta
>
0
:
self
.
rot_velo
+=
delta
*
(
1
-
delta
)
*
inc
*
(
1
-
inc
)
else
:
self
.
rotate
*=
damp
delta
=
-
delta
self
.
rot_velo
-=
delta
*
(
1
-
delta
)
*
inc
*
(
1
-
inc
)
self
.
rotate
+=
self
.
rot_velo
/
self
.
rot_mass
self
.
rotate
=
self
.
rotate
%
6.28
self
.
rot_velo
*=
self
.
rot_friction
ctx
.
rotate
(
-
self
.
rotate
)
if
self
.
draw_background_request
>
0
:
...
...
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