Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ActivityTracker
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
willm3
ActivityTracker
Commits
c92d6dce
Unverified
Commit
c92d6dce
authored
1 year ago
by
Will Malisch
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' into wmalisch/vectorize-data
parents
324e94e6
0820dd41
No related branches found
No related tags found
1 merge request
!4
Vectorize data and have ability to plot
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
copyFiles.sh
+1
-0
1 addition, 0 deletions
copyFiles.sh
sendOutputs.sh
+1
-1
1 addition, 1 deletion
sendOutputs.sh
src/Activity.py
+26
-14
26 additions, 14 deletions
src/Activity.py
src/test.py
+15
-0
15 additions, 0 deletions
src/test.py
with
43 additions
and
15 deletions
copyFiles.sh
+
1
−
0
View file @
c92d6dce
sshpass
-p
"admin"
scp ~/dev/ActivityTracker/main.py wmalisch@192.168.2.18:~/ActivityTracker/main.py
sshpass
-p
"admin"
scp ~/dev/ActivityTracker/sendOutputs.sh wmalisch@192.168.2.18:~/ActivityTracker/sendOutputs.sh
sshpass
-p
"admin"
scp ~/dev/ActivityTracker/src/Controller.py wmalisch@192.168.2.18:~/ActivityTracker/src/Controller.py
sshpass
-p
"admin"
scp ~/dev/ActivityTracker/src/Logger.py wmalisch@192.168.2.18:~/ActivityTracker/src/Logger.py
sshpass
-p
"admin"
scp ~/dev/ActivityTracker/src/Activity.py wmalisch@192.168.2.18:~/ActivityTracker/src/Activity.py
This diff is collapsed.
Click to expand it.
sendOutputs.sh
+
1
−
1
View file @
c92d6dce
sshpass
-p
"rk8g!yA3
$eNJ
&#p"
scp
-r
./outputs wmalisch@192.168.2.182:~/dev/ActivityTracker
/outputs
sshpass
-p
"rk8g!yA3
$eNJ
&#p"
scp
-r
./outputs wmalisch@192.168.2.182:~/dev/ActivityTracker
This diff is collapsed.
Click to expand it.
src/Activity.py
+
26
−
14
View file @
c92d6dce
from
sense_hat
import
SenseHat
import
time
import
csv
from
pathlib
import
Path
class
Activity
:
def
__init__
(
self
,
sense
):
...
...
@@ -8,22 +10,32 @@ class Activity:
def
record
(
self
):
try
:
self
.
running
=
True
timestamp
=
int
(
time
.
time
())
output_file_path
=
Path
(
f
"
outputs/
{
timestamp
}
.csv
"
).
resolve
()
print
(
"
Activity started.
"
)
i
=
0
while
self
.
running
:
# Read data from the IMU
imu_data
=
self
.
sense
.
get_accelerometer_raw
()
acceleration
=
imu_data
[
'
x
'
],
imu_data
[
'
y
'
],
imu_data
[
'
z
'
]
print
(
"
Acceleration (g): x={:.2f}, y={:.2f}, z={:.2f}
"
.
format
(
*
acceleration
))
time
.
sleep
(
0.1
)
# Adjust sleep time as needed
joy_stick
=
self
.
sense
.
stick
.
get_events
()
for
event
in
joy_stick
:
if
(
event
.
action
==
"
pressed
"
and
event
.
direction
==
"
middle
"
):
self
.
running
=
not
self
.
running
return
"
Success
"
with
open
(
output_file_path
,
'
a
'
)
as
file
:
writer
=
csv
.
writer
(
file
)
while
self
.
running
:
# Read data from the IMU
imu_data
=
self
.
sense
.
get_accelerometer_raw
()
acceleration
=
imu_data
[
'
x
'
],
imu_data
[
'
y
'
],
imu_data
[
'
z
'
]
rounded_acceleration
=
[
round
(
value
,
2
)
for
value
in
acceleration
]
writer
.
writerow
(
rounded_acceleration
)
joy_stick
=
self
.
sense
.
stick
.
get_events
()
for
event
in
joy_stick
:
if
(
event
.
action
==
"
pressed
"
and
event
.
direction
==
"
middle
"
):
self
.
running
=
not
self
.
running
return
True
except
Exception
as
e
:
return
"
Failed
"
print
(
e
,
"
An error was encountered when recording your activity. Please try again.
"
)
return
False
This diff is collapsed.
Click to expand it.
src/test.py
0 → 100644
+
15
−
0
View file @
c92d6dce
import
time
import
csv
from
pathlib
import
Path
timestamp
=
int
(
time
.
time
())
# Define output file path
output_file_path
=
Path
(
f
"
outputs/
{
timestamp
}
.csv
"
).
resolve
()
with
open
(
output_file_path
,
'
a
'
)
as
file
:
for
i
in
range
(
2
):
file
.
write
(
"
hello
"
+
'
\n
'
)
\ No newline at end of file
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