diff --git a/mil_common/utils/mil_tools/scripts/mil-preflight/README.md b/mil_common/utils/mil_tools/scripts/mil-preflight/README.md deleted file mode 100644 index 88a138a4c..000000000 --- a/mil_common/utils/mil_tools/scripts/mil-preflight/README.md +++ /dev/null @@ -1 +0,0 @@ -#Preflight diff --git a/mil_common/utils/mil_tools/scripts/mil-preflight/dist/mil_preflight-0.1.2-py3-none-any.whl b/mil_common/utils/mil_tools/scripts/mil-preflight/dist/mil_preflight-0.1.2-py3-none-any.whl deleted file mode 100644 index 0689d158c..000000000 Binary files a/mil_common/utils/mil_tools/scripts/mil-preflight/dist/mil_preflight-0.1.2-py3-none-any.whl and /dev/null differ diff --git a/mil_common/utils/mil_tools/scripts/mil-preflight/dist/mil_preflight-0.1.2.tar.gz b/mil_common/utils/mil_tools/scripts/mil-preflight/dist/mil_preflight-0.1.2.tar.gz deleted file mode 100644 index 1752f2d48..000000000 Binary files a/mil_common/utils/mil_tools/scripts/mil-preflight/dist/mil_preflight-0.1.2.tar.gz and /dev/null differ diff --git a/mil_common/utils/mil_tools/scripts/mil-preflight/mil_preflight/main.py b/mil_common/utils/mil_tools/scripts/mil-preflight/main.py similarity index 84% rename from mil_common/utils/mil_tools/scripts/mil-preflight/mil_preflight/main.py rename to mil_common/utils/mil_tools/scripts/mil-preflight/main.py index d33e751a8..4d773cb8a 100644 --- a/mil_common/utils/mil_tools/scripts/mil-preflight/mil_preflight/main.py +++ b/mil_common/utils/mil_tools/scripts/mil-preflight/main.py @@ -1,4 +1,5 @@ import subprocess +import time import rosnode import rospy @@ -8,6 +9,9 @@ from rich.console import Console from rich.progress import track +# Custom message imports +from subjugator_msgs.msg import ThrusterCmd + app = typer.Typer() @@ -79,7 +83,21 @@ def display_start_menu(): nodes = ["/odom_estimator"] -actuatorsList = {"/thrusters/thrust": ["FLH", 25.0]} +actuatorsList = [ + ( + "/thrusters/thrust", + [ + ThrusterCmd(name="FLH", thrust=60.0), + ThrusterCmd(name="FLV", thrust=60.0), + ThrusterCmd(name="FRH", thrust=60.0), + ThrusterCmd(name="FRV", thrust=60.0), + ThrusterCmd(name="BLH", thrust=60.0), + ThrusterCmd(name="BLV", thrust=60.0), + ThrusterCmd(name="BRH", thrust=60.0), + ThrusterCmd(name="BRV", thrust=60.0), + ], + ), +] @app.command("Start") @@ -160,26 +178,27 @@ def actuators(): "type": "confirm", "name": "runActuator", "message": "Are your sure you want to run " - + actuatorsList.keys[0] + + actuatorsList[0][0] + "? BE CAREFUL make sure everyone's fingures are secured.", }, ], ) topicType, topicStr, _ = rostopic.get_topic_class( - actuatorsList.keys[0], + actuatorsList[0][0], ) # get topic class + print(topicType) pub = rospy.Publisher(topicStr, topicType, queue_size=10) - rostopic.publish_message(pub, topicType, actuatorsList.values[0]) - + print(actuatorsList[0][1]) + t_end = time.time() + 5 + while time.time() < t_end: + pub.publish(actuatorsList[0][1]) answers.append( prompt( [ { "type": "confirm", "name": "worked?", - "message": "Did " - + actuatorsList.keys[0] - + " work as expected?", + "message": "Did " + actuatorsList[0][0] + " work as expected?", }, ], ), diff --git a/mil_common/utils/mil_tools/scripts/mil-preflight/mil_preflight/__init__.py b/mil_common/utils/mil_tools/scripts/mil-preflight/mil_preflight/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/mil_common/utils/mil_tools/scripts/mil-preflight/poetry.lock b/mil_common/utils/mil_tools/scripts/mil-preflight/poetry.lock deleted file mode 100644 index 11c22946c..000000000 --- a/mil_common/utils/mil_tools/scripts/mil-preflight/poetry.lock +++ /dev/null @@ -1,146 +0,0 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. - -[[package]] -name = "click" -version = "8.1.7" -description = "Composable command line interface toolkit" -optional = false -python-versions = ">=3.7" -files = [ - {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, - {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "platform_system == \"Windows\""} - -[[package]] -name = "colorama" -version = "0.4.6" -description = "Cross-platform colored terminal text." -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -files = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] - -[[package]] -name = "markdown-it-py" -version = "3.0.0" -description = "Python port of markdown-it. Markdown parsing, done right!" -optional = false -python-versions = ">=3.8" -files = [ - {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, - {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, -] - -[package.dependencies] -mdurl = ">=0.1,<1.0" - -[package.extras] -benchmarking = ["psutil", "pytest", "pytest-benchmark"] -code-style = ["pre-commit (>=3.0,<4.0)"] -compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] -linkify = ["linkify-it-py (>=1,<3)"] -plugins = ["mdit-py-plugins"] -profiling = ["gprof2dot"] -rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] -testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] - -[[package]] -name = "mdurl" -version = "0.1.2" -description = "Markdown URL utilities" -optional = false -python-versions = ">=3.7" -files = [ - {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, - {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, -] - -[[package]] -name = "pygments" -version = "2.17.2" -description = "Pygments is a syntax highlighting package written in Python." -optional = false -python-versions = ">=3.7" -files = [ - {file = "pygments-2.17.2-py3-none-any.whl", hash = "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c"}, - {file = "pygments-2.17.2.tar.gz", hash = "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367"}, -] - -[package.extras] -plugins = ["importlib-metadata"] -windows-terminal = ["colorama (>=0.4.6)"] - -[[package]] -name = "rich" -version = "13.7.0" -description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -optional = false -python-versions = ">=3.7.0" -files = [ - {file = "rich-13.7.0-py3-none-any.whl", hash = "sha256:6da14c108c4866ee9520bbffa71f6fe3962e193b7da68720583850cd4548e235"}, - {file = "rich-13.7.0.tar.gz", hash = "sha256:5cb5123b5cf9ee70584244246816e9114227e0b98ad9176eede6ad54bf5403fa"}, -] - -[package.dependencies] -markdown-it-py = ">=2.2.0" -pygments = ">=2.13.0,<3.0.0" -typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.9\""} - -[package.extras] -jupyter = ["ipywidgets (>=7.5.1,<9)"] - -[[package]] -name = "shellingham" -version = "1.5.4" -description = "Tool to Detect Surrounding Shell" -optional = false -python-versions = ">=3.7" -files = [ - {file = "shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686"}, - {file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"}, -] - -[[package]] -name = "typer" -version = "0.9.0" -description = "Typer, build great CLIs. Easy to code. Based on Python type hints." -optional = false -python-versions = ">=3.6" -files = [ - {file = "typer-0.9.0-py3-none-any.whl", hash = "sha256:5d96d986a21493606a358cae4461bd8cdf83cbf33a5aa950ae629ca3b51467ee"}, - {file = "typer-0.9.0.tar.gz", hash = "sha256:50922fd79aea2f4751a8e0408ff10d2662bd0c8bbfa84755a699f3bada2978b2"}, -] - -[package.dependencies] -click = ">=7.1.1,<9.0.0" -colorama = {version = ">=0.4.3,<0.5.0", optional = true, markers = "extra == \"all\""} -rich = {version = ">=10.11.0,<14.0.0", optional = true, markers = "extra == \"all\""} -shellingham = {version = ">=1.3.0,<2.0.0", optional = true, markers = "extra == \"all\""} -typing-extensions = ">=3.7.4.3" - -[package.extras] -all = ["colorama (>=0.4.3,<0.5.0)", "rich (>=10.11.0,<14.0.0)", "shellingham (>=1.3.0,<2.0.0)"] -dev = ["autoflake (>=1.3.1,<2.0.0)", "flake8 (>=3.8.3,<4.0.0)", "pre-commit (>=2.17.0,<3.0.0)"] -doc = ["cairosvg (>=2.5.2,<3.0.0)", "mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pillow (>=9.3.0,<10.0.0)"] -test = ["black (>=22.3.0,<23.0.0)", "coverage (>=6.2,<7.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.910)", "pytest (>=4.4.0,<8.0.0)", "pytest-cov (>=2.10.0,<5.0.0)", "pytest-sugar (>=0.9.4,<0.10.0)", "pytest-xdist (>=1.32.0,<4.0.0)", "rich (>=10.11.0,<14.0.0)", "shellingham (>=1.3.0,<2.0.0)"] - -[[package]] -name = "typing-extensions" -version = "4.9.0" -description = "Backported and Experimental Type Hints for Python 3.8+" -optional = false -python-versions = ">=3.8" -files = [ - {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, - {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, -] - -[metadata] -lock-version = "2.0" -python-versions = "^3.8" -content-hash = "7e4e54aaa562d12214312d56749ecc2f12e61a29eedb2de9b72dd3f0c48541ad" diff --git a/mil_common/utils/mil_tools/scripts/mil-preflight/pyproject.toml b/mil_common/utils/mil_tools/scripts/mil-preflight/pyproject.toml deleted file mode 100644 index 262030cba..000000000 --- a/mil_common/utils/mil_tools/scripts/mil-preflight/pyproject.toml +++ /dev/null @@ -1,17 +0,0 @@ -[tool.poetry] -name = "mil-preflight" -version = "0.1.2" -description = "" -authors = ["Anthony Liao ","Keith Khadar ","Joshua Thomas "] -readme = "README.md" - -[tool.poetry.dependencies] -python = "^3.8" -typer = {extras = ["all"], version = "^0.9.0"} - -[tool.poetry.scripts] -preflight = "mil_preflight.main:app" - -[build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" diff --git a/mil_common/utils/mil_tools/scripts/mil-preflight/tests/__init__.py b/mil_common/utils/mil_tools/scripts/mil-preflight/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/requirements.txt b/requirements.txt index d32a3e353..1a77082c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,7 +34,6 @@ sphinx-copybutton==0.5.0 # Terminal typer[all]==4.8.0 PyInquirer==1.0.3 -~/catkin_ws/src/mil/mil_common/utils/mil_tools/scripts/mil-preflight/dist/mil_preflight-0.1.2-py3-none-any.whl==0.1.2 # External Devices pyserial==3.5 diff --git a/scripts/setup.bash b/scripts/setup.bash index 97d54f7da..5e0bb5b04 100755 --- a/scripts/setup.bash +++ b/scripts/setup.bash @@ -89,6 +89,9 @@ alias fd="fdfind" # Gazebo aliases alias gazebogui="rosrun gazebo_ros gzclient __name:=gzclient" +# Preflight aliases +alias preflight='python3 $MIL_REPO/mil_common/utils/mil_tools/scripts/mil-preflight/main.py' + # Process killing aliases alias killgazebo="killall -9 gzserver && killall -9 gzclient" alias killros='$MIL_REPO/scripts/kill_ros.sh'