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

Python interface microservice #843

Merged
merged 44 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7c3b749
INST2 as Python target
jmthomas Sep 14, 2023
0240297
python language prep
jmthomas Sep 15, 2023
8b72034
decom_microservice.py and supporting files
jmthomas Sep 18, 2023
c73bf01
Merge branch 'main' into python
jmthomas Sep 18, 2023
7e007ea
Python interface_microservice
jmthomas Sep 20, 2023
6f206dc
Working python simulated target
jmthomas Sep 20, 2023
a6fe636
Fix CvtModel and add testing
jmthomas Sep 21, 2023
e9c04d5
conversions and test code
jmthomas Sep 22, 2023
1a94807
unix_time_conversions
jmthomas Sep 24, 2023
b7ab3f5
Mostly working INST2 target
jmthomas Sep 26, 2023
6550c10
Processors and conversions
jmthomas Sep 26, 2023
ad3f682
Merge branch 'main' into python
jmthomas Sep 27, 2023
daa7d36
Fix ruby python tests
jmthomas Sep 27, 2023
593fbe5
Enable python decom
jmthomas Sep 28, 2023
10e58ec
Fix config_parser error
jmthomas Sep 28, 2023
7ade199
Remove System requirement from PacketLogWriter. Fix target config id.…
ryanmelt Sep 28, 2023
ac0b081
Merge branch 'python' of https://github.com/OpenC3/cosmos into python
jmthomas Sep 28, 2023
553961e
increase sleep to allow move to finish
ryanmelt Sep 28, 2023
dc91d9d
Merge branch 'main' into python
ryanmelt Sep 28, 2023
4914d84
Working python decom
jmthomas Sep 29, 2023
36afd7f
Merge branch 'python' of https://github.com/OpenC3/cosmos into python
jmthomas Sep 29, 2023
b4d502d
Fix ruff
jmthomas Sep 29, 2023
98f5af1
Fix python unit tests and playwright
jmthomas Sep 29, 2023
8c37f78
Fix limits event callback
jmthomas Sep 29, 2023
bc64e95
Fix Topics to correct Redis. Fix logger. Fix example limits response.…
ryanmelt Sep 29, 2023
98d9485
Merge branch 'main' into python
jmthomas Oct 1, 2023
cb4e1b5
Clear EphemeralStore in test_helper
jmthomas Oct 1, 2023
b6103aa
cbor and html accessor
jmthomas Oct 1, 2023
557b84a
Working python command
jmthomas Oct 3, 2023
ff4c731
Fix topic_offsets
jmthomas Oct 3, 2023
2dec77b
Merge branch 'main' into python
jmthomas Oct 3, 2023
a072d29
Fix api commanding and playwright dismiss
jmthomas Oct 3, 2023
2ff8155
Merge branch 'main' into python
jmthomas Oct 9, 2023
6e337e3
Test python commanding
jmthomas Oct 10, 2023
9b08d9d
test_cmd_api and fixes
jmthomas Oct 11, 2023
56db72e
Full cmd_api coverage
jmthomas Oct 11, 2023
84ea823
Merge branch 'main' into python
jmthomas Oct 11, 2023
2eae270
Fix ruff errors
jmthomas Oct 11, 2023
d81c83a
Fix python code coverage
jmthomas Oct 11, 2023
b7b58b7
codecov upload python
jmthomas Oct 11, 2023
ceaddb7
Generate python xml converage
jmthomas Oct 11, 2023
bb3cc2a
Change codecov python path
jmthomas Oct 11, 2023
495328b
Merge branch 'main' into python
jmthomas Oct 11, 2023
614e834
Add .coveragerc
jmthomas Oct 12, 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
7 changes: 6 additions & 1 deletion .github/workflows/python_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,10 @@ jobs:
working-directory: openc3/python
- name: Run unit tests
run: |
python -m unittest
coverage run -m pytest ./test/
coverage xml
working-directory: openc3/python
- uses: codecov/codecov-action@v3
with:
working-directory: openc3/python
flags: python # See codecov.yml
8 changes: 7 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ coverage:
openc3-ruby:
threshold: 50%
paths:
- openc3/openc3/lib
- openc3/lib
flags:
- ruby-backend
python:
threshold: 50%
paths:
- openc3/python
flags:
- python
frontend:
threshold: 50%
paths:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ VARIABLE reduced_log_retain_time 2592000
<% end %>

