Skip to content

Commit

Permalink
Lint python
Browse files Browse the repository at this point in the history
  • Loading branch information
nateinaction committed Jul 24, 2024
1 parent 6d1e4fe commit dbb3f0a
Show file tree
Hide file tree
Showing 46 changed files with 2,297 additions and 1,809 deletions.
2 changes: 1 addition & 1 deletion CircuitPy/Batt_Board/boot.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import supervisor

supervisor.set_next_stack_limit(4096 + 4096)
supervisor.set_next_stack_limit(4096 + 4096)
8 changes: 4 additions & 4 deletions CircuitPy/Batt_Board/can_listen.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from pysquared_eps import cubesat as c
from pysquared_eps import cubesat as c
import battery_functions
import can_bus_helper
import can_bus_helper
import time

f=battery_functions.functions(c)
f = battery_functions.functions(c)

cb=can_bus_helper.CanBusHelper(c.can_bus,f,True)
cb = can_bus_helper.CanBusHelper(c.can_bus, f, True)

while True:
cb.listen_messages()
Expand Down
8 changes: 4 additions & 4 deletions CircuitPy/Batt_Board/can_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from pysquared_eps import cubesat as c
from pysquared_eps import cubesat as c
import battery_functions
import can_bus_helper
import can_bus_helper
import time

f=battery_functions.functions(c)
f = battery_functions.functions(c)

cb=can_bus_helper.CanBusHelper(c.can_bus,f,True)
cb = can_bus_helper.CanBusHelper(c.can_bus, f, True)

while True:
cb.listen_messages()
Expand Down
8 changes: 4 additions & 4 deletions CircuitPy/Batt_Board/code.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'''
"""
In this method the PyCubed will wait a pre-allotted loiter time before proceeding to execute
main. This loiter time is to allow for a keyboard interupt if needed.
Authors: Nicole Maggard and Michael Pham
'''
"""

import time
import microcontroller

try:
import main

except Exception as e:
except Exception as e:
print(e)
time.sleep(10)
microcontroller.on_next_reset(microcontroller.RunMode.NORMAL)
microcontroller.reset()
microcontroller.reset()
21 changes: 14 additions & 7 deletions CircuitPy/Batt_Board/detumble.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
def dot_product(vector1, vector2):
return sum([a*b for a,b in zip(vector1, vector2)])
return sum([a * b for a, b in zip(vector1, vector2)])


def x_product(vector1, vector2):
return [vector1[1]*vector2[2]-vector1[2]*vector2[1],vector1[0]*vector2[2]-vector1[2]*vector2[0],vector1[0]*vector2[1]-vector1[1]*vector2[0]]
return [
vector1[1] * vector2[2] - vector1[2] * vector2[1],
vector1[0] * vector2[2] - vector1[2] * vector2[0],
vector1[0] * vector2[1] - vector1[1] * vector2[0],
]


def gain_func():
return 1.0

def magnetorquer_dipole(mag_field,ang_vel):
gain=gain_func()
scalar_coef=-gain/pow(dot_product(mag_field,mag_field),0.5)
dipole_out=x_product(mag_field,ang_vel)

def magnetorquer_dipole(mag_field, ang_vel):
gain = gain_func()
scalar_coef = -gain / pow(dot_product(mag_field, mag_field), 0.5)
dipole_out = x_product(mag_field, ang_vel)
for i in range(3):
dipole_out[i]*=scalar_coef
dipole_out[i] *= scalar_coef
return dipole_out
Loading

0 comments on commit dbb3f0a

Please sign in to comment.