-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bashrc_mt
146 lines (120 loc) · 3.4 KB
/
.bashrc_mt
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/bash
# TODO fix these colors, they pollute all sorts of stuff
# source "$HOME/.scripts/log.bash"
workspace="${HOME}/workspace"
mtr_bash_utils="${workspace}/bash/mtr_utils.bash"
if [[ -f ${mtr_bash_utils} ]]; then
# shellcheck source=/home/beat/workspace/bash/mtr_utils.bash
. "${mtr_bash_utils}"
fi
#aliases
if [[ -f "${HOME}/.aliases_mt" ]]; then
source "${HOME}/.aliases_mt"
fi
# Helper function to change to git dir
ccd() {
cd "$workspace/mtrsys/${1:-develop}/" || return 1
}
cducc() {
cd "$workspace/ucc/${1:-development}" || return 1
}
cdclient() {
cd "$workspace/ucc/${1-development}/src/MTRobot.UCC/src/MTRobot.UCC.Presentation.Web/ucc-client" || exit
}
# Helper function to change to a particular build directory
cdbuild() {
ccd "$1" && cd build || return 1
}
# Helper function to change to a particular source directory
cdsrc() {
if [[ -z "$1" ]];then
cd "$HOME/src"
else
ccd "$1" && cd src || return 1
fi
}
# submodule navigation helper
cds() {
cd "$1" || return 1
}
_cds() {
COMPREPLY=()
cur=${COMP_WORDS[$COMP_CWORD]}
declare -a submdodules
submodules="$(git submodule 2>/dev/null | awk '{print $2}' | grep "^$cur" || echo '')"
COMPREPLY=($(compgen -W '$submodules' -- ''))
}
complete -F _cds cds
sourceros() {
echo "sourcing ros"
source /opt/ros/melodic/setup.bash
#echo "setting ROS_MASTER_URI=http:10.0.52.114:11311/"
#export ROS_MASTER_URI=http://10.0.52.114:11311/
#export ROS_IP=10.0.20.244
export TURTLEBOT3_MODEL=burger
if [[ -f "$HOME/workspace/ros_ws/devel/setup.bash" ]]; then
echo "sourcing ros_ws"
source "$HOME/workspace/ros_ws/devel/setup.bash"
fi
alias tf='cd /var/tmp && rosrun tf view_frames && evince frames.pdf &'
}
# source ros automatically if present
if [[ -f "/opt/ros/melodic/setup.bash" ]]; then
sourceros
fi
sourcerti6() {
echo "sourcing rti_connext_dds-6.1.0"
source "/opt/rti_connext_dds-6.1.0/resource/scripts/rtisetenv_x64Linux4gcc7.3.0.bash"
}
sourcerti7() {
echo "sourcing rti_connext_dds-7.0.0"
source "/opt/rti_connext_dds-7.0.0/resource/scripts/rtisetenv_x64Linux4gcc7.3.0.bash"
}
#
# ccache
if [[ "${SCHROOT_CHROOT_NAME-}" == "ub22" ]]; then
export PATH=/usr/lib/ccache:$PATH
export CC="ccache clang-17"
export CXX="ccache clang++-17"
export CCACHE_DIR="${HOME}/.ccache_ub22"
export CCACHE_SLOPPINESS="pch_defines,time_macros,include_file_ctime,include_file_mtime"
fi
__make() {
filename="/tmp/nvim_quickfix.log"
cd build && schroot -c chroot:mt_ubuntu18 -- make "$@" |& tee "$filename"
}
# add RTI tools to path if present
if [[ -d "/opt/rti_connext_dds-7.0.0/bin" ]]; then
export PATH="/opt/rti_connext_dds-7.0.0/bin:$PATH"
elif [[ -d "/opt/rti_connext_dds-6.1.0/bin" ]]; then
export PATH="/opt/rti_connext_dds-6.1.0/bin:$PATH"
fi
cleanws() {
if [[ -d "build" && -d "install" && -d "log" ]]; then
rm -rf build install log
fi
}
sshr() {
ssh -X "mtr@robot-$1.mt"
}
sshm() {
ssh "mtr@ms-$1.mt"
}
mt-rti-spy() {
mt-spy -topicRegex "$1" -printSample
}
####################
# UCC functionality
####################
cleanbuild() {
dotnet nuget locals all -c # when nuget package changed with the same version, generally unneeded
dotnet restore
dotnet clean # generally unneeded
dotnet build
}
vncpi() {
ssh -t -f -L 5900:localhost:5900 "pi2" "x11vnc -auth guess -localhost -display :0" &> /dev/null
sleep 2
vncviewer localhost:5900
}
export SIMULATION_CONFIG="$HOME/sim_config.xml"