<% if include_inst2 %>
TARGET INST <%= inst2_target_name %>
TARGET INST2 <%= inst2_target_name %>
LOG_RETAIN_TIME <%= log_retain_time %>
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
TLM_LOG_CYCLE_TIME 600
Expand Down Expand Up @@ -78,7 +78,7 @@ VARIABLE reduced_log_retain_time 2592000
<% end %>

<% if include_inst2 and include_inst2_int %>
INTERFACE <%= inst2_int_name %> simulated_target_interface.rb sim_inst.rb
INTERFACE <%= inst2_int_name %> openc3/interfaces/simulated_target_interface.py sim_inst.py
MAP_TARGET <%= inst2_target_name %>
<% end %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,23 @@
# GNU Affero General Public License for more details.

# Modified by OpenC3, Inc.
# All changes Copyright 2022, OpenC3, Inc.
# All changes Copyright 2023, OpenC3, Inc.
# All Rights Reserved
#
# This file may also be used under the terms of a commercial license
# This file may also be used under the terms of a commercial license
# if purchased from OpenC3, Inc.

# This file implements a class to handle responses to limits state changes.

require 'openc3/packets/limits_response'

# ExampleLimitsResponse class
#
# This class handles a limits response
#
class ExampleLimitsResponse < OpenC3::LimitsResponse

def call(packet, item, old_limits_state)
case item.limits.state
when :RED_HIGH
cmd('<%= target_name %>', 'COLLECT', 'TYPE' => 'NORMAL', 'DURATION' => 5)
cmd('<%= target_name %>', 'COLLECT', 'TYPE' => 'NORMAL', 'DURATION' => 7)
when :RED_LOW
cmd_no_hazardous_check('<%= target_name %>', 'CLEAR')
end
end

end # class ExampleLimitsResponse
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
LANGUAGE ruby

# Requires for limits responses and custom conversion classes
REQUIRE example_limits_response.rb
REQUIRE sim_inst.rb
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PARAMETER CCSDSVER 0 3 UINT 0 0 0 "CCSDS primary header version number"
PARAMETER CCSDSTYPE 3 1 UINT 1 1 1 "CCSDS primary header packet type"
PARAMETER CCSDSSHF 4 1 UINT 0 0 0 "CCSDS primary header secondary header flag"
ID_PARAMETER CCSDSAPID 5 11 UINT 0 2047 999 "CCSDS primary header application id"
PARAMETER CCSDSSEQFLAGS 16 2 UINT 3 3 3 "CCSDS primary header sequence flags"
PARAMETER CCSDSSEQCNT 18 14 UINT 0 16383 0 "CCSDS primary header sequence count"
OVERFLOW TRUNCATE
PARAMETER CCSDSLENGTH 32 16 UINT MIN MAX 12 "CCSDS primary header packet length"
ID_PARAMETER PKTID 48 16 UINT MIN MAX <%= id %> "Packet id"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
APPEND_ITEM CCSDSVER 3 UINT "CCSDS packet version number (See CCSDS 133.0-B-1)"
APPEND_ITEM CCSDSTYPE 1 UINT "CCSDS packet type (command or telemetry)"
STATE TLM 0
STATE CMD 1
APPEND_ITEM CCSDSSHF 1 UINT "CCSDS secondary header flag"
STATE FALSE 0
STATE TRUE 1
APPEND_ID_ITEM CCSDSAPID 11 UINT <%= apid %> "CCSDS application process id"
APPEND_ITEM CCSDSSEQFLAGS 2 UINT "CCSDS sequence flags"
STATE FIRST 1
STATE CONT 0
STATE LAST 2
STATE NOGROUP 3
APPEND_ITEM CCSDSSEQCNT 14 UINT "CCSDS packet sequence count"
OVERFLOW TRUNCATE
APPEND_ITEM CCSDSLENGTH 16 UINT "CCSDS packet data length"
APPEND_ITEM TIMESEC 32 UINT "Seconds since epoch (January 1st, 1970, midnight)"
APPEND_ITEM TIMEUS 32 UINT "Microseconds of second"
APPEND_ID_ITEM PKTID 16 UINT 1 "Packet id (The combination of CCSDS_APID and PACKET_ID identify the packet)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
COMMAND <%= target_name %> COLLECT BIG_ENDIAN "Starts a collect on the <%= target_name %> target"
<%= render "_ccsds_cmd.txt", locals: {id: 1} %>
PARAMETER TYPE 64 16 UINT MIN MAX 0 "Collect type which can be normal or special. Note the special collects are hazarous and require user confirmation."
REQUIRED
STATE NORMAL 0
STATE SPECIAL 1 HAZARDOUS
PARAMETER DURATION 80 32 FLOAT 0.0 10.0 1.0 "Collect duration"
PARAMETER OPCODE 112 8 UINT 0x0 0xFF 0xAB "Collect opcode"
FORMAT_STRING "0x%0X"
PARAMETER TEMP 120 32 FLOAT 0.0 25.0 0.0 "Collect temperature"
UNITS Celsius C

