Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marcelo/gpio interface #6

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
bbaa9b6
Update comments
cjchanx Feb 19, 2023
af32453
Add a GenerateProto.bat file
cjchanx Feb 22, 2023
be3b1e1
Change .proto File Names, Add Python Test Project, Add to ProtocolTask
cjchanx Feb 22, 2023
8994721
Add CommandMessage.proto
cjchanx Feb 25, 2023
a782a41
Change namespace to Proto::
cjchanx Feb 25, 2023
fbb21d6
Update files
cjchanx Feb 25, 2023
8904d23
Update ProtocolTask
cjchanx Feb 25, 2023
05e0b0b
Update ProtocolTask
cjchanx Feb 25, 2023
3a2a368
Update ProtocolTask
cjchanx Mar 4, 2023
0654e72
Merge branch 'Chris/ProtocolTask' of https://github.com/StudentOrgani…
cjchanx Mar 4, 2023
64ce317
Cleanup
cjchanx Mar 4, 2023
51df1ba
Add debug to protocoltask
cjchanx Mar 4, 2023
46701fe
Merge changes
cjchanx Mar 4, 2023
6cde8b4
Fix parameter routing
cjchanx Mar 10, 2023
ed3b948
Implement Codec.py with Transport Encode/Decode
cjchanx Mar 11, 2023
5506d7b
Add gitignore, update CoreProto with MSG_MAX_INVALID enumg
cjchanx Mar 11, 2023
08b3692
Refactor to ProtocolTask owning the main switch
cjchanx Mar 11, 2023
8c010f1
Change to sending a readbuffer to the function
cjchanx Mar 11, 2023
629d201
Fix protocol task assertion
cjchanx Mar 12, 2023
17aa085
Update ProtocolTask.cpp
cjchanx Mar 12, 2023
952c296
first commit
AvionicsSOAR Apr 8, 2023
9ec69cc
just one of those commit
VioletLiGonzales Apr 12, 2023
4f71fae
added rocket state proto to str dictionary
AvionicsSOAR Apr 12, 2023
57279ac
refactored populate_cmd_msg to use a dictionary isntead
VioletLiGonzales Apr 14, 2023
302b58a
refactored populate_cmd_msg to use a dictionary and actually saved th…
VioletLiGonzales Apr 14, 2023
99b6c99
commented next steps for saturday
VioletLiGonzales Apr 14, 2023
99b5b99
updated telemetry proto file
VioletLiGonzales Apr 15, 2023
4a6903b
Merge branch 'marcelo/everything' of github.com:StudentOrganisationFo…
VioletLiGonzales Apr 15, 2023
9d99ddf
added parsing of telemetry messages as per template
VioletLiGonzales Apr 15, 2023
94b3ad4
added parser file for protobuf to mqtt publish
VioletLiGonzales Apr 15, 2023
3d3ad77
added decode error handling
VioletLiGonzales Apr 15, 2023
c04a62d
finished up Proto framework
VioletLiGonzales May 6, 2023
d19ead8
Compile protobufs
cjchanx May 6, 2023
7a472c4
regenerated proto commands and updates pythontestproject imports
VioletLiGonzales May 11, 2023
8c655e0
publisher_nodered.py updated to newest telemetry message scheme
VioletLiGonzales May 11, 2023
97d9cbe
cleaned up Publisher_nodered.py
VioletLiGonzales May 12, 2023
bbe68af
updated Protobuf_parser.py to new telemetry message scheme
VioletLiGonzales May 12, 2023
6af1640
Change PMB to PBB, Regen
cjchanx May 13, 2023
336f704
Rename from flash
cjchanx May 13, 2023
f247065
added SOB commands and cleaned up Publisher_nodered.py
VioletLiGonzales May 13, 2023
10751e1
Merge branch 'marcelo/everything' of github.com:StudentOrganisationFo…
VioletLiGonzales May 13, 2023
39aa4dc
fixed up compiling issues
VioletLiGonzales May 13, 2023
b006176
added allowed comands dict for command processing
VioletLiGonzales May 13, 2023
7321c30
added check for valid command depending on state
VioletLiGonzales May 13, 2023
d9a09b5
added current_staet definition on startup of abort
VioletLiGonzales May 13, 2023
61f6235
changed client position to allow for client call in Publisher_nodered.py
VioletLiGonzales May 14, 2023
e1255b0
fixed string to proto command bug
AvionicsSOAR May 16, 2023
1843e5f
bugs bugs bugs
AvionicsSOAR May 16, 2023
6cd46d0
fixed loads of bugs
AvionicsSOAR May 18, 2023
32608aa
merged Codec.py from Chris/Checksum
AvionicsSOAR May 18, 2023
f4f8bcc
editted Chris/Checksum and editted main.py to be compatible
AvionicsSOAR May 18, 2023
36883f6
removed useless indexes
AvionicsSOAR May 18, 2023
dd6b6f2
added length checking
AvionicsSOAR May 18, 2023
0179773
cleaned up main.py
AvionicsSOAR May 18, 2023
e30be57
fixed SOB bugs
AvionicsSOAR May 27, 2023
2cd54c8
added basic relay command handling
AvionicsSOAR May 28, 2023
9a9e76d
added handling of RCU and PBB commands
VioletLiGonzales Jun 5, 2023
9a5f84a
added invalid telemetry message handling
AvionicsSOAR Jun 5, 2023
c861aa1
merged master
AvionicsSOAR Jun 8, 2023
a133114
merged master 3
AvionicsSOAR Jun 8, 2023
b354259
erge master 5
AvionicsSOAR Jun 8, 2023
0c440f5
added invalid cobs message handling and finished up some maste merges
AvionicsSOAR Jun 8, 2023
ea1cd5e
added testing prints and open and close command
AvionicsSOAR Jun 8, 2023
fb73940
Merge branch 'master' of https://github.com/StudentOrganisationForAer…
cjchanx Jun 17, 2023
447ddc4
fixes pi protobuf commands to follow v1.3.1
AvionicsSOAR Jun 17, 2023
39df9e9
debugging protobuf
AvionicsSOAR Jun 17, 2023
e5f1427
added ing send and receive protocols
AvionicsSOAR Jun 24, 2023
89a139c
fixed bug in protobuf_parser
VioletLiGonzales Jul 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions PythonTestProject/Codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def Encode(buf, len, msgId):
calc = Calculator(Crc16.CCITT)
chksum = calc.checksum(encodedBuf)

