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

Amar/feature/create simulated adcs #59

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bdeb190
initialized our subsystem files
waridh Jan 30, 2024
1efce82
put a little more work into the class
waridh Jan 30, 2024
6ca2440
Removed the imports that are deprecated
waridh Feb 7, 2024
113cebb
added and updated a quick readme for the adcs simulation a little
waridh Feb 7, 2024
647d31d
added better debugging system
waridh Feb 7, 2024
b9998a6
started making skeleton code
waridh Feb 12, 2024
2d361ac
docker now runs the python server
waridh Feb 12, 2024
7a7df8d
removed the docker readme
waridh Feb 12, 2024
9742d49
added really basic states for the adcs simulation
waridh Feb 12, 2024
3c4f276
added how to run commands for the docker
waridh Feb 14, 2024
3b887ff
removed a vim artifact, and also added a gitignore for the vim artifacts
waridh Feb 14, 2024
2ae88c9
removed the vim artifacts
waridh Feb 17, 2024
7294a0c
tried making a better constructor
waridh May 12, 2024
deddec3
Merge branch 'main' into bach/feature/adcs_basics
waridh May 12, 2024
06d58bb
started to restructure adcs, and made an echo server that could be us…
waridh May 12, 2024
21806e3
updated the unit testing for ADCS
waridh May 13, 2024
1e3cc6f
updated the readme to reflect the state of the package
waridh May 14, 2024
5ea5d59
added a comment about clean code
waridh May 14, 2024
31e4f6a
updated the testing framework to use the Mock object provided by the …
waridh May 14, 2024
2ee4c95
more writing done
waridh May 14, 2024
93a46f5
extracted the state out into it's own file
waridh May 15, 2024
fc01e07
added a class for the adcs packet, and updated the interface
waridh May 15, 2024
40bc0ea
played with unicurses to make progress on a debug server tool that ca…
waridh May 17, 2024
a88788e
Creating a dictionary to store commands as well as starting to work o…
kulovac May 21, 2024
48ae5a7
tui application for sending any user defined packets
waridh May 21, 2024
aabb600
Merge remote-tracking branch 'origin/amar/feature/create_simulated_ad…
waridh May 21, 2024
d07937a
On off and wheel speed states are modifiable they do not affect anything
kulovac May 21, 2024
66dca9a
made the unittest for the packet manipulation class
waridh May 22, 2024
d043175
completed more serialization and deserialization functions
waridh May 28, 2024
2f25786
implemented data serialization
waridh May 28, 2024
c844ff2
basic serialization is implemented
waridh May 28, 2024
6b3bfc8
Merge remote-tracking branch 'origin/amar/feature/create_simulated_ad…
waridh May 28, 2024
853165f
Completed the basic packet serializer and deserializer
waridh May 28, 2024
8f2727c
Added client script and added most adcs functions
kulovac Jun 8, 2024
bee554c
all commands now exist now just working on getting the server to shut…
kulovac Jul 9, 2024
b8f452a
getting rid of TODO comments and deleting useless code
kulovac Jul 9, 2024
0ab3f73
fixed pylint errors and moved server connection to be the job of the …
kulovac Jul 9, 2024
531babf
Updated README with running instructions
kulovac Jul 9, 2024
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
Binary file added ..gitignore.un~
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,5 @@ cython_debug/

# MacOS
.DS_Store

.idea/
163 changes: 163 additions & 0 deletions .gitignore~
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# MacOS
.DS_Store
34 changes: 34 additions & 0 deletions ADCS/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/

**/.DS_Store
**/__pycache__
**/.venv
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
2 changes: 2 additions & 0 deletions ADCS/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.un~
*.swp
49 changes: 49 additions & 0 deletions ADCS/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# syntax=docker/dockerfile:1

# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/go/dockerfile-reference/

ARG PYTHON_VERSION=3.10.13
FROM python:${PYTHON_VERSION}-slim as base

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

WORKDIR /app

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser

# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
# Leverage a bind mount to requirements.txt to avoid having to copy them into
# into this layer.
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
python -m pip install -r requirements.txt

# Switch to the non-privileged user to run the application.
USER appuser

# Copy the source code into the container.
COPY . .

# Expose the port that the application listens on.
EXPOSE 8838

# Run the application.
CMD python3 adcs_subsystem.py 8838 127.0.0.1
68 changes: 68 additions & 0 deletions ADCS/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# ADCS Simulated Subsystem

## Overview

The ADCS, also known as the Altitude Determination and Control System, is a
system that controls the orientation of ex3.

The ADCS is used to help steer the satellite.

## Data types
- x,y,z angle
- Representable as a triplet?
- x,y,z angular speed
- Same representation as the x,y,z angle?
- ECI/ECEF/LLH position/velocity (Need definition)
- Coarse and fine sun vector (Need definition)
- Wheel speed
- Magnetic Field (IMU?)
- Comm status
- Rate sensor temperature (sensor measuring the wheel speed?)

## Payload design
- TODO

## TODO
- [ ] Make a status report transaction code
- [ ] Implement an echo command

## Usage

Note: We are missing docker setups for running the unit test. Run using your local environment for now.

_There is now a dockerfile associated with this subsystem, and you are able to
run it using the following command on powershell (please have docker installed)_


```powershell
docker build -t adcs_server .
```

```powershell
docker run -dp 127.0.0.1:8838:8838 adcs_server
```

## Testing the Subsystem

To test the subsystem run the adcs_server.py file, and connect to the server using some program/utility such as `nc`

```bash
nc localhost 42123
```

From there you can send commands such as `HELP` from the client side.

## Testing Table

### ADCS Subsystem

| Test Name | Test Description |
| --- | --- |
| `test_setup` | This test makes sure that the unit testing framework, and mocked objects are functioning as expected. |

### Temporary Connection Protocol

| Test Name | Test Description |
| --- | --- |
| `test_setup` | This test makes sure that the unit testing framework, and mocked objects are functioning as expected. |
| `test_serializing` | This test should check if the connection protocol object is able to turn the packet object into a byte stream. |
2 changes: 2 additions & 0 deletions ADCS/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file is used for imports
from adcs_subsystem import ADCSSubsystem
28 changes: 28 additions & 0 deletions ADCS/abstract_interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Holds the abstract class ConnectionProtocol"""


class ConnectionProtocol:
"""TODO: We should put the packet serialization and so on be the
responsibility of the connection protocol, since it will be
changing as we get further into the project."""

def send(self, data: bytes):
"""
This method will send data. Force the input to be bytes so that the
caller must format the data to be bytes already.
"""
raise NotImplementedError

def recv(self) -> bytes:
"""
This method will recieve data. It should return it.

Fundamental assumption is that this will work with bytes
"""
raise NotImplementedError

def connect(self):
"""
This method will start the connection
"""
raise NotImplementedError
Loading
Loading