COMMAND <%= target_name %> ABORT BIG_ENDIAN "Aborts a collect on the <%= target_name %> instrument"
<%= render "_ccsds_cmd.txt", locals: {id: 2} %>

COMMAND <%= target_name %> CLEAR BIG_ENDIAN "Clears counters on the <%= target_name %> instrument"
HAZARDOUS "Clearing counters may lose valuable information."
<%= render "_ccsds_cmd.txt", locals: {id: 3} %>

COMMAND <%= target_name %> SETPARAMS BIG_ENDIAN "Sets numbered parameters"
<%= render "_ccsds_cmd.txt", locals: {id: 4} %>
# ERB syntax:
<% (1..5).each do |i| %>
APPEND_PARAMETER VALUE<%= i %> 16 UINT 0 5 1 "Value <%= i %> setting"
<% end %>

SELECT_PARAMETER VALUE5
POLY_WRITE_CONVERSION 0 2

COMMAND <%= target_name %> ASCIICMD BIG_ENDIAN "Enumerated ASCII command"
<%= render "_ccsds_cmd.txt", locals: {id: 5} %>
APPEND_PARAMETER STRING 2048 STRING "NOOP" "Enumerated string parameter"
STATE "ARM LASER" "ARM LASER" HAZARDOUS "Arming the laser poses an eye safety hazard."
STATE "FIRE LASER" "FIRE LASER" HAZARDOUS "WARNING Laser will be fired!"
STATE "NOOP" "NOOP" DISABLE_MESSAGES
APPEND_PARAMETER BINARY 32 STRING 0xDEADBEEF "Binary string"
APPEND_PARAMETER ASCII 80 STRING "0xDEADBEEF" "ASCII string"

COMMAND <%= target_name %> FLTCMD BIG_ENDIAN "Command with float parameters"
<%= render "_ccsds_cmd.txt", locals: {id: 6} %>
PARAMETER FLOAT32 64 32 FLOAT MIN MAX 0.0 "Float32 parameter"
PARAMETER FLOAT64 96 64 FLOAT MIN MAX 0.0 "Float64 parameter"

COMMAND <%= target_name %> ARYCMD BIG_ENDIAN "Command with array parameter"
<%= render "_ccsds_cmd.txt", locals: {id: 7} %>
ARRAY_PARAMETER ARRAY 64 32 UINT -8 "Array parameter"
PARAMETER CRC -8 8 UINT MIN MAX 0 "CRC"

COMMAND <%= target_name %> SLRPNLDEPLOY BIG_ENDIAN "Deploy solar array panels"
<%= render "_ccsds_cmd.txt", locals: {id: 8} %>

