This repository has been archived by the owner on Aug 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createRttbashrc.js
78 lines (64 loc) · 2.41 KB
/
createRttbashrc.js
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
const path = require('path');
function create(settings){
return `
source /opt/ros/melodic/setup.bash
# Export RTT_ROOT, indicating the root of the RoboTeam Twente folder
export RTT_ROOT=${settings.RTT_ROOT}
# Set languages for which ROS messages do NOT have to be generated. Enabled: gencpp gennodejs genpy
export ROS_LANG_DISABLE=genlisp:geneus
# Set formatting for ROS logging
export ROSCONSOLE_FORMAT='[\${severity}][\${logger}]: \${message}'
# Set the path for rosconsole.config, which defines ROS logging levels
export ROSCONSOLE_CONFIG_FILE=${path.join(settings.RTT_ROOT, 'rosconsole.config')}
# source the setup for the workspace
source ${path.join(settings.RTT_ROOT, 'workspace', 'devel', 'setup.bash')}
# locales for grsim
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
function rtt_build() {
(
# cd directly to the workspace where the repos are located
cd ${path.join(settings.RTT_ROOT, 'workspace')}
# run the command
source ${path.join(settings.RTT_ROOT, 'devel', 'setup.sh')}; eval $1
# Check if command succeeded
if [ $? -eq 0 ]; then
notify-send -u critical -i ${path.join(settings.RTT_ROOT, 'thumbsup.jpg')} "Compilation message" "Compilation succeeded!"
else
notify-send -u critical -i ${path.join(settings.RTT_ROOT, 'thumbsdown.jpg')} "Compilation message" "Compilation failed!"
fi
)
}
alias rtt="cd ${settings.RTT_ROOT}"
alias rtt_make="rtt_build catkin_make"
alias rtt_nuke="rtt_build \\"catkin_make clean && catkin_make\\""
alias TestX="rosrun roboteam_tactics TestX"
alias rosrung="rosrun --prefix \\"gdb --args\\""
printf "\\n[rtt_bashrc] RTT_ROOT=${settings.RTT_ROOT} | setting aliases rtt, rtt_make, rtt_nuke, TestX, rosrung\\n"
_GetTestXOptions () {
local cur prev words cword
_init_completion || return
COMPREPLY=()
local words=$(TestX show all | grep -E ".?- .?$" | sed -E "s/.?- (.?)$/\\1/" )
COMPREPLY=( $( compgen -W '\${words}' -- "$cur") )
return 0
}
complete -F _GetTestXOptions TestX
switchSides () {
side="$(rosparam get our_side)"
if [ "$side" = "left" ]; then
rosparam set our_side right
printf "Switched to right side"
elif [ "$side" = "right" ]; then
rosparam set our_side left
printf "Switched to left side"
else
printf "Could not switch sides"
fi
printf "\\n"
}
`}
module.exports = {
create
}