Created placeholder variables for every system node status & created init placeholder functions

This commit is contained in:
MatthewTaylor24
2018-01-20 14:06:14 -08:00
parent 52e17669d1
commit 0e99c86778
3 changed files with 105 additions and 23 deletions

View File

@@ -1,4 +1,19 @@
int8 UTC_GPS_time
int8 bogie_connection_1
int8 bogie_connection_2
int8 bogie_connection_3
int8 arm_connection_status
int8 arm_end_effector_connection_statuses
int8 camera_zed int8 camera_zed
int8 camera_undercarriage int8 camera_undercarriage
int8 camera_chassis int8 camera_chassis
int8 camera_main_navigation int8 camera_main_navigation
int8 sample_containment_connection_status
int8 tower_connection_status
int8 chassis_pan_tilt_connection_status
int8 GPS_connection_status
int8 jetson_CPU
int8 jetson_RAM
int8 jetson_EMMC
int8 jetson_NVME_SSD
int8 FrSky_controller_connection_status

View File

@@ -14,8 +14,8 @@
<file leaf-file-name="system_statuses_node.py" pinned="false" current-in-tab="true"> <file leaf-file-name="system_statuses_node.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/system_statuses_node.py"> <entry file="file://$PROJECT_DIR$/system_statuses_node.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="84"> <state relative-caret-position="372">
<caret line="29" column="48" lean-forward="false" selection-start-line="29" selection-start-column="48" selection-end-line="29" selection-end-column="48" /> <caret line="105" column="55" lean-forward="true" selection-start-line="105" selection-start-column="55" selection-end-line="105" selection-end-column="55" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@@ -24,9 +24,11 @@
<file leaf-file-name="camera_2_updater.py" pinned="false" current-in-tab="false"> <file leaf-file-name="camera_2_updater.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/camera_2_updater.py"> <entry file="file://$PROJECT_DIR$/camera_2_updater.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="48"> <state relative-caret-position="216">
<caret line="2" column="12" lean-forward="true" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" /> <caret line="9" column="33" lean-forward="false" selection-start-line="9" selection-start-column="33" selection-end-line="9" selection-end-column="33" />
<folding /> <folding>
<element signature="e#23#35#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@@ -49,8 +51,8 @@
<sorting>DEFINITION_ORDER</sorting> <sorting>DEFINITION_ORDER</sorting>
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="1141" /> <option name="x" value="1118" />
<option name="y" value="383" /> <option name="y" value="372" />
<option name="width" value="1595" /> <option name="width" value="1595" />
<option name="height" value="1205" /> <option name="height" value="1205" />
</component> </component>
@@ -118,7 +120,7 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="1141" y="383" width="1595" height="1205" extended-state="0" /> <frame x="1118" y="372" width="1595" height="1205" extended-state="0" />
<editor active="true" /> <editor active="true" />
<layout> <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" /> <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" />
@@ -130,6 +132,7 @@
<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.116234995" 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="7" side_tool="false" content_ui="tabs" /> <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="7" 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="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="3" 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="3" 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="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" /> <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" />
@@ -139,7 +142,6 @@
<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="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="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="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.33" 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" /> <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> </layout>
</component> </component>
@@ -159,16 +161,18 @@
<entry file="file://$PROJECT_DIR$/system_statuses.py" /> <entry file="file://$PROJECT_DIR$/system_statuses.py" />
<entry file="file://$PROJECT_DIR$/camera_2_updater.py"> <entry file="file://$PROJECT_DIR$/camera_2_updater.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="48"> <state relative-caret-position="216">
<caret line="2" column="12" lean-forward="true" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" /> <caret line="9" column="33" lean-forward="false" selection-start-line="9" selection-start-column="33" selection-end-line="9" selection-end-column="33" />
<folding /> <folding>
<element signature="e#23#35#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/system_statuses_node.py"> <entry file="file://$PROJECT_DIR$/system_statuses_node.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="84"> <state relative-caret-position="372">
<caret line="29" column="48" lean-forward="false" selection-start-line="29" selection-start-column="48" selection-end-line="29" selection-end-column="48" /> <caret line="105" column="55" lean-forward="true" selection-start-line="105" selection-start-column="55" selection-end-line="105" selection-end-column="55" />
<folding /> <folding />
</state> </state>
</provider> </provider>

View File

@@ -21,7 +21,9 @@ class SystemStatuses:
rospy.Subscriber('camera_2_changer_chatter', Camera2Changer, self.__sub_callback) rospy.Subscriber('camera_2_changer_chatter', Camera2Changer, self.__sub_callback)
self.msg = RoverSysStatus() self.msg = RoverSysStatus()
self.__set_cameras() self.__set_msg_values()
# self.__set_cameras()
# self.__UTC_GPS_Time()
# Simple Subscriber test boolean -- camera_2_updated.py # Simple Subscriber test boolean -- camera_2_updated.py
# self.hasCameraUndercarriageChanged = False # self.hasCameraUndercarriageChanged = False
@@ -34,6 +36,39 @@ class SystemStatuses:
self.msg.camera_undercarriage = data.camera_2_value self.msg.camera_undercarriage = data.camera_2_value
self.hasCameraUndercarriageChanged = True self.hasCameraUndercarriageChanged = True
# INIT all RoverSysMessage values
def __set_msg_values(self):
self.__utc_gps_time()
self.__bogie_connection_statuses()
self.__arm_connection_status()
self.__arm_end_effector_connection_statuses()
self.__set_cameras()
self.__sample_containment_connection_status()
self.__tower_connection_status()
self.__chassis_pan_tilt_connection_status()
self.__gps_connection_status()
self.__jetson_usage_information()
self.__frsky_controller_connection_status()
# Pulls the UTC GPS Time (WIP)
def __utc_gps_time(self):
self.msg.UTC_GPS_time = 0
# Pulls bogie connection statuses (WIP)
def __bogie_connection_statuses(self):
self.msg.bogie_connection_1 = 0
self.msg.bogie_connection_2 = 0
self.msg.bogie_connection_3 = 0
# Checks arm connection status (WIP)
def __arm_connection_status(self):
self.msg.arm_connection_status = 0
# Checks Arm End Effector Connection Statuses (WIP)
def __arm_end_effector_connection_statuses(self):
self.msg.arm_end_effector_connection_statuses = 0
# Sets the Camera values (zed, undercarriage, chassis, and main_nav
def __set_cameras(self): def __set_cameras(self):
# Check if camera_zed is found # Check if camera_zed is found
self.msg.camera_zed = 1 if os.path.exists(self.system_path_locations[0]) else 0 self.msg.camera_zed = 1 if os.path.exists(self.system_path_locations[0]) else 0
@@ -44,8 +79,36 @@ class SystemStatuses:
# Check if camera_main_navigation is found # Check if camera_main_navigation is found
self.msg.camera_main_navigation = 1 if os.path.exists(self.system_path_locations[3]) else 0 self.msg.camera_main_navigation = 1 if os.path.exists(self.system_path_locations[3]) else 0
# Checks Sample Containment Connection Status (WIP)
def __sample_containment_connection_status(self):
self.msg.sample_containment_connection_status = 0
def __tower_connection_status(self):
self.msg.tower_connection_status = 0
# Checks Tower Connection Status (WIP)
def __chassis_pan_tilt_connection_status(self):
self.msg.chassis_pan_tilt_connection_status = 0
# Checks GPS Status (WIP)
def __gps_connection_status(self):
self.msg.GPS_connection_status = 0
# Get Jetson Statuses (WIP)
def __jetson_usage_information(self):
self.msg.jetson_CPU = 0
self.msg.jetson_RAM = 0
self.msg.jetson_EMMC = 0
self.msg.jetson_NVME_SSD = 0
# Check FrSky Controller Connection Status (WIP)
def __frsky_controller_connection_status(self):
self.msg.FrSky_controller_connection_status = 0
def run(self): def run(self):
r = rospy.Rate(10) r = rospy.Rate(10)
rospy.loginfo(self.msg)
self.pub.publish(self.msg)
while not rospy.is_shutdown(): while not rospy.is_shutdown():
if (self.msg.camera_zed != os.path.exists(self.system_path_locations[0]) or if (self.msg.camera_zed != os.path.exists(self.system_path_locations[0]) or
self.msg.camera_undercarriage != os.path.exists(self.system_path_locations[1]) or self.msg.camera_undercarriage != os.path.exists(self.system_path_locations[1]) or