Skip to content

Commit

Permalink
Fix actuators and switched to alias instead of pip package
Browse files Browse the repository at this point in the history
  • Loading branch information
keithmk authored and keithmk committed Feb 7, 2024
1 parent 871984e commit 51be3b6
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 173 deletions.
1 change: 0 additions & 1 deletion mil_common/utils/mil_tools/scripts/mil-preflight/README.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import subprocess
import time

import rosnode
import rospy
Expand All @@ -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()


Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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?",
},
],
),
Expand Down
Empty file.
146 changes: 0 additions & 146 deletions mil_common/utils/mil_tools/scripts/mil-preflight/poetry.lock

This file was deleted.

17 changes: 0 additions & 17 deletions mil_common/utils/mil_tools/scripts/mil-preflight/pyproject.toml

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions scripts/setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 51be3b6

Please sign in to comment.