draft distributed system #62
Draft
shb-png wants to merge 17 commits into
Draft
Conversation
ecf42ea to
f500b48
Compare
a6517a9 to
ed2cf21
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces the scaffolding for a distributed kart system that splits the ROS 2 stack between a Jetson (sensors/perception) and a Rubik (metrics + master API). It adds dedicated launch files per device, opens ROS discovery beyond localhost, and exposes new HTTP endpoints on the master API to remotely update/restart the Jetson over SSH.
Changes:
- New
bringup_jetson.launch.py,bringup_rubik.launch.py, andbringup_all.launch.pyplus aTARGET_DEVICE-awarestart.bash. - New
MasterNode.restart_jetson()/update_jetson()that shell out tosshand corresponding/jetson/restartand/jetson/updateFlask endpoints. - Networking/config updates:
ROS_LOCALHOST_ONLY=0in compose/devcontainer,openssh-clientadded to the Docker image, and newjetson_ip/jetson_usernameparams insystem.yaml.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/autonomous_kart/autonomous_kart/params/system.yaml | Adds jetson_ip and jetson_username params used for SSH targeting. |
| src/autonomous_kart/autonomous_kart/nodes/master/master_node.py | Adds restart_jetson / update_jetson shelling out via ssh -t. |
| src/autonomous_kart/autonomous_kart/nodes/master/master_api.py | New unauthenticated POST endpoints /jetson/restart and /jetson/update. |
| src/autonomous_kart/autonomous_kart/launch/bringup_rubik.launch.py | New launch file: metrics + master_api on Rubik. |
| src/autonomous_kart/autonomous_kart/launch/bringup_jetson.launch.py | New launch file: sensor/perception/master nodes on Jetson. |
| src/autonomous_kart/autonomous_kart/launch/bringup_all.launch.py | Combined launch file; passes imu_yaml to master_api (likely copy/paste). |
| scripts/start.bash | Branches on TARGET_DEVICE; missing fi makes the script invalid. |
| docker/Dockerfile | Adds openssh-client for outbound SSH. |
| compose/docker-compose.yml | Sets ROS_LOCALHOST_ONLY=0, hardcodes TARGET_DEVICE=jetson. |
| .gitignore | Ignores logs/ and kart_logs/. |
| .devcontainer/devcontainer.json | Sets ROS_LOCALHOST_ONLY=0 for devcontainers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+337
to
+379
| # pull latest code, rebuild container, and restart bringup on jetson | ||
| def restart_jetson(self): | ||
| with self._lock: | ||
| remote_command = ( | ||
| "bash ~/run_remote.sh --update" | ||
| ) | ||
|
|
||
| ssh_command = [ | ||
| "ssh", | ||
| "-t", | ||
| f"{self.jetson_user}@{self.jetson_ip}", | ||
| remote_command, | ||
| ] | ||
|
|
||
| self.logger.info("Rebuilding Jetson container and pulling latest code...") | ||
|
|
||
| subprocess.Popen(ssh_command) | ||
|
|
||
| # only pull latest code, dont rebuild container | ||
| def update_jetson(self): | ||
| with self._lock: | ||
| remote_command = ( | ||
| "cd ~/AutonomousKart && " | ||
| "git pull && " | ||
| "docker exec ros2-dev bash -lc '" | ||
| "source /opt/ros/humble/setup.bash && " | ||
| "cd /ws && " | ||
| "colcon build && " | ||
| "source install/setup.bash && " | ||
| "ros2 launch autonomous_kart bringup_jetson.launch.py" | ||
| "'" | ||
| ) | ||
|
|
||
| ssh_command = [ | ||
| "ssh", | ||
| "-t", | ||
| f"{self.jetson_user}@{self.jetson_ip}", | ||
| remote_command, | ||
| ] | ||
|
|
||
| self.logger.info("Starting Jetson and pulling latest code...") | ||
|
|
||
| subprocess.Popen(ssh_command) |
Comment on lines
+344
to
+375
| ssh_command = [ | ||
| "ssh", | ||
| "-t", | ||
| f"{self.jetson_user}@{self.jetson_ip}", | ||
| remote_command, | ||
| ] | ||
|
|
||
| self.logger.info("Rebuilding Jetson container and pulling latest code...") | ||
|
|
||
| subprocess.Popen(ssh_command) | ||
|
|
||
| # only pull latest code, dont rebuild container | ||
| def update_jetson(self): | ||
| with self._lock: | ||
| remote_command = ( | ||
| "cd ~/AutonomousKart && " | ||
| "git pull && " | ||
| "docker exec ros2-dev bash -lc '" | ||
| "source /opt/ros/humble/setup.bash && " | ||
| "cd /ws && " | ||
| "colcon build && " | ||
| "source install/setup.bash && " | ||
| "ros2 launch autonomous_kart bringup_jetson.launch.py" | ||
| "'" | ||
| ) | ||
|
|
||
| ssh_command = [ | ||
| "ssh", | ||
| "-t", | ||
| f"{self.jetson_user}@{self.jetson_ip}", | ||
| remote_command, | ||
| ] |
Comment on lines
+353
to
+379
| subprocess.Popen(ssh_command) | ||
|
|
||
| # only pull latest code, dont rebuild container | ||
| def update_jetson(self): | ||
| with self._lock: | ||
| remote_command = ( | ||
| "cd ~/AutonomousKart && " | ||
| "git pull && " | ||
| "docker exec ros2-dev bash -lc '" | ||
| "source /opt/ros/humble/setup.bash && " | ||
| "cd /ws && " | ||
| "colcon build && " | ||
| "source install/setup.bash && " | ||
| "ros2 launch autonomous_kart bringup_jetson.launch.py" | ||
| "'" | ||
| ) | ||
|
|
||
| ssh_command = [ | ||
| "ssh", | ||
| "-t", | ||
| f"{self.jetson_user}@{self.jetson_ip}", | ||
| remote_command, | ||
| ] | ||
|
|
||
| self.logger.info("Starting Jetson and pulling latest code...") | ||
|
|
||
| subprocess.Popen(ssh_command) |
Comment on lines
+339
to
+379
| with self._lock: | ||
| remote_command = ( | ||
| "bash ~/run_remote.sh --update" | ||
| ) | ||
|
|
||
| ssh_command = [ | ||
| "ssh", | ||
| "-t", | ||
| f"{self.jetson_user}@{self.jetson_ip}", | ||
| remote_command, | ||
| ] | ||
|
|
||
| self.logger.info("Rebuilding Jetson container and pulling latest code...") | ||
|
|
||
| subprocess.Popen(ssh_command) | ||
|
|
||
| # only pull latest code, dont rebuild container | ||
| def update_jetson(self): | ||
| with self._lock: | ||
| remote_command = ( | ||
| "cd ~/AutonomousKart && " | ||
| "git pull && " | ||
| "docker exec ros2-dev bash -lc '" | ||
| "source /opt/ros/humble/setup.bash && " | ||
| "cd /ws && " | ||
| "colcon build && " | ||
| "source install/setup.bash && " | ||
| "ros2 launch autonomous_kart bringup_jetson.launch.py" | ||
| "'" | ||
| ) | ||
|
|
||
| ssh_command = [ | ||
| "ssh", | ||
| "-t", | ||
| f"{self.jetson_user}@{self.jetson_ip}", | ||
| remote_command, | ||
| ] | ||
|
|
||
| self.logger.info("Starting Jetson and pulling latest code...") | ||
|
|
||
| subprocess.Popen(ssh_command) |
| system_frequency: 60 # Speed of hot loop (Hertz) | ||
| line_path: "/ws/data/racing_line/line14.csv" | ||
| jetson_ip: "evc-jetson.tail73145c.ts.net" | ||
| jetson_username: "evc" No newline at end of file |
Comment on lines
+340
to
+342
| remote_command = ( | ||
| "bash ~/run_remote.sh --update" | ||
| ) |
| - ROS_DISTRO=humble | ||
| - ROS_DOMAIN_ID=42 | ||
| - ROS_LOCALHOST_ONLY=1 | ||
| - ROS_LOCALHOST_ONLY=0 |
| - ROS_DOMAIN_ID=42 | ||
| - ROS_LOCALHOST_ONLY=1 | ||
| - ROS_LOCALHOST_ONLY=0 | ||
| - TARGET_DEVICE=jetson # set target device for build (ex: jetson, rubik) |
|
|
||
| subprocess.Popen(ssh_command) | ||
|
|
||
| # only pull latest code, dont rebuild container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.