Skip to content

Commit

Permalink
Fix connect-smb shell alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
Huoleit committed Jun 29, 2024
1 parent 3a11436 commit 862fbe9
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .devcontainer/setup_alias.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
ROOT=$1

setup_alias_in_zsh() {
echo "alias \"$1\"=\"$2\"" >> ~/.zshrc
echo "alias '$1'='$2'" >> ~/.zshrc
}

setup_alias_in_bash() {
echo "alias \"$1\"=\"$2\"" >> ~/.bashrc
echo "alias '$1'='$2'" >> ~/.bashrc
}

setup_alias_in_shell() {
Expand All @@ -23,7 +23,25 @@ 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
setup_alias_in_shell "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"
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

# Catkin build memory & job limit
setup_alias_in_shell "build-limit" "catkin build --jobs 8 --mem-limit 70%"

0 comments on commit 862fbe9

Please sign in to comment.