COMMAND <%= target_name %> SLRPNLRESET BIG_ENDIAN "Reset solar array panels"
<%= render "_ccsds_cmd.txt", locals: {id: 9} %>

COMMAND <%= target_name %> MEMLOAD BIG_ENDIAN "Load memory"
DISABLE_MESSAGES # Disable messages on a command that could be sent many many times
<%= render "_ccsds_cmd.txt", locals: {id: 10} %>
APPEND_PARAMETER DATA 80 BLOCK "" "Block of data"

COMMAND <%= target_name %> QUIET BIG_ENDIAN "Enable/disable no out of limits in the demo"
<%= render "_ccsds_cmd.txt", locals: {id: 11} %>
APPEND_PARAMETER STATE 8 UINT 0 1 1
STATE FALSE 0
STATE TRUE 1

COMMAND <%= target_name %> TIME_OFFSET BIG_ENDIAN "Subtract the packet time by the given seconds"
<%= render "_ccsds_cmd.txt", locals: {id: 12} %>
APPEND_PARAMETER SECONDS 32 UINT MIN MAX 0 "Seconds to subtract from packet time"
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
TELEMETRY <%= target_name %> HEALTH_STATUS BIG_ENDIAN "Health and status from the <%= target_name %> target"
<%= render "_ccsds_tlm.txt", locals: {apid: 1} %>
APPEND_ITEM COLLECTS 16 UINT "Number of collects"
APPEND_ITEM TEMP1 16 UINT "Temperature #1"
POLY_READ_CONVERSION -100.0 0.00305
POLY_WRITE_CONVERSION 32768.885246 327.86885
UNITS CELSIUS C
FORMAT_STRING "%0.3f"
LIMITS DEFAULT 1 ENABLED -80.0 -70.0 60.0 80.0 -20.0 20.0
LIMITS TVAC 1 ENABLED -80.0 -30.0 30.0 80.0
LIMITS_RESPONSE example_limits_response.py
APPEND_ITEM TEMP2 32 FLOAT "Temperature #2"
POLY_READ_CONVERSION -100.0 0.00305
POLY_WRITE_CONVERSION 32768.885246 327.86885
UNITS CELSIUS C
FORMAT_STRING "%0.3f"
LIMITS DEFAULT 1 ENABLED -60.0 -60.0 35.0 35.0
LIMITS TVAC 1 ENABLED -60.0 20.0 35.0 35.0
APPEND_ITEM TEMP3 16 UINT "Temperature #3"
POLY_READ_CONVERSION -100.0 0.00305
POLY_WRITE_CONVERSION 32768.885246 327.86885
UNITS CELSIUS C
FORMAT_STRING "%0.3f"
LIMITS DEFAULT 1 ENABLED -25.0 -10.0 50.0 55.0
LIMITS TVAC 1 ENABLED -15.0 -10.0 20.0 30.0
APPEND_ITEM TEMP4 16 UINT "Temperature #4"
POLY_READ_CONVERSION -100.0 0.00305
POLY_WRITE_CONVERSION 32768.885246 327.86885
UNITS CELSIUS C
FORMAT_STRING "%0.3f"
LIMITS DEFAULT 1 ENABLED -80.0 -70.0 60.0 80.0
APPEND_ARRAY_ITEM ARY 8 UINT 80 "Array data"
UNITS VOLTS V
APPEND_ITEM DURATION 32 FLOAT "Most recent collect duration"
APPEND_ITEM COLLECT_TYPE 16 UINT "Most recent collect type"
STATE NORMAL 0
STATE SPECIAL 1
STATE ERROR ANY
APPEND_ARRAY_ITEM ARY2 64 FLOAT 640 "Double array"
UNITS CELSIUS C
APPEND_ITEM ASCIICMD 2048 STRING "Most recent ASCIICMD string"
STATE "NOOP" "NOOP"
STATE "FIRE LASER" "FIRE LASER"
STATE "ARM LASER" "ARM LASER"
APPEND_ITEM GROUND1STATUS 8 UINT "Ground station #1 status"
STATE CONNECTED 1 GREEN
STATE UNAVAILABLE 0 YELLOW
APPEND_ITEM GROUND2STATUS 8 UINT "Ground station #2 status"
STATE CONNECTED 1 GREEN
STATE UNAVAILABLE 0 YELLOW
APPEND_ITEM BLOCKTEST 80 BLOCK "Block data"
ITEM PACKET_TIME 0 0 DERIVED "Ruby time based on TIMESEC and TIMEUS"
READ_CONVERSION openc3/conversions/unix_time_conversion.py TIMESEC TIMEUS
ITEM TEMP1HIGH 0 0 DERIVED "High-water mark for TEMP1"
READ_CONVERSION openc3/conversions/processor_conversion.py TEMP1WATER HIGH_WATER
ITEM TEMP1LOW 0 0 DERIVED "Low-water mark for TEMP1"
READ_CONVERSION openc3/conversions/processor_conversion.py TEMP1WATER LOW_WATER
ITEM TEMP1MAX 0 0 DERIVED "Maximum of most recent 100 samples for TEMP1"
READ_CONVERSION openc3/conversions/processor_conversion.py TEMP1STAT MAX
ITEM TEMP1MIN 0 0 DERIVED "Minimum of most recent 100 samples for TEMP1"
READ_CONVERSION openc3/conversions/processor_conversion.py TEMP1STAT MIN
ITEM TEMP1MEAN 0 0 DERIVED "Mean of most recent 100 samples for TEMP1"
READ_CONVERSION openc3/conversions/processor_conversion.py TEMP1STAT MEAN
ITEM TEMP1STDDEV 0 0 DERIVED "Stddev of most recent 100 samples for TEMP1"
READ_CONVERSION openc3/conversions/processor_conversion.py TEMP1STAT STDDEV
PROCESSOR TEMP1STAT openc3/processors/statistics_processor.py TEMP1 100
PROCESSOR TEMP1WATER openc3/processors/watermark_processor.py TEMP1

