Skip to content

Commit

Permalink
Adding -u flag to specify the user when doing the scp to the server. …
Browse files Browse the repository at this point in the history
…Updating the corresponding doc to indicate that you need to have your ssh key on the server.
  • Loading branch information
teiszler committed Dec 1, 2023
1 parent 2be9731 commit d107302
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cnc/python_client/commander_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def main():
help='Specify address of Steel Eagle CNC server [default: localhost')
parser.add_argument('-p', '--port', default='9099', help='Specify websocket port [default: 9099]')
parser.add_argument('-l', '--loglevel', default='INFO', help='Set the log level')
parser.add_argument('-ng', '--nogui', action='store_true', help='If specified, use the text prompt commander')
parser.add_argument('-ng', '--nogui', action='store_true', help='If specified, use the text prompt commander')
parser.add_argument('-u', '--user', default='root', help='Specify the user when copying .ms files to the server. [default: root] NOTE: An ssh key for this user must exist on the server.')

args = parser.parse_args()
logging.basicConfig(format="%(levelname)s: %(message)s", level=args.loglevel)
Expand All @@ -44,7 +45,7 @@ def main():

def start_ui_thread(funcs, funcSet):
UI = GUICommanderAdapter() # Must initialize the UI in the thread in which it will run
UI.set_up_adapter(preprocess, DEFAULT_SOURCE_NAME, COMMANDER_ID, args.server)
UI.set_up_adapter(preprocess, DEFAULT_SOURCE_NAME, COMMANDER_ID, args.server, args.user)
funcs.append(UI.get_producer_wrappers())
funcs.append(UI.consumer)
funcSet.set()
Expand Down
5 changes: 3 additions & 2 deletions cnc/python_client/gui_commander_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def on_fly_mission_pressed(self, event=None):
self.button_kill.configure(state=tkinter.NORMAL)
self.button_rth.configure(state=tkinter.NORMAL)
self.toggle_manual(False)
SCP_URL = f"root@{self.server}:/home/ubuntu/steel-eagle/cnc/server/openscout-vol/scripts/" + filename
SCP_URL = f"{self.user}@{self.server}:~/steeleagle/cnc/server/openscout-vol/scripts/" + filename
FLIGHT_URL = f"http://{self.server}:8080/scripts/" + filename
try:
subprocess.run(["scp", filepath, SCP_URL], check=True)
Expand Down Expand Up @@ -399,12 +399,13 @@ def axis(self, left, right):

# Gabriel

def set_up_adapter(self, preprocess, source_name, id, server):
def set_up_adapter(self, preprocess, source_name, id, server, user):
self.id = id
self._preprocess = preprocess
self._source_name = source_name
self.frames_processed = 0
self.server = server
self.user = user

def get_producer_wrappers(self):
async def producer():
Expand Down
5 changes: 5 additions & 0 deletions docs/modules/commander.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ optional arguments:
-l LOGLEVEL, --loglevel LOGLEVEL
Set the log level
-ng, --nogui If specified, use the text prompt commander
-u, --user Specify the user when copying .ms files to the server. [default: root] NOTE: An ssh key for this user must exist on the server.
```

At a minimum, you will need to provide the commander with the address of the machine where the CNC backend is running.

{: .important }

Ensure that the ssh key of the user running the commander is placed into the server's authorized_keys file. If the key is not present, the scp of any flightscript will prompt for authentication in the terminal. `ssh-copy-id user@host` can be used to push the ssh key from the location where the commander is being run.

### Layout/Usage

![Commander Layout!](images/commander_layout.png)
Expand Down

0 comments on commit d107302

Please sign in to comment.