Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 48 additions & 7 deletions .devcontainer/setup_alias.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,61 @@ 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+')
# 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-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-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+')
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
Expand Down