mirror of
https://github.com/OSURoboticsClub/Rover_2017_2018.git
synced 2025-11-08 10:11:14 +00:00
Fixed rover_statuses.py to actually pull data correctly. Also updated system_statuses_node.py to use psutil to pull CPU and RAM data
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
int8 jetson_CPU
|
||||
int8 jetson_RAM
|
||||
float64 jetson_CPU
|
||||
float64 jetson_RAM
|
||||
int8 jetson_EMMC
|
||||
int8 jetson_NVME_SSD
|
||||
108
rover/system_statuses/scripts/.idea/workspace.xml
generated
108
rover/system_statuses/scripts/.idea/workspace.xml
generated
@@ -10,31 +10,30 @@
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file leaf-file-name="system_statuses_node.py" pinned="false" current-in-tab="true">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="525">
|
||||
<file leaf-file-name="system_statuses_node.py" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/system_statuses_node.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="384">
|
||||
<caret line="16" column="9" lean-forward="false" selection-start-line="16" selection-start-column="9" selection-end-line="16" selection-end-column="9" />
|
||||
<state relative-caret-position="2808">
|
||||
<caret line="124" column="61" lean-forward="false" selection-start-line="124" selection-start-column="61" selection-end-line="124" selection-end-column="61" />
|
||||
<folding>
|
||||
<element signature="e#22#34#0" expanded="true" />
|
||||
<element signature="e#4801#5092#0" expanded="false" />
|
||||
<element signature="e#5146#5397#0" expanded="false" />
|
||||
<element signature="e#5449#5549#0" expanded="false" />
|
||||
<element signature="e#5602#5824#0" expanded="false" />
|
||||
<element signature="e#5875#6010#0" expanded="false" />
|
||||
<element signature="e#6062#6553#0" expanded="false" />
|
||||
<marker date="1516500076983" expanded="true" signature="4749:6553" ph="..." />
|
||||
<element signature="e#4881#5172#0" expanded="false" />
|
||||
<element signature="e#5529#5629#0" expanded="false" />
|
||||
<element signature="e#5682#5904#0" expanded="false" />
|
||||
<element signature="e#5955#6090#0" expanded="false" />
|
||||
<element signature="e#6142#6633#0" expanded="false" />
|
||||
<marker date="1516685047842" expanded="true" signature="4829:6633" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="rover_statuses.py" pinned="false" current-in-tab="false">
|
||||
<file leaf-file-name="rover_statuses.py" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/rover_statuses.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="672">
|
||||
<caret line="28" column="17" lean-forward="false" selection-start-line="28" selection-start-column="17" selection-end-line="28" selection-end-column="17" />
|
||||
<state relative-caret-position="226">
|
||||
<caret line="53" column="37" lean-forward="false" selection-start-line="53" selection-start-column="37" selection-end-line="53" selection-end-column="37" />
|
||||
<folding>
|
||||
<element signature="e#22#34#0" expanded="true" />
|
||||
</folding>
|
||||
@@ -69,10 +68,10 @@
|
||||
<sorting>DEFINITION_ORDER</sorting>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="x" value="1118" />
|
||||
<option name="y" value="21" />
|
||||
<option name="width" value="1595" />
|
||||
<option name="height" value="1556" />
|
||||
<option name="x" value="978" />
|
||||
<option name="y" value="470" />
|
||||
<option name="width" value="1735" />
|
||||
<option name="height" value="1107" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
||||
@@ -90,7 +89,6 @@
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scratches" />
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
@@ -102,6 +100,7 @@
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
@@ -138,7 +137,7 @@
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="1118" y="21" width="1595" height="1556" extended-state="0" />
|
||||
<frame x="978" y="470" width="1735" height="1107" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
@@ -147,10 +146,9 @@
|
||||
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.116234995" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.10679048" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3294347" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="SciView" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
@@ -160,6 +158,7 @@
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3294347" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
</component>
|
||||
@@ -171,31 +170,30 @@
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<option name="time" value="3" />
|
||||
<option name="time" value="5" />
|
||||
</breakpoint-manager>
|
||||
<watches-manager />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/system_statuses.py" />
|
||||
<entry file="file://$PROJECT_DIR$/node_statuses.py">
|
||||
<entry file="file://$PROJECT_DIR$/system_statuses_node.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="72">
|
||||
<caret line="3" column="8" lean-forward="false" selection-start-line="3" selection-start-column="8" selection-end-line="3" selection-end-column="8" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/camera_2_updater.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="192">
|
||||
<caret line="8" column="63" lean-forward="true" selection-start-line="8" selection-start-column="63" selection-end-line="8" selection-end-column="63" />
|
||||
<folding />
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#22#34#0" expanded="true" />
|
||||
<element signature="e#4881#5172#0" expanded="false" />
|
||||
<element signature="e#5529#5629#0" expanded="false" />
|
||||
<element signature="e#5682#5904#0" expanded="false" />
|
||||
<element signature="e#5955#6090#0" expanded="false" />
|
||||
<element signature="e#6142#6633#0" expanded="false" />
|
||||
<marker date="1516685047842" expanded="true" signature="4829:6633" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/rover_statuses.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="672">
|
||||
<state relative-caret-position="648">
|
||||
<caret line="28" column="17" lean-forward="false" selection-start-line="28" selection-start-column="17" selection-end-line="28" selection-end-column="17" />
|
||||
<folding>
|
||||
<element signature="e#22#34#0" expanded="true" />
|
||||
@@ -203,19 +201,37 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/system_statuses.py" />
|
||||
<entry file="file://$PROJECT_DIR$/node_statuses.py" />
|
||||
<entry file="file://$PROJECT_DIR$/camera_2_updater.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="192">
|
||||
<caret line="8" column="63" lean-forward="true" selection-start-line="8" selection-start-column="63" selection-end-line="8" selection-end-column="63" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/system_statuses_node.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="384">
|
||||
<caret line="16" column="9" lean-forward="false" selection-start-line="16" selection-start-column="9" selection-end-line="16" selection-end-column="9" />
|
||||
<state relative-caret-position="2808">
|
||||
<caret line="124" column="61" lean-forward="false" selection-start-line="124" selection-start-column="61" selection-end-line="124" selection-end-column="61" />
|
||||
<folding>
|
||||
<element signature="e#22#34#0" expanded="true" />
|
||||
<element signature="e#4881#5172#0" expanded="false" />
|
||||
<element signature="e#5529#5629#0" expanded="false" />
|
||||
<element signature="e#5682#5904#0" expanded="false" />
|
||||
<element signature="e#5955#6090#0" expanded="false" />
|
||||
<element signature="e#6142#6633#0" expanded="false" />
|
||||
<marker date="1516685047842" expanded="true" signature="4829:6633" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/rover_statuses.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="226">
|
||||
<caret line="53" column="37" lean-forward="false" selection-start-line="53" selection-start-column="37" selection-end-line="53" selection-end-column="37" />
|
||||
<folding>
|
||||
<element signature="e#22#34#0" expanded="true" />
|
||||
<element signature="e#4801#5092#0" expanded="false" />
|
||||
<element signature="e#5146#5397#0" expanded="false" />
|
||||
<element signature="e#5449#5549#0" expanded="false" />
|
||||
<element signature="e#5602#5824#0" expanded="false" />
|
||||
<element signature="e#5875#6010#0" expanded="false" />
|
||||
<element signature="e#6062#6553#0" expanded="false" />
|
||||
<marker date="1516500076983" expanded="true" signature="4749:6553" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
||||
@@ -19,11 +19,11 @@ class RoverStatuses:
|
||||
|
||||
# Subscription examples on pulling data from system_statuses_node.py
|
||||
rospy.Subscriber('camera_system_status_chatter', CameraStatuses, self.__camera_callback)
|
||||
rospy.Subscriber('bogie_system_status_chatter', BogieStatuses, self.__camera_callback)
|
||||
rospy.Subscriber('FrSky_system_status_chatter', FrSkyStatus, self.__camera_callback)
|
||||
rospy.Subscriber('GPS_system_status_chatter', GPSInfo, self.__camera_callback)
|
||||
rospy.Subscriber('jetson_system_status_chatter', JetsonInfo, self.__camera_callback)
|
||||
rospy.Subscriber('misc_system_status_chatter', MiscStatuses, self.__camera_callback)
|
||||
rospy.Subscriber('bogie_system_status_chatter', BogieStatuses, self.__bogie_callback)
|
||||
rospy.Subscriber('FrSky_system_status_chatter', FrSkyStatus, self.__frsky_callback)
|
||||
rospy.Subscriber('GPS_system_status_chatter', GPSInfo, self.__gps_callback)
|
||||
rospy.Subscriber('jetson_system_status_chatter', JetsonInfo, self.__jetson_callback)
|
||||
rospy.Subscriber('misc_system_status_chatter', MiscStatuses, self.__misc_callback)
|
||||
|
||||
self.camera_msg = CameraStatuses()
|
||||
self.bogie_msg = BogieStatuses()
|
||||
@@ -51,6 +51,7 @@ class RoverStatuses:
|
||||
self.jetson_msg.jetson_RAM = data.jetson_RAM
|
||||
self.jetson_msg.jetson_EMMC = data.jetson_EMMC
|
||||
self.jetson_msg.jetson_NVME_SSD = data.jetson_NVME_SSD
|
||||
rospy.loginfo(self.jetson_msg)
|
||||
|
||||
def __gps_callback(self, data):
|
||||
self.GPS_msg.UTC_GPS_time = data.UTC_GPS_time
|
||||
@@ -65,11 +66,11 @@ class RoverStatuses:
|
||||
|
||||
def run(self):
|
||||
rospy.Subscriber('camera_system_status_chatter', CameraStatuses, self.__camera_callback)
|
||||
rospy.Subscriber('bogie_system_status_chatter', BogieStatuses, self.__camera_callback)
|
||||
rospy.Subscriber('FrSky_system_status_chatter', FrSkyStatus, self.__camera_callback)
|
||||
rospy.Subscriber('GPS_system_status_chatter', GPSInfo, self.__camera_callback)
|
||||
rospy.Subscriber('jetson_system_status_chatter', JetsonInfo, self.__camera_callback)
|
||||
rospy.Subscriber('misc_system_status_chatter', MiscStatuses, self.__camera_callback)
|
||||
rospy.Subscriber('bogie_system_status_chatter', BogieStatuses, self.__bogie_callback)
|
||||
rospy.Subscriber('FrSky_system_status_chatter', FrSkyStatus, self.__frsky_callback)
|
||||
rospy.Subscriber('GPS_system_status_chatter', GPSInfo, self.__gps_callback)
|
||||
rospy.Subscriber('jetson_system_status_chatter', JetsonInfo, self.__jetson_callback)
|
||||
rospy.Subscriber('misc_system_status_chatter', MiscStatuses, self.__misc_callback)
|
||||
rospy.spin()
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
import rospy
|
||||
import os.path
|
||||
import psutil
|
||||
from system_statuses.msg import CameraStatuses, BogieStatuses, FrSkyStatus, GPSInfo, MiscStatuses, JetsonInfo
|
||||
|
||||
|
||||
|
||||
class SystemStatuses:
|
||||
|
||||
def __init__(self):
|
||||
@@ -96,8 +96,9 @@ class SystemStatuses:
|
||||
|
||||
# Get Jetson Statuses (WIP)
|
||||
def __set_jetson_usage_information(self):
|
||||
self.jetson_msg.jetson_CPU = 0
|
||||
self.jetson_msg.jetson_RAM = 0
|
||||
self.jetson_msg.jetson_CPU = psutil.cpu_percent()
|
||||
mem = psutil.virtual_memory()
|
||||
self.jetson_msg.jetson_RAM = mem.percent
|
||||
self.jetson_msg.jetson_EMMC = 0
|
||||
self.jetson_msg.jetson_NVME_SSD = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user