TELEMETRY <%= target_name %> ADCS BIG_ENDIAN "Position and attitude data"
META TYPE 'struct adcs'
<%= render "_ccsds_tlm.txt", locals: {apid: 2} %>
ITEM POSX 128 32 FLOAT "Position X"
UNITS METERS M
ITEM POSY 160 32 FLOAT "Position Y"
UNITS METERS M
ITEM POSZ 192 32 FLOAT "Position Z"
UNITS METERS M
ITEM VELX 224 32 FLOAT "Velocity X"
UNITS METERS_PER_SECOND MPS
ITEM VELY 256 32 FLOAT "Velocity Y"
UNITS METERS_PER_SECOND MPS
ITEM VELZ 288 32 FLOAT "Velocity Z"
UNITS METERS_PER_SECOND MPS
ITEM Q1 320 32 FLOAT "Quaternion param 1"
FORMAT_STRING "%0.6f"
META TYPE 'float32'
ITEM Q2 352 32 FLOAT "Quaternion param 2"
FORMAT_STRING "%0.6f"
META TYPE 'float32'
ITEM Q3 384 32 FLOAT "Quaternion param 3"
FORMAT_STRING "%0.6f"
META TYPE 'float32'
ITEM Q4 416 32 FLOAT "Quaternion param 4"
FORMAT_STRING "%0.6f"
META TYPE 'float32'
ITEM BIASX 448 32 FLOAT "Body X rate bias"
FORMAT_STRING "%0.6f"
ITEM BIASY 480 32 FLOAT "Body Y rate bias"
FORMAT_STRING "%0.6f"
ITEM BIASZ 512 32 FLOAT "Body Z rate bias"
FORMAT_STRING "%0.6f"
<% (1..5).each do |i| %>
APPEND_ITEM STAR<%= i %>ID 16 UINT "Star <%= i %> id"
<% end %>
ITEM POSPROGRESS 624 32 FLOAT "Position file progress"
FORMAT_STRING "%0.2f"
ITEM ATTPROGRESS 656 32 FLOAT "Attitude file progress"
FORMAT_STRING "%0.2f"
ITEM PACKET_TIME 0 0 DERIVED "Ruby time based on TIMESEC and TIMEUS"
READ_CONVERSION openc3/conversions/unix_time_conversion.py TIMESEC TIMEUS

