-
Notifications
You must be signed in to change notification settings - Fork 19
/
setup.bash
41 lines (33 loc) · 1.33 KB
/
setup.bash
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
setup_script_own_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
# Load RosTeamWS defines
source $setup_script_own_dir/scripts/_RosTeamWs_Defines.bash
# setup default versions and paths for rtw
set_supported_versions
set_framework_default_paths
# Get color definitions
RosTeamWS_setup_exports
# Load Team defines
source $setup_script_own_dir/scripts/_Team_Defines.bash
# Load Docker defines
source $setup_script_own_dir/scripts/_RosTeamWs_Docker_Defines.bash
# Set main path where source.bash is defined
RosTeamWS_FRAMEWORK_MAIN_PATH="$(RosTeamWS_script_own_dir)/../"
# Source autocompletion for rtwcli
source $setup_script_own_dir/rtwcli/rtwcli/completion/rtw-argcomplete.bash
# rtwcli: export ros workspace variables if chosen (rtw workspace use)
export ROS_WS_CACHE_SOURCED_TIME=0
function update_ros_ws_variables {
local file_name="/tmp/ros_team_workspace/workspace_$$.bash"
if [[ -f $file_name ]]; then # If file exists
local file_mod_time
file_mod_time=$(stat -c %Y $file_name)
# If file was modified after the last source operation
if ((file_mod_time > ROS_WS_CACHE_SOURCED_TIME)); then
source "$file_name"
ROS_WS_CACHE_SOURCED_TIME=$file_mod_time
export ROS_WS_CACHE_SOURCED_TIME
fi
fi
}
# run this command before every prompt, similar to PS1 variable
PROMPT_COMMAND=update_ros_ws_variables