Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
monitoring
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Deike, Benedikt
monitoring
Commits
7ca75e9f
Commit
7ca75e9f
authored
3 years ago
by
bav6096
Browse files
Options
Downloads
Patches
Plain Diff
fixed loading animations from file
parent
54e2477d
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
nodes/monitor_distance
+34
-0
34 additions, 0 deletions
nodes/monitor_distance
src/monitoring/watchdog.py
+3
-0
3 additions, 0 deletions
src/monitoring/watchdog.py
with
38 additions
and
0 deletions
CMakeLists.txt
+
1
−
0
View file @
7ca75e9f
...
@@ -164,6 +164,7 @@ include_directories(
...
@@ -164,6 +164,7 @@ include_directories(
## in contrast to setup.py, you can choose the destination
## in contrast to setup.py, you can choose the destination
catkin_install_python
(
PROGRAMS
catkin_install_python
(
PROGRAMS
nodes/watchdog
nodes/watchdog
nodes/monitor_distance
nodes/monitor_test2
nodes/monitor_test2
nodes/monitor_test
nodes/monitor_test
DESTINATION
${
CATKIN_PACKAGE_BIN_DESTINATION
}
DESTINATION
${
CATKIN_PACKAGE_BIN_DESTINATION
}
...
...
This diff is collapsed.
Click to expand it.
nodes/monitor_distance
0 → 100755
+
34
−
0
View file @
7ca75e9f
#!/usr/bin/env pyhton
import rospy
from monitoring.monitor import Monitor
from sensor_msgs.msg import LaserScan
def scan_callback(msg):
global range_ahead
range_ahead = msg.ranges[int(len(msg.ranges) / 2)]
if __name__ == '__main__':
try:
range_ahead = 10
scan_sub = rospy.Subscriber("scan", LaserScan, scan_callback)
rospy.init_node("monitor_distance")
monitor = Monitor(1, 1)
rate = rospy.Rate(10)
while not rospy.is_shutdown():
print(range_ahead)
if range_ahead > 0.8:
critical = 0
else:
if range_ahead > 0.35:
critical = 0.5
else:
critical = 1.0
monitor.update_metric("scan", "distance", range_ahead, "unit", critical)
rate.sleep()
except rospy.ROSInterruptException:
pass
This diff is collapsed.
Click to expand it.
src/monitoring/watchdog.py
+
3
−
0
View file @
7ca75e9f
...
@@ -21,6 +21,7 @@ class Watchdog:
...
@@ -21,6 +21,7 @@ class Watchdog:
rospy
.
Subscriber
(
"
monitoring
"
,
Monitoring
,
self
.
logging
)
rospy
.
Subscriber
(
"
monitoring
"
,
Monitoring
,
self
.
logging
)
# TODO: Think about efficiency!
def
logging
(
self
,
monitoring
):
def
logging
(
self
,
monitoring
):
origin
=
monitoring
.
origin
origin
=
monitoring
.
origin
metric
=
monitoring
.
metric
metric
=
monitoring
.
metric
...
@@ -42,6 +43,7 @@ class Watchdog:
...
@@ -42,6 +43,7 @@ class Watchdog:
self
.
observing
[
component
][
origin
]
=
{}
self
.
observing
[
component
][
origin
]
=
{}
self
.
observing
[
component
][
origin
][
label
]
=
{
"
value
"
:
value
,
"
unit
"
:
unit
,
"
critical
"
:
critical
}
self
.
observing
[
component
][
origin
][
label
]
=
{
"
value
"
:
value
,
"
unit
"
:
unit
,
"
critical
"
:
critical
}
# TODO: Add more modes!
def
update_states
(
self
,
event
):
def
update_states
(
self
,
event
):
for
component
in
self
.
observing
:
for
component
in
self
.
observing
:
# Mode 1: Take the average critical level for a component
# Mode 1: Take the average critical level for a component
...
@@ -59,6 +61,7 @@ class Watchdog:
...
@@ -59,6 +61,7 @@ class Watchdog:
self
.
publish_states
()
self
.
publish_states
()
# TODO: Update names!
def
publish_states
(
self
):
def
publish_states
(
self
):
topic
=
States
()
topic
=
States
()
for
component
in
self
.
component_states
:
for
component
in
self
.
component_states
:
...
...
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