-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathbashrc_ext
More file actions
56 lines (48 loc) · 1.95 KB
/
bashrc_ext
File metadata and controls
56 lines (48 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
ros_env_setup="/opt/ros/$ROS_DISTRO/setup.bash"
echo "sourcing $ros_env_setup"
source "$ros_env_setup"
source "/home/$USER/catkin_ws/devel/setup.bash"
alias sauce='source /opt/ros/noetic/setup.bash && source /home/${USER}/catkin_ws/devel/setup.bash'
alias scripz='cd /home/${USER}/catkin_ws/src/race_stack/stack_master/scripts'
alias switch_map='/home/${USER}/catkin_ws/src/race_stack/stack_master/scripts/switch_map.sh $1'
echo "ROS_ROOT $ROS_ROOT"
echo "ROS_DISTRO $ROS_DISTRO"
# automatically get zerotier IP. Be careful! it does not work if do not have an ip assigned with the correct prefix, "192.168.192" in this case, and it might not work if you have multiple ips with the same prefix
# export ROS_HOSTNAME=$( ifconfig | awk '/inet 192.168.192/ {print $2}' )
# check if ros hostname is empty
if [ -z "$ROS_HOSTNAME" ]; then
echo "ROS_HOSTNAME is empty, setting it to default"
export ROS_HOSTNAME=localhost
fi
export ROS_MASTER_URI="http://${ROS_HOSTNAME}:11311"
connect() {
local mode=$1
local ip=$2
if [[ -z "$ip" ]]; then
echo "Usage: connect {ssh|dssh} <ip_address>"
return 1
fi
case "$mode" in
ssh)
ssh -XC "$ip"
;;
dssh)
ssh -t -XC "$ip" " \
display_remote=\$DISPLAY; \
new_display=\$(echo \$DISPLAY | sed 's/\\.0\$//'); \
cookie=\$(xauth list \$DISPLAY | head -n1 | awk '{print \$3}'); \
echo \"Using display \$new_display with cookie \$cookie\"; \
docker exec -e DISPLAY=\$new_display -e NEW_DISPLAY=\$new_display -e COOKIE=\$cookie -it forzaeth_devcontainer /bin/bash -c ' \
cp /tmp/.Xauthority /tmp/.Xauthority-local && \
export XAUTHORITY=/tmp/.Xauthority-local && \
xauth add \$NEW_DISPLAY MIT-MAGIC-COOKIE-1 \$COOKIE 2>/dev/null && \
exec bash'"
;;
*)
echo "Usage: connect {ssh|dssh} <user@ip_address_of_the_car>"
return 1
;;
esac
}
alias sshcar='connect ssh'
alias dsshcar='connect dssh'