TELEMETRY <%= target_name %> PARAMS BIG_ENDIAN "Params set by SETPARAMS command"
<%= render "_ccsds_tlm.txt", locals: {apid: 3} %>
# ERB syntax:
<% (1..5).each do |i| %>
APPEND_ITEM VALUE<%= i %> 16 UINT "Value <%= i %> setting"
STATE GOOD 0 GREEN
STATE BAD 1 RED
<% end %>
ITEM PACKET_TIME 0 0 DERIVED "Ruby time based on TIMESEC and TIMEUS"
READ_CONVERSION openc3/conversions/unix_time_conversion.py TIMESEC TIMEUS

TELEMETRY <%= target_name %> IMAGE BIG_ENDIAN "Packet with image data"
<%= render "_ccsds_tlm.txt", locals: {apid: 4} %>
APPEND_ITEM BLOCK 8000 BLOCK "Raw Data"
APPEND_ITEM IMAGE 0 BLOCK "Image Data"
ITEM BYTES 128 32 UINT "First bytes"
FORMAT_STRING '0x%08x'
OVERLAP # Notify OpenC3 that this is intentionally overlapping the BLOCK field
ITEM PACKET_TIME 0 0 DERIVED "Ruby time based on TIMESEC and TIMEUS"
READ_CONVERSION openc3/conversions/unix_time_conversion.py TIMESEC TIMEUS

TELEMETRY <%= target_name %> MECH BIG_ENDIAN "Mechanism status"
<%= render "_ccsds_tlm.txt", locals: {apid: 5} %>
APPEND_ITEM EXTRA 32 FLOAT "Extra item to be deleted"
APPEND_ITEM SLRPNL1 32 FLOAT "Solar panel 1 angle"
UNITS DEGREES DEG
APPEND_ITEM SLRPNL2 32 FLOAT "Solar panel 2 angle"
UNITS DEGREES DEG
APPEND_ITEM SLRPNL3 32 FLOAT "Solar panel 3 angle"
UNITS DEGREES DEG
APPEND_ITEM SLRPNL4 32 FLOAT "Solar panel 4 angle"
UNITS DEGREES DEG
APPEND_ITEM SLRPNL5 32 FLOAT "Solar panel 5 angle"
UNITS DEGREES DEG
APPEND_ITEM CURRENT 32 FLOAT "Device current"
UNITS micro-Ampères µA
ITEM PACKET_TIME 0 0 DERIVED "Ruby time based on TIMESEC and TIMEUS"
READ_CONVERSION openc3/conversions/unix_time_conversion.py TIMESEC TIMEUS
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# NOTE: Telemetry definitions are processed in alphabetical order by default.
# However, this can be overridden by explicitly calling them out in target.txt.
# Thus it's recommended to create a file like this with an extension
# such as inst_tlm_override.txt which will be processed AFTER inst_tlm.txt.

# Existing telemetry packets can be selected and items modified
SELECT_TELEMETRY <%= target_name %> MECH
# Existing items can be selected and modified by adding conversions, limits, etc
SELECT_ITEM SLRPNL1
LIMITS DEFAULT 1 ENABLED -180.0 -170.0 170.0 180.0
# Delete an item so it doesn't appear in the packet
DELETE_ITEM EXTRA
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2023 OpenC3, Inc.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# This file may also be used under the terms of a commercial license
# if purchased from OpenC3, Inc.

from openc3.packets.limits_response import LimitsResponse
from openc3.api.cmd_api import cmd, cmd_no_hazardous_check


class ExampleLimitsResponse(LimitsResponse):
def call(self, packet, item, old_limits_state):
match item.limits.state:
case "RED_HIGH":
cmd("<%= target_name %>", "COLLECT", {"TYPE": "NORMAL", "DURATION": 7})
case "RED_LOW":
cmd_no_hazardous_check("<%= target_name %>", "CLEAR")
Loading
Loading