From 8b294f97ef8f05f5295c0daf9da07ab561be0472 Mon Sep 17 00:00:00 2001 From: Deepana Ishtaweera Date: Sun, 30 Jun 2024 15:09:53 +0000 Subject: [PATCH 1/2] add aliases for smb_connect --- .devcontainer/setup_alias.sh | 40 +++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/.devcontainer/setup_alias.sh b/.devcontainer/setup_alias.sh index 8cd78a8..c3dd8ff 100644 --- a/.devcontainer/setup_alias.sh +++ b/.devcontainer/setup_alias.sh @@ -23,24 +23,32 @@ setup_alias_in_bash "wssetup" "source ${ROOT}/devel/setup.bash" ## It will automatically set ROS_MASTER_URI to the IP address of the SMB NUC and ROS_IP to the IP address of the host machine ## based on the default gateway IP address (the IP address of the router on the SMB) ## Note: The ip address of every SMB is 10.0.x.5 where x is the last digit of SMB Robot Number. Example: For SMB 261 the on-board computer IP address is 10.0.1.5 -cat <<'EOF' >> ~/.bashrc -connect-smb() { - export ROS_MASTER_URI=http://$(ip route show default | grep -oP 'via \K\d+\.\d+\.\d+').5:11311 - export ROS_IP=$(ip route get 8.8.8.8 | grep -oP '(?<=src )\S+') - echo 'ROS_MASTER_URI and ROS_IP set to ' - printenv ROS_MASTER_URI - printenv ROS_IP -} -EOF +# cat <<'EOF' >> ~/.bashrc +# connect-smb() { +# export ROS_MASTER_URI=http://$(ip route show default | grep -oP 'via \K\d+\.\d+\.\d+').5:11311 +# export ROS_IP=$(ip route get 8.8.8.8 | grep -oP '(?<=src )\S+') +# echo 'ROS_MASTER_URI and ROS_IP set to ' +# printenv ROS_MASTER_URI +# printenv ROS_IP +# } +# EOF +# cat <<'EOF' >> ~/.zshrc +# connect-smb() { +# export ROS_MASTER_URI=http://$(ip route show default | grep -oP 'via \K\d+\.\d+\.\d+').5:11311 +# export ROS_IP=$(ip route get 8.8.8.8 | grep -oP '(?<=src )\S+') +# echo 'ROS_MASTER_URI and ROS_IP set to ' +# printenv ROS_MASTER_URI +# printenv ROS_IP +# } +# EOF + +# Aliases for ROS_MASTER_URI and ROS_IP for connecting to SMB cat <<'EOF' >> ~/.zshrc -connect-smb() { - export ROS_MASTER_URI=http://$(ip route show default | grep -oP 'via \K\d+\.\d+\.\d+').5:11311 - export ROS_IP=$(ip route get 8.8.8.8 | grep -oP '(?<=src )\S+') - echo 'ROS_MASTER_URI and ROS_IP set to ' - printenv ROS_MASTER_URI - printenv ROS_IP -} +alias connect-smb261="export ROS_MASTER_URI=http://10.0.1.5:11311 && export ROS_IP=\$(hostname -I | awk '{print \$1}')" +alias connect-smb262="export ROS_MASTER_URI=http://10.0.2.5:11311 && export ROS_IP=\$(hostname -I | awk '{print \$1}')" +alias connect-smb263="export ROS_MASTER_URI=http://10.0.3.5:11311 && export ROS_IP=\$(hostname -I | awk '{print \$1}')" +alias connect-smb264="export ROS_MASTER_URI=http://10.0.4.5:11311 && export ROS_IP=\$(hostname -I | awk '{print \$1}')" EOF # Catkin build memory & job limit From 0f79e7b6df04feddb9d480f38da6c8f00cf6c65d Mon Sep 17 00:00:00 2001 From: Fu Zhengyu Date: Sun, 30 Jun 2024 16:05:01 +0000 Subject: [PATCH 2/2] change alias to function --- .devcontainer/setup_alias.sh | 41 ++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/.devcontainer/setup_alias.sh b/.devcontainer/setup_alias.sh index c3dd8ff..c03386f 100644 --- a/.devcontainer/setup_alias.sh +++ b/.devcontainer/setup_alias.sh @@ -45,10 +45,43 @@ setup_alias_in_bash "wssetup" "source ${ROOT}/devel/setup.bash" # Aliases for ROS_MASTER_URI and ROS_IP for connecting to SMB cat <<'EOF' >> ~/.zshrc -alias connect-smb261="export ROS_MASTER_URI=http://10.0.1.5:11311 && export ROS_IP=\$(hostname -I | awk '{print \$1}')" -alias connect-smb262="export ROS_MASTER_URI=http://10.0.2.5:11311 && export ROS_IP=\$(hostname -I | awk '{print \$1}')" -alias connect-smb263="export ROS_MASTER_URI=http://10.0.3.5:11311 && export ROS_IP=\$(hostname -I | awk '{print \$1}')" -alias connect-smb264="export ROS_MASTER_URI=http://10.0.4.5:11311 && export ROS_IP=\$(hostname -I | awk '{print \$1}')" +connect-smb261() { + export ROS_MASTER_URI=http://10.0.1.5:11311 + export ROS_IP=$(hostname -I | awk '{print $1}') + echo 'ROS_MASTER_URI and ROS_IP set to ' + printenv ROS_MASTER_URI + printenv ROS_IP +} +EOF + +cat <<'EOF' >> ~/.zshrc +connect-smb262() { + export ROS_MASTER_URI=http://10.0.2.5:11311 + export ROS_IP=$(hostname -I | awk '{print $1}') + echo 'ROS_MASTER_URI and ROS_IP set to ' + printenv ROS_MASTER_URI + printenv ROS_IP +} +EOF + +cat <<'EOF' >> ~/.zshrc +connect-smb263() { + export ROS_MASTER_URI=http://10.0.3.5:11311 + export ROS_IP=$(hostname -I | awk '{print $1}') + echo 'ROS_MASTER_URI and ROS_IP set to ' + printenv ROS_MASTER_URI + printenv ROS_IP +} +EOF + +cat <<'EOF' >> ~/.zshrc +connect-smb264() { + export ROS_MASTER_URI=http://10.0.4.5:11311 + export ROS_IP=$(hostname -I | awk '{print $1}') + echo 'ROS_MASTER_URI and ROS_IP set to ' + printenv ROS_MASTER_URI + printenv ROS_IP +} EOF # Catkin build memory & job limit