-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.zshrc_mt
194 lines (158 loc) · 4.5 KB
/
.zshrc_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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/usr/bin/zsh
autoload -U colors && colors
#aliases
if [[ -f "${HOME}/.aliases_mt" ]];then
source "${HOME}/.aliases_mt"
fi
# Helper function to change to git dir
ccd() {
cd "${HOME}/workspace/mtr_sys/${1:-develop}/mtrsys-core"
}
cdmtrsys() {
cd "${HOME}/workspace/mtrsys-core.git/${1:-develop}"
}
# Helper function to change to a particular build directory
cdbuild() {
ccd $1 && cd build
}
# Helper function to change to a particular source directory
cdsrc() {
ccd $1 && cd src
}
function sourceros(){
echo -n "$fg[cyan]"
echo "sourcing ros"
source /opt/ros/melodic/setup.zsh
#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.zsh" ]]; then
echo "sourcing ros_ws"
source "$HOME/workspace/ros_ws/devel/setup.zsh"
fi
alias tf='cd /var/tmp && rosrun tf view_frames && evince frames.pdf &'
echo -n "$reset_color"
}
# source ros automatically if present
if [[ -f "/opt/ros/melodic/setup.zsh" ]]; then
sourceros
fi
function sourceros2(){
export MT_ROS_VERSION=galactic
echo -n "$fg[cyan]"
echo "sourcing ros2: ${MT_ROS_VERSION}"
source "/opt/ros/${MT_ROS_VERSION}/setup.zsh"
source "${HOME}/workspace/ros2_connextdds/install/setup.zsh"
export UNITR_MODEL="a1"
export ROS_DOMAIN_ID=1
if [[ -f "$HOME/src/ros2_ws/install/setup.zsh" ]]; then
echo "sourcing ros2_ws"
source $HOME/src/ros2_ws/install/setup.zsh
fi
if [[ -f "$HOME/src/ros2_connextdds/install/setup.zsh" ]]; then
echo "sourcing ros2_connextdds"
source "$HOME/src/ros2_connextdds/install/setup.zsh"
echo "setting RMW_IMPLEMENTATION=rmw_connextdds"
export RMW_IMPLEMENTATION=rmw_connextdds
else
echo "WARNING: rmw_connextdds is not available. Make sure to build it!"
fi
echo -n "$reset_color"
}
function sourcerti(){
source "/opt/rti_connext_dds-6.1.0/resource/scripts/rtisetenv_x64Linux4gcc7.3.0.zsh"
}
if [[ -f "/opt/ros/galactic/setup.zsh" ]]; then
sourceros2
fi
#
# ccache
if [[ -n "$SCHROOT_GID" ]];then
export PATH=/usr/lib/ccache:$PATH
export CC="ccache gcc"
export CXX="ccache g++"
export CCACHE_BASEDIR="/home/beat/workspace/mtr_sys"
export DISPLAY=:0
fi
#
# distcc
#export CCACHE_PREFIX="distcc"
#
# Aliases
alias ubuntu20='schroot -c mt_ubuntu20'
alias ubuntu18='schroot -c mt_ubuntu18'
alias debian='schroot -c mt_jessie'
alias make='export CCACHE_BASEDIR=$(pwd); echo "Set CCACHE_BASEDIR ${CCACHE_BASEDIR} -- Building with -j16"; make -j16'
alias sourcews='source ./install/setup.zsh'
__make() {
filename="/tmp/nvim_quickfix.log"
cd build && schroot -c chroot:mt_ubuntu18 -- make "$@" |& tee "$filename"
}
# navigation aliases
alias cdws='cd $HOME/workspace'
alias cdros='cdws && cd ros2_ws'
alias cdmtr='cdws && cd mtr_sys'
# add rti tools to path if present
if [[ -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
}
sshv ()
{
declare -r arg="$1";
local disp="0";
[[ -z "$arg" ]] && echo "usage: mssh <host>" && return 1;
local server="${arg}";
[[ ! -z "${2-}" ]] && disp="$2";
ssh -t -f -L 5900:localhost:5900 "mtr@$server" "x11vnc -auth guess -localhost -display :$disp" &> /dev/null;
sleep 2;
vncviewer localhost:5900
}
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
}
nugetPushIDLStorageV ()
{
if [[ -z "${1-}" ]]; then
echo "usage: nugetPushIDLStorageV: <version>" 1>&2;
return 1;
fi;
nuget push "MTRobot.UCC.Data.IDLStorage*$1*.nupkg" -Source http://ms-build.mt/nuget -apiKey '5a742973-dd02-464c-9da0-52ded9e74a8b'
}
nugetList() {
nuget list IDLStorage -source http://ms-build.mt/nuget -AllVersions -PreRelease
}
nugetDelete() {
nuget delete MTRobot.UCC.Data.IDLStorage $1 -Source "C:\NugetRepository"
}
############
# Simulation
############
rungazebo()
{
xhost +local:;
schroot -c mt_ubuntu20 /usr/bin/zsh -- -ic ' \
export QT_AUTO_SCREEN_SCALE_FACTOR=1 && \
sourceros2 && \
ros2 launch unitr_ignition unitr_world.launch.py world:="showroom_1unitr.sdf -v 4"'
}