-
Notifications
You must be signed in to change notification settings - Fork 1
/
template_task.py
53 lines (38 loc) · 1.42 KB
/
template_task.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from debugcolor import co
class Task:
"""
The Task Object.
Attributes:
priority: The priority level assigned to the task.
frequency: Number of times the task must be executed in 1 second (Hz).
name: Name of the task object for future reference
color: Debug color for serial terminal
"""
priority = 10
frequency = 1
name = 'temp'
color = 'gray'
def __init__(self, satellite):
"""
Initialize the Task using the PyCubed cubesat object.
:type satellite: Satellite
:param satellite: The cubesat to be registered
"""
self.cubesat = satellite
def debug(self,msg,level=1):
"""
Print a debug message formatted with the task name and color
:param msg: Debug message to print
:param level: > 1 will print as a sub-level
"""
if level==1:
print('{:>30} {}'.format('['+co(msg=self.name,color=self.color)+']',msg))
else:
print('{}{}'.format('\t └── ',msg))
async def main_task(self, *args, **kwargs):
"""
Contains the code for the user defined task.
:param `*args`: Variable number of arguments used for task execution.
:param `**kwargs`: Variable number of keyword arguments used for task execution.
"""
pass