print(f'Calculated checksum: {chksum}')
#print(f'Calculated checksum: {chksum}')

# Then we append the checksum in little endian order
encodedBuf.append(chksum & 0xFF)
Expand All @@ -53,10 +53,15 @@ def Encode(buf, len, msgId):
return encodedBuf

@staticmethod
def Decode(buf, len):
def Decode(buf, length):

#print(buf)
#print(len(buf))
# Decode the buffer
decodedBuf = cobs.decode(buf)

#print(len(decodedBuf))

# Verify the checksum (untested)
bufChksm = decodedBuf[-2:]
bufChksm = bufChksm[0] + (bufChksm[1] << 8)
Expand Down
81 changes: 66 additions & 15 deletions PythonTestProject/Protobuf_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,51 @@
"RSC_NONE" : ProtoCmd.DMBCommand.RSC_NONE
}

STRING_TO_PBB_PROTO_COMMAND = {
"PBB_NONE": ProtoCmd.PBBCommand.PBB_NONE,
"PBB_OPEN_MEV": ProtoCmd.PBBCommand.PBB_OPEN_MEV,
"PBB_CLOSE_MEV": ProtoCmd.PBBCommand.PBB_CLOSE_MEV,
"PMB_LAST": ProtoCmd.PBBCommand.PMB_LAST,
}

STRING_TO_RCU_PROTO_COMMAND = {
"RCU_NONE": ProtoCmd.RCUCommand.RCU_NONE,
"RCU_TARE_NOS1_LOAD_CELL": ProtoCmd.RCUCommand.RCU_TARE_NOS1_LOAD_CELL,
"RCU_TARE_NOS2_LOAD_CELL": ProtoCmd.RCUCommand.RCU_TARE_NOS2_LOAD_CELL,
"RCU_CAL_NOS1_LOAD_CELL": ProtoCmd.RCUCommand.RCU_CALIBRATE_NOS1_LOAD_CELL,
"RCU_CAL_NOS2_LOAD_CELL": ProtoCmd.RCUCommand.RCU_CALIBRATE_NOS2_LOAD_CELL,
"RCU_OPEN_AC1": ProtoCmd.RCUCommand.RCU_OPEN_AC1,
"RCU_CLOSE_AC1": ProtoCmd.RCUCommand.RCU_CLOSE_AC1,
"RCU_OPEN_AC2": ProtoCmd.RCUCommand.RCU_OPEN_AC2,
"RCU_CLOSE_AC2": ProtoCmd.RCUCommand.RCU_CLOSE_AC2,
"RCU_OPEN_PBV1": ProtoCmd.RCUCommand.RCU_OPEN_PBV1,
"RCU_CLOSE_PBV1": ProtoCmd.RCUCommand.RCU_CLOSE_PBV1,
"RCU_OPEN_PBV2": ProtoCmd.RCUCommand.RCU_OPEN_PBV2,
"RCU_CLOSE_PBV2": ProtoCmd.RCUCommand.RCU_CLOSE_PBV2,
"RCU_OPEN_PBV3": ProtoCmd.RCUCommand.RCU_OPEN_PBV3,
"RCU_CLOSE_PBV3": ProtoCmd.RCUCommand.RCU_CLOSE_PBV3,
"RCU_OPEN_SOL1": ProtoCmd.RCUCommand.RCU_OPEN_SOL1,
"RCU_CLOSE_SOL1": ProtoCmd.RCUCommand.RCU_CLOSE_SOL1,
"RCU_OPEN_SOL2": ProtoCmd.RCUCommand.RCU_OPEN_SOL2,
"RCU_CLOSE_SOL2": ProtoCmd.RCUCommand.RCU_CLOSE_SOL2,
"RCU_CLOSE_SOL3": ProtoCmd.RCUCommand.RCU_CLOSE_SOL3,
"RCU_OPEN_SOL4": ProtoCmd.RCUCommand.RCU_OPEN_SOL4,
"RCU_CLOSE_SOL4": ProtoCmd.RCUCommand.RCU_CLOSE_SOL4,
"RCU_OPEN_SOL5": ProtoCmd.RCUCommand.RCU_OPEN_SOL5,
"RCU_CLOSE_SOL5": ProtoCmd.RCUCommand.RCU_CLOSE_SOL5,
"RCU_OPEN_SOL6": ProtoCmd.RCUCommand.RCU_OPEN_SOL6,
"RCU_CLOSE_SOL6": ProtoCmd.RCUCommand.RCU_CLOSE_SOL6,
"RCU_OPEN_SOL7": ProtoCmd.RCUCommand.RCU_OPEN_SOL7,
"RCU_CLOSE_SOL7": ProtoCmd.RCUCommand.RCU_CLOSE_SOL7,
"RCU_OPEN_SOL8A": ProtoCmd.RCUCommand.RCU_OPEN_SOL8A,
"RCU_CLOSE_SOL8A": ProtoCmd.RCUCommand.RCU_CLOSE_SOL8A,
"RCU_OPEN_SOL8B": ProtoCmd.RCUCommand.RCU_OPEN_SOL8B,
"RCU_CLOSE_SOL8B": ProtoCmd.RCUCommand.RCU_CLOSE_SOL8B,
"RCU_IGNITE_PAD_BOX1": ProtoCmd.RCUCommand.RCU_IGNITE_PAD_BOX1,
"RCU_IGNITE_PAD_BOX2": ProtoCmd.RCUCommand.RCU_IGNITE_PAD_BOX2,
"RCU_LAST": ProtoCmd.RCUCommand.RCU_LAST
}

STRING_TO_SOB_PROTO_COMMAND = {
"SOB_NONE": ProtoCmd.SOBCommand.SOB_NONE,
"SOB_SLOW_SAMPLE_IR": ProtoCmd.SOBCommand.SOB_SLOW_SAMPLE_IR,
Expand All @@ -58,18 +103,20 @@
"SOB_LAST": ProtoCmd.SOBCommand.SOB_LAST,
}

#TODO remove drain and vent command from allowed commands

ALLOWED_COMMANDS_FROM_STATE = {
'RS_ABORT': ["RSC_ANY_TO_ABORT", "RSC_GOTO_PRELAUNCH"],
'RS_ARM': ["RSC_ANY_TO_ABORT", "RSC_POWER_TRANSITION_ONBOARD", "RSC_POWER_TRANSITION_EXTERNAL", "RSC_GOTO_FILL", "RSC_GOTO_IGNITION", "RSC_OPEN_VENT", "RSC_CLOSE_VENT", "RSC_OPEN_DRAIN", "RSC_CLOSE_DRAIN", "RSC_MEV_CLOSE"],
'RS_BURN': ["RSC_ANY_TO_ABORT", "RSC_BURN_TO_COAST"],
'RS_COAST': ["RSC_ANY_TO_ABORT", "RSC_COAST_TO_DESCENT"],
'RS_DESCENT': ["RSC_ANY_TO_ABORT", "RSC_DESCENT_TO_RECOVERY"],
'RS_FILL': ["RSC_ANY_TO_ABORT", "RSC_ARM_CONFIRM_1", "RSC_ARM_CONFIRM_2", "RSC_GOTO_ARM", "RSC_GOTO_PRELAUNCH", "RSC_OPEN_VENT", "RSC_CLOSE_VENT", "RSC_OPEN_DRAIN", "RSC_CLOSE_DRAIN", "RSC_MEV_CLOSE"],
'RS_IGNITION': ["RSC_ANY_TO_ABORT", "RSC_IGNITION_TO_LAUNCH", "RSC_GOTO_ARM"],
'RS_LAUNCH': ["RSC_ANY_TO_ABORT", "RSC_LAUNCH_TO_BURN"],
'RS_NONE': ["RSC_ANY_TO_ABORT"],
'RS_PRELAUNCH': ["RSC_ANY_TO_ABORT", "RSC_GOTO_FILL", "RSC_OPEN_VENT", "RSC_CLOSE_VENT", "RSC_OPEN_DRAIN", "RSC_CLOSE_DRAIN", "RSC_MEV_CLOSE"],
'RS_RECOVERY': ["RSC_ANY_TO_ABORT", "RSC_OPEN_VENT", "RSC_CLOSE_VENT", "RSC_OPEN_DRAIN", "RSC_CLOSE_DRAIN", "RSC_MEV_CLOSE"]
'RS_ABORT': ["RSC_ANY_TO_ABORT", "RSC_GOTO_PRELAUNCH", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_ARM': ["RSC_ANY_TO_ABORT", "RSC_POWER_TRANSITION_ONBOARD", "RSC_POWER_TRANSITION_EXTERNAL", "RSC_GOTO_FILL", "RSC_GOTO_IGNITION", "RSC_OPEN_VENT", "RSC_CLOSE_VENT", "RSC_OPEN_DRAIN", "RSC_CLOSE_DRAIN", "RSC_MEV_CLOSE", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_BURN': ["RSC_ANY_TO_ABORT", "RSC_BURN_TO_COAST", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_COAST': ["RSC_ANY_TO_ABORT", "RSC_COAST_TO_DESCENT", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_DESCENT': ["RSC_ANY_TO_ABORT", "RSC_DESCENT_TO_RECOVERY", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_FILL': ["RSC_ANY_TO_ABORT", "RSC_ARM_CONFIRM_1", "RSC_ARM_CONFIRM_2", "RSC_GOTO_ARM", "RSC_GOTO_PRELAUNCH", "RSC_OPEN_VENT", "RSC_CLOSE_VENT", "RSC_OPEN_DRAIN", "RSC_CLOSE_DRAIN", "RSC_MEV_CLOSE", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_IGNITION': ["RSC_ANY_TO_ABORT", "RSC_IGNITION_TO_LAUNCH", "RSC_GOTO_ARM", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_LAUNCH': ["RSC_ANY_TO_ABORT", "RSC_LAUNCH_TO_BURN", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_NONE': ["RSC_ANY_TO_ABORT", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_PRELAUNCH': ["RSC_ANY_TO_ABORT", "RSC_GOTO_FILL", "RSC_OPEN_VENT", "RSC_CLOSE_VENT", "RSC_OPEN_DRAIN", "RSC_CLOSE_DRAIN", "RSC_MEV_CLOSE", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"],
'RS_RECOVERY': ["RSC_ANY_TO_ABORT", "RSC_OPEN_VENT", "RSC_CLOSE_VENT", "RSC_OPEN_DRAIN", "RSC_CLOSE_DRAIN", "RSC_MEV_CLOSE", "RSC_CLOSE_DRAIN", "RSC_OPEN_DRAIN", "RSC_CLOSE_VENT", "RSC_OPEN_VENT"]
}

def coord_parse_json_send(msg):
Expand All @@ -83,8 +130,6 @@ def coord_parse_json_send(msg):

def baro_parse_json_send(msg):
dmb_jsonStr_baro = json.dumps(pbnd.tele_dmb_obj.tele_baro(msg.baro.baro_pressure, msg.baro.baro_temp))
#print(msg.baro.baro_pressure)
#print(msg.baro.baro_temp)
client.publish("TELE_DMB_BARO", dmb_jsonStr_baro)

def imu_parse_json_send(msg):
Expand All @@ -103,21 +148,25 @@ def flash_parse_json_send(msg):
client.publish("TELE_DMB_FLASH", dmb_jsonStr_flash)

def pressdmb_parse_json_send(msg):
dmb_jsonStr_pressure = json.dumps(pbnd.tele_pbb_obj.tele_pressure(msg.pressdmb.upper_pv_pressure))
dmb_jsonStr_pressure = json.dumps(pbnd.tele_dmb_obj.tele_pressure(msg.pressdmb.upper_pv_pressure))
client.publish("TELE_DMB_PRESSURE", dmb_jsonStr_pressure)

def presspbb_parse_json_send(msg):
pbb_jsonStr_pressure = json.dumps(pbnd.tele_pbb_obj.tele_pressure(msg.presspbb.ib_pressure, msg.presspbb.lower_pv_pressure))
client.publish("TELE_PBB_PRESSURE", pbb_jsonStr_pressure)

def temppbb_parse_json_send(msg):
pbb_jsonStr_temperature = json.dumps(pbnd.tele_pbb_obj.tele_pressure(msg.temppbb.ib_temperature, msg.temppbb.pv_temperature))
pbb_jsonStr_temperature = json.dumps(pbnd.tele_pbb_obj.tele_temp(msg.temppbb.ib_temperature, msg.temppbb.pv_temperature))
client.publish("TELE_PBB_TEMP", pbb_jsonStr_temperature)

def gpio_parse_json_send(msg):
pbb_jsonStr_gpio_status = json.dumps(pbnd.tele_pbb_obj.tele_gpio_status(msg.gpio.main_engine_valve_open, msg.gpio.vent_open, msg.gpio.drain_open))
client.publish("TELE_PBB_GPIO", pbb_jsonStr_gpio_status)

def mevstate_parse_json_send(msg):
pbb_jsonStr_mevstate = json.dumps(pbnd.tele_pbb_obj.tele_mevstate(msg.mevstate.mev_open))
client.publish("TELE_PBB_MEVSTATE", pbb_jsonStr_mevstate)

def pressrcu_parse_json_send(msg):
rcu_jsonStr_pressure = json.dumps(pbnd.tele_rcu_obj.tele_pressure(msg.pressrcu.pt1_pressure, msg.pressrcu.pt2_pressure, msg.pressrcu.pt3_pressure, msg.pressrcu.pt4_pressure))
client.publish("TELE_RCU_PRESSURE", rcu_jsonStr_pressure)
Expand All @@ -134,6 +183,7 @@ def relay_parse_json_send(msg):
rcu_jsonStr_relay_status = json.dumps(pbnd.tele_rcu_obj.tele_relay_status(msg.relay.ac1_open, msg.relay.ac2_open,
msg.relay.pbv1_open, msg.relay.pbv2_open, msg.relay.pbv3_open,
msg.relay.sol1_open, msg.relay.sol2_open, msg.relay.sol3_open, msg.relay.sol4_open, msg.relay.sol5_open, msg.relay.sol6_open, msg.relay.sol7_open, msg.relay.sol8a_open, msg.relay.sol8b_open))
#print(rcu_jsonStr_relay_status)
client.publish("TELE_RCU_RELAY", rcu_jsonStr_relay_status)

def padbox_parse_json_send(msg):
Expand Down Expand Up @@ -162,6 +212,7 @@ def irtemp_parse_json_send(msg):
"presspbb": presspbb_parse_json_send,
"temppbb": temppbb_parse_json_send,
"gpio": gpio_parse_json_send,
"mevstate": mevstate_parse_json_send,
"pressrcu": pressrcu_parse_json_send,
"temprcu": temprcu_parse_json_send,
"nos": nos_parse_json_send,
Expand Down
101 changes: 62 additions & 39 deletions PythonTestProject/Publisher_nodered.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
class TELE_DMB:
def tele_gps(self, lat_minutes, lat_degrees, long_minutes, long_degrees, antenna_alt, antenna_unit, geoid_altitude, geoid_unit, total_altitude, total_unit, time):
return {
"lat_minutes": str(lat_minutes),
"lat_degrees": str(lat_degrees),
"long_minutes": str(long_minutes),
"long_seconds": str(long_degrees),
"latitude": str(lat_minutes) + "." + str(lat_degrees),
"longitude": str(long_minutes) + "." + str(long_degrees),
"ant_altitude": str(antenna_alt),
"ant_unit": str(antenna_unit),
"geoid_altitude": str(geoid_altitude),
Expand All @@ -32,15 +30,9 @@ def tele_baro(self, baro_pressure, baro_temp):

def tele_imu(self, accel, gyro, mag):
return {
"accel_x": str(accel[0]),
"accel_y": str(accel[1]),
"accel_z": str(accel[2]),
"gyro_x": str(gyro[0]),
"gyro_y": str(gyro[1]),
"gyro_z": str(gyro[2]),
"mag_x": str(mag[0]),
"mag_y": str(mag[1]),
"mag_z": str(mag[2])
"accel": accel,
"gyro": gyro,
"mag": mag
}

def tele_battery(self, power_src, bat_volt):
Expand All @@ -63,8 +55,8 @@ def tele_pressure(self, upper_pv_pressure):
class TELE_PBB:
def tele_pressure(self, ib_pressure, lower_pv_pressure):
return {
"ib_pressure": str(ib_pressure),
"lower_pv_pressure": str(lower_pv_pressure)
"ib_pressure": str(ib_pressure),
"lower_pv_pressure": str(lower_pv_pressure)
}

def tele_temp(self, ib_temperature, pv_temperature):
Expand All @@ -75,12 +67,23 @@ def tele_temp(self, ib_temperature, pv_temperature):

def tele_gpio_status(self, main_engine_valve_open, vent_open, drain_open):
return {
"mev_open": str(main_engine_valve_open),
"vent_open": str(vent_open),
"drain_open": str(drain_open)
"mev_open": main_engine_valve_open,
"vent_open": vent_open,
"drain_open": drain_open
}

def tele_mevstate(self, mev_open):
return {
"mev_open": mev_open
}

class TELE_RCU:
def __init__(self):
self.is_nos1_hold_enable = False
self.is_nos2_hold_enable = False
self.nos1_hold_mass = 0
self.nos2_hold_mass = 0

def tele_pressure(self, pt1_pressure, pt2_pressure, pt3_pressure, pt4_pressure):
return {
"pt1_pressure": str(pt1_pressure),
Expand All @@ -94,35 +97,54 @@ def tele_temp(self, tc1_temp, tc2_temp):
"tc1_temp": str(tc1_temp),
"tc2_temp": str(tc2_temp)
}

def tele_nos_load_cell(self, nos1_mass, nos2_mass):
return {
nos1_hold_str = "0"
nos2_hold_str = "0"

if self.is_nos1_hold_enable is False:
# keep null string but update nos mass
self.nos1_hold_mass = nos1_mass
else:
# replace output string with last held mass
nos1_hold_str = str(self.nos1_hold_mass)
nos1_mass -= self.nos1_hold_mass

if self.is_nos2_hold_enable is False:
self.nos2_hold_mass = nos2_mass
else:
nos2_hold_str = str(self.nos2_hold_mass)
nos2_mass -= self.nos2_hold_mass

return {
"nos1_mass": str(nos1_mass),
"nos2_mass": str(nos2_mass)
"nos2_mass": str(nos2_mass),
"nos1_hold": nos1_hold_str,
"nos2_hold": nos2_hold_str
}

def tele_relay_status(self, ac1_open, ac2_open, pbv1_open, pbv2_open, pbv3_open, sol1_open, sol2_open, sol3_open, sol4_open, sol5_open, sol6_open, sol7_open, sol8a_open, sol8b_open):
return {
"ac1_open": str(ac1_open),
"ac2_open": str(ac2_open),
"pbv1_open": str(pbv1_open),
"pbv2_open": str(pbv2_open),
"pbv3_open": str(pbv3_open),
"sol1_open": str(sol1_open),
"sol2_open": str(sol2_open),
"sol3_open": str(sol3_open),
"sol4_open": str(sol4_open),
"sol5_open": str(sol5_open),
"sol6_open": str(sol6_open),
"sol7_open": str(sol7_open),
"sol8a_open": str(sol8a_open),
"sol8b_open": str(sol8b_open)
"ac1_open": ac1_open,
"ac2_open": ac2_open,
"pbv1_open": pbv1_open,
"pbv2_open": pbv2_open,
"pbv3_open": pbv3_open,
"sol1_open": sol1_open,
"sol2_open": sol2_open,
"sol3_open": sol3_open,
"sol4_open": sol4_open,
"sol5_open": sol5_open,
"sol6_open": sol6_open,
"sol7_open": sol7_open,
"sol8a_open": sol8a_open,
"sol8b_open": sol8b_open
}

def tele_padbox_status(self, cont1, cont2):
return {
"cont1": str(cont1),
"cont2": str(cont2)
"cont1": cont1,
"cont2": cont2
}

class TELE_SOB:
Expand All @@ -139,9 +161,10 @@ def tele_temp(self, tc1_temp, tc2_temp):

def tele_irtemp(self, ambient_temp, object_temp):
return {
"ambient_temp": str(ambient_temp),
"object_temp": str(object_temp)
"ambient_temp": str(ambient_temp),
"object_temp": str(object_temp)
}


#DMB Telemetry
tele_dmb_obj = TELE_DMB()
Expand Down
Loading