repo_id
stringlengths
19
138
file_path
stringlengths
32
200
content
stringlengths
1
12.9M
__index_level_0__
int64
0
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/adolc/adolc.BUILD
load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) cc_library( name = "adolc", includes = ["."], linkopts = [ "-ladolc", ], )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/adolc/cyberfile.xml
<package format="2"> <name>3rd-adolc</name> <version>local</version> <description> Apollo packaged adolc Lib. </description> <maintainer email="apollo-support@baidu.com">Apollo</maintainer> <license>Apache License 2.0</license> <url type="website">https://www.apollo.auto/</url> <url type="repository">https://github.com/ApolloAuto/apollo</url> <url type="bugtracker">https://github.com/ApolloAuto/apollo/issues</url> <type>third-binary</type> <src_path url="https://github.com/ApolloAuto/apollo">//third_party/adolc</src_path> </package>
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/adolc/workspace.bzl
"""Loads the adolc library""" # Sanitize a dependency so that it works correctly from code that includes # Apollo as a submodule. def clean_dep(dep): return str(Label(dep)) def repo(): native.new_local_repository( name = "adolc", build_file = clean_dep("//third_party/adolc:adolc.BUILD"), path = "/usr/include", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/adolc/BUILD
load("//tools/install:install.bzl", "install", "install_files", "install_src_files") package( default_visibility = ["//visibility:public"], ) install( name = "install", data_dest = "3rd-adolc", data = [ ":cyberfile.xml", ":3rd-adolc.BUILD", ], ) install_src_files( name = "install_src", src_dir = ["."], dest = "3rd-adolc/src", filter = "*", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/protobuf/init.bzl
"""Loads the protobuf library""" load("//third_party/protobuf:workspace.bzl", "repo") def init(): repo()
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/protobuf/cyberfile.xml
<package format="2"> <name>3rd-protobuf</name> <version>local</version> <description> Apollo packaged protobuf Lib. </description> <maintainer email="apollo-support@baidu.com">Apollo</maintainer> <license>Apache License 2.0</license> <url type="website">https://www.apollo.auto/</url> <url type="repository">https://github.com/ApolloAuto/apollo</url> <url type="bugtracker">https://github.com/ApolloAuto/apollo/issues</url> <type>third-wrapper</type> <src_path url="https://github.com/ApolloAuto/apollo">//third_party/protobuf</src_path> </package>
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/protobuf/workspace.bzl
"""Loads the protobuf library""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def clean_dep(dep): return str(Label(dep)) def repo(): http_archive( name = "com_google_protobuf", sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113", patches = [clean_dep("//third_party/protobuf:protobuf.patch")], strip_prefix = "protobuf-3.14.0", urls = [ "https://apollo-system.cdn.bcebos.com/archive/6.0/v3.14.0.tar.gz", "https://github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz", ], )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/protobuf/BUILD
load("//tools/install:install.bzl", "install", "install_files", "install_src_files") package( default_visibility = ["//visibility:public"], ) install( name = "install", data_dest = "3rd-protobuf", data = [ ":cyberfile.xml", ], ) install_src_files( name = "install_src", src_dir = ["."], dest = "3rd-protobuf/src", filter = "*", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/protobuf/protobuf.patch
--- BUILD +++ BUILD @@ -200,16 +200,32 @@ includes = ["src/"], linkopts = LINK_OPTS, visibility = ["//visibility:public"], + alwayslink = True, ) PROTOBUF_DEPS = select({ ":msvc": [], "//conditions:default": ZLIB_DEPS, }) - cc_library( name = "protobuf", srcs = [ + "libprotobuf.so" + ], + hdrs = glob([ + "src/**/*.h", + "src/**/*.inc", + ]), + copts = COPTS, + includes = ["src/"], + linkopts = LINK_OPTS, + visibility = ["//visibility:public"], + deps = [":protobuf_lite"] + PROTOBUF_DEPS, +) + +cc_binary( + name = "libprotobuf.so", + srcs = glob([ # AUTOGEN(protobuf_srcs) "src/google/protobuf/any.cc", "src/google/protobuf/any.pb.cc", @@ -263,8 +279,6 @@ "src/google/protobuf/util/type_resolver_util.cc", "src/google/protobuf/wire_format.cc", "src/google/protobuf/wrappers.pb.cc", - ], - hdrs = glob([ "src/**/*.h", "src/**/*.inc", ]), @@ -273,6 +287,7 @@ linkopts = LINK_OPTS, visibility = ["//visibility:public"], deps = [":protobuf_lite"] + PROTOBUF_DEPS, + linkshared = True, ) # This provides just the header files for use in projects that need to build @@ -288,6 +303,14 @@ includes = ["src/"], visibility = ["//visibility:public"], ) +filegroup( + name = "protobuf_hdrs", + srcs = glob([ + "src/**/*.h", + "src/**/*.inc", + ]), + visibility = ["//visibility:public"], +) # Map of all well known protos. # name => (include path, imports)
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/ncurses5/3rd-ncurses5.BUILD
load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) licenses(["notice"]) cc_library( name = "ncurses5", includes = [ "include", ], linkopts = [ "-lncurses", ], linkstatic = False, strip_include_prefix = "include", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/ncurses5/cyberfile.xml
<package format="2"> <name>3rd-ncurses5</name> <version>local</version> <description> Apollo packaged ncurses5 Lib. </description> <maintainer email="apollo-support@baidu.com">Apollo</maintainer> <license>Apache License 2.0</license> <url type="website">https://www.apollo.auto/</url> <url type="repository">https://github.com/ApolloAuto/apollo</url> <url type="bugtracker">https://github.com/ApolloAuto/apollo/issues</url> <type>third-binary</type> <src_path url="https://github.com/ApolloAuto/apollo">//third_party/ncurses5</src_path> </package>
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/ncurses5/workspace.bzl
"""Loads the ncurses5 library""" # Sanitize a dependency so that it works correctly from code that includes # Apollo as a submodule. def clean_dep(dep): return str(Label(dep)) # Installed via libncurses5-dev def repo(): # ncurses5 native.new_local_repository( name = "ncurses5", build_file = clean_dep("//third_party/ncurses5:ncurses.BUILD"), path = "/usr/include", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/ncurses5/ncurses.BUILD
load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) licenses(["notice"]) cc_library( name = "ncurses5", includes = [ ".", ], linkopts = [ "-lncurses", ], linkstatic = False, )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/ncurses5/BUILD
load("//tools/install:install.bzl", "install", "install_files", "install_src_files") package( default_visibility = ["//visibility:public"], ) install( name = "install", data_dest = "3rd-ncurses5", data = [ ":cyberfile.xml", ":3rd-ncurses5.BUILD", ], ) install_src_files( name = "install_src", src_dir = ["."], dest = "3rd-ncurses5/src", filter = "*", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/npp/npp.BUILD
# NPP: NVIDIA 2D Image and Signal Processing Performance Primitives # Ref https://docs.nvidia.com/cuda/npp/index.html # TODO(infra): merge this with @local_config_cuda and split load("@rules_cc//cc:defs.bzl", "cc_library") package( default_visibility = ["//visibility:public"], ) cc_library( name = "npp", includes = select({ "@platforms//cpu:x86_64": ["targets/x86_64-linux/include"], "@platforms//cpu:aarch64": ["targets/aarch64-linux/include"], "//conditions:default": [], }), hdrs = select({ "@platforms//cpu:x86_64": glob(["targets/x86_64-linux/include/**/*"]), "@platforms//cpu:aarch64": glob(["targets/aarch64-linux/include/**/*"]), "//conditions:default": [], }), linkopts = [ "-L/usr/local/cuda/lib64", "-lnppc", "-lnppial", "-lnppicc", "-lnppidei", "-lnppif", "-lnppig", "-lnppim", "-lnppist", "-lnppisu", "-lnppitc", "-lnpps", ], )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/npp/init.bzl
"""Loads the npp library""" load("//third_party/npp:workspace.bzl", "repo") def init(): repo()
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/npp/cyberfile.xml
<package format="2"> <name>3rd-npp</name> <version>local</version> <description> Apollo packaged npp Lib. </description> <maintainer email="apollo-support@baidu.com">Apollo</maintainer> <license>Apache License 2.0</license> <url type="website">https://www.apollo.auto/</url> <url type="repository">https://github.com/ApolloAuto/apollo</url> <url type="bugtracker">https://github.com/ApolloAuto/apollo/issues</url> <type>third-wrapper</type> <src_path url="https://github.com/ApolloAuto/apollo">//third_party/npp</src_path> </package>
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/npp/workspace.bzl
"""Loads the npp library""" # Sanitize a dependency so that it works correctly from code that includes # Apollo as a submodule. def clean_dep(dep): return str(Label(dep)) def repo(): # npp native.new_local_repository( name = "npp", build_file = clean_dep("//third_party/npp:npp.BUILD"), path = "/usr/local/cuda", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/npp/BUILD
load("//tools/install:install.bzl", "install", "install_files", "install_src_files") package( default_visibility = ["//visibility:public"], ) install( name = "install", data_dest = "3rd-npp", data = [ ":cyberfile.xml", ], ) install_src_files( name = "install_src", src_dir = ["."], dest = "3rd-npp/src", filter = "*", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/qt5/init.bzl
"""Loads the qt5 library""" load("//third_party/qt5:workspace.bzl", "repo") def init(): repo()
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/qt5/cyberfile.xml
<package format="2"> <name>3rd-qt5</name> <version>local</version> <description> Apollo packaged qt5 Lib. </description> <maintainer email="apollo-support@baidu.com">Apollo</maintainer> <license>Apache License 2.0</license> <url type="website">https://www.apollo.auto/</url> <url type="repository">https://github.com/ApolloAuto/apollo</url> <url type="bugtracker">https://github.com/ApolloAuto/apollo/issues</url> <type>third-wrapper</type> <src_path url="https://github.com/ApolloAuto/apollo">//third_party/qt5</src_path> </package>
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/qt5/qt.bzl
load("@rules_cc//cc:defs.bzl", "cc_library") def _file_name(filePathName): if "/" in filePathName: return filePathName.rsplit("/", -1)[1] else: return filePathName def _base_name(fileName): return fileName.split(".")[0] def qt_cc_library(name, srcs, hdrs, copts = [], uis = [], res = [], normal_hdrs = [], deps = None, **kwargs): for hItem in hdrs: base_name = _base_name(_file_name(hItem)) cmd = """ if grep -q Q_OBJECT $(location %s); then \ /usr/local/qt5/bin/moc $(location %s) -o $@ -f'%s'; \ else \ echo '' > $@ ; \ fi""" % (hItem, hItem, "%s/%s" % (native.package_name(), hItem)) native.genrule( name = "%s_moc" % base_name, srcs = [hItem], outs = ["moc_%s.cpp" % base_name], cmd = cmd, ) srcs.append("moc_%s.cpp" % base_name) for uitem in uis: base_name = _base_name(_file_name(uitem)) native.genrule( name = "%s_ui" % base_name, srcs = [uitem], outs = ["ui_%s.h" % base_name], cmd = "/usr/local/qt5/bin/uic $(locations %s) -o $@" % uitem, ) hdrs.append("ui_%s.h" % base_name) for ritem in res: base_name = _base_name(_file_name(ritem)) native.genrule( name = "%s_res" % base_name, srcs = [ritem] + deps, outs = ["res_%s.cpp" % base_name], cmd = "/usr/local/qt5/bin/rcc --name res --output $(OUTS) $(location %s)" % ritem, ) srcs.append("res_%s.cpp" % base_name) hdrs = hdrs + normal_hdrs cc_library( name = name, srcs = srcs, hdrs = hdrs, deps = deps, copts = copts + ["-fPIC"], alwayslink = 1, **kwargs )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/qt5/workspace.bzl
"""Loads the qt library""" # Sanitize a dependency so that it works correctly from code that includes # Apollo as a submodule. def clean_dep(dep): return str(Label(dep)) def repo(): # qt5 native.new_local_repository( name = "qt", build_file = clean_dep("//third_party/qt5:qt.BUILD"), path = "/usr/local/qt5/include", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/qt5/BUILD
load("//tools/install:install.bzl", "install", "install_files", "install_src_files") package( default_visibility = ["//visibility:public"], ) install( name = "install", data_dest = "3rd-qt5", data = [ ":cyberfile.xml", ], ) install_src_files( name = "install_src", src_dir = ["."], dest = "3rd-qt5/src", filter = "*", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/qt5/qt.BUILD
load("@rules_cc//cc:defs.bzl", "cc_library") cc_library( name = "qt_core", hdrs = glob(["*"]), copts = [ "-I.", ], includes = [ "QtCore", ], linkopts = [ "-Wl,-rpath,/usr/local/qt5/lib", "-lQt5Core", ], visibility = ["//visibility:public"], ) cc_library( name = "qt_widgets", hdrs = glob(["*"]), copts = [ "-I.", ], includes = ["QtWidgets"], linkopts = [ "-L/usr/local/qt5/lib", "-lQt5Widgets", ], visibility = ["//visibility:public"], deps = [":qt_core"], ) cc_library( name = "qt_gui", hdrs = glob(["*"]), copts = [ "-I.", ], includes = ["QtGui"], linkopts = [ "-L/usr/local/qt5/lib", "-lQt5Gui", ], visibility = ["//visibility:public"], deps = [ ":qt_core", ":qt_widgets", ], ) cc_library( name = "qt_opengl", hdrs = glob(["*"]), copts = [ "-I.", ], includes = ["QtOpenGL"], linkopts = [ "-L/usr/local/qt5/lib", "-lQt5OpenGL", "-lGL", ], visibility = ["//visibility:public"], deps = [ ":qt_core", ":qt_gui", ":qt_widgets", #"@opengl", ], )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/opengl/opengl.BUILD
load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) licenses(["notice"]) cc_library( name = "opengl", includes = [ ".", ], linkopts = [ "-lGL", # "-lGLU", # "-lSM", # "-lICE", # "-lXext", ], linkstatic = False, )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/opengl/cyberfile.xml
<package format="2"> <name>3rd-opengl</name> <version>local</version> <description> Apollo packaged opengl Lib. </description> <maintainer email="apollo-support@baidu.com">Apollo</maintainer> <license>Apache License 2.0</license> <url type="website">https://www.apollo.auto/</url> <url type="repository">https://github.com/ApolloAuto/apollo</url> <url type="bugtracker">https://github.com/ApolloAuto/apollo/issues</url> <type>third-binary</type> <src_path url="https://github.com/ApolloAuto/apollo">//third_party/opengl</src_path> </package>
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/opengl/workspace.bzl
"""Loads the opengl library""" # Sanitize a dependency so that it works correctly from code that includes # Apollo as a submodule. def clean_dep(dep): return str(Label(dep)) def repo(): # opengl native.new_local_repository( name = "opengl", build_file = clean_dep("//third_party/opengl:opengl.BUILD"), path = "/usr/include", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/opengl/BUILD
load("//tools/install:install.bzl", "install", "install_files", "install_src_files") package( default_visibility = ["//visibility:public"], ) install( name = "install", data_dest = "3rd-opengl", data = [ ":cyberfile.xml", ":3rd-opengl.BUILD", ], ) install_src_files( name = "install_src", src_dir = ["."], dest = "3rd-opengl/src", filter = "*", )
0
apollo_public_repos/apollo/third_party
apollo_public_repos/apollo/third_party/opengl/3rd-opengl.BUILD
load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) licenses(["notice"]) cc_library( name = "opengl", includes = [ "include", ], linkopts = [ "-lGL", ], linkstatic = False, strip_include_prefix = "include", )
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/replay.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### # e.g. replay.sh 1_chassis.pb.txt TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" ${TOP_DIR}/bazel-bin/modules/tools/replay/replay_file "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/time_sync.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" function usage() { info "${RED}Usage${NO_COLOR}: ${BOLD}${0}${NO_COLOR} <region>" info " E.g. $0 us # Sync with NTP servers for USA" info " E.g. $0 cn # Sync with NTP servers for China" } NTPDATE_CMD="$(command -v ntpdate)" function check_cmd_exist() { if [ ! -x "${NTPDATE_CMD}" ]; then warning "Command \"ntpdate\" not found. You can install it manually via:" warning " sudo apt-get -y update && sudo apt-get -y install ntpdate" exit 1 fi } REGION="us" function parse_args() { if [ "$#" -ne 1 ]; then usage exit 1 else REGION="$(echo $1 | tr 'A-Z' 'a-z')" fi info "Region set to ${REGION}." } # RTFM: https://www.ntppool.org/zone/@ function setup_cron_job() { if grep -q ntpdate /etc/crontab; then return fi echo "*/1 * * * * root ntpdate -v -u ${REGION}.pool.ntp.org" | sudo tee -a /etc/crontab sudo /etc/init.d/cron restart # sudo systemctl restart cron.service } function main() { check_cmd_exist parse_args "$@" setup_cron_job # ntpdate log goes to /var/log/syslog sudo ntpdate -v -u ${REGION}.pool.ntp.org } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/navigator.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### # Get the absolute path. i=0 j=0 for str in $@; do # The strings starting with "--" are control arguments and need to be filtered. if [[ ${str} =~ ^--.* ]]; then CTRL_ARGS[i++]=${str} continue fi DIR=$(cd "$(dirname ${str})" && pwd) FILE_NAME=$(basename ${str}) PATH_NAME[j++]="${DIR}/${FILE_NAME}" done #echo "${CTRL_ARGS[@]}" #echo "${PATH_NAME[@]}" DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "${DIR}/apollo_base.sh" ${APOLLO_BIN_PREFIX}/modules/map/relative_map/tools/navigator --navigator_config_filename=/apollo/modules/map/relative_map/conf/navigator_config.pb.txt "${CTRL_ARGS[@]}" "${PATH_NAME[@]}"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/guardian.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name run_module guardian "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/camera.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "${DIR}/apollo_base.sh" function start() { LOG="${APOLLO_ROOT_DIR}/data/log/camera.out" CMD="cyber_launch start /apollo/modules/drivers/camera/launch/camera.launch" NUM_PROCESSES="$(pgrep -f "modules/drivers/camera/dag/camera.dag" | grep -cv '^1$')" if [ "${NUM_PROCESSES}" -eq 0 ]; then eval "nohup ${CMD} </dev/null >${LOG} 2>&1 &" fi } function stop() { eval "nohup cyber_launch stop /apollo/modules/drivers/camera/launch/camera.launch < /dev/null 2>&1 &" } # run command_name module_name function run() { case $1 in start) start ;; stop) stop ;; restart) stop start ;; *) start ;; esac } run "$1"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/msf_offline_local_visualizer.sh
#! /bin/bash if [ $# -lt 1 ]; then echo "Usage: msf_offline_local_visualizer.sh [data path]" exit 1 fi DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "${DIR}/apollo_base.sh" $APOLLO_BIN_PREFIX/modules/localization/msf/local_tool/local_visualization/offline_visual/offline_local_visualizer \ --basedir $1
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/common.bashrc
#! /usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### # Ref: http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html # Written for Beyond Linux From Scratch # by James Robertson <jameswrobertson@earthlink.net> # modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg> # Functions to help us manage paths. Second argument is the name of the # path variable to be modified (default: PATH) pathremove() { local IFS=':' local NEWPATH local DIR local PATHVARIABLE=${2:-PATH} for DIR in ${!PATHVARIABLE}; do if [ "$DIR" != "$1" ]; then NEWPATH=${NEWPATH:+$NEWPATH:}$DIR fi done export $PATHVARIABLE="$NEWPATH" } pathprepend() { pathremove $1 $2 local PATHVARIABLE=${2:-PATH} export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}" } pathappend() { pathremove $1 $2 local PATHVARIABLE=${2:-PATH} export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1" } export -f pathremove pathprepend pathappend
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/relative_map.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" # run_customized_path function from apollo_base.sh # run_customized_path module_path module_name # FIXME(all): temporary enable --use_navigation_mode in this script to make # it easier to test relative_map node. Need removed in the future. run_customized_path map/relative_map relative_map "$@" --use_navigation_mode
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/switch_vehicle.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "${DIR}/apollo_base.sh" # Usage: # scripts/switch_vehicle.sh <vehicle_data_path> # # <vehicle_data_path> is a directory containing vehicle specified data. # E.g.: modules/calibration/data/mkz8 VEHICLE_PATH=$1 if [ -d ${VEHICLE_PATH} ]; then ${APOLLO_BIN_PREFIX}/modules/dreamview/backend/hmi/vehicle_manager_main \ --vehicle_data_path="${VEHICLE_PATH}" else error "Cannot open directory: ${VEHICLE_PATH}" info "Available vehicles:" find modules/calibration/data -maxdepth 1 -mindepth 1 -type d fi
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/mock_routing_request.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" ${TOP_DIR}/bazel-bin/modules/tools/mock_routing/mock_routing_request
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/localization.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" # run function from apollo_base.sh run_module localization "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/prediction.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name run_module prediction "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/topics.txt
/apollo/canbus/chassis /apollo/canbus/chassis_detail /apollo/control /apollo/control/pad /apollo/drive_event /apollo/localization/msf_gnss /apollo/localization/msf_lidar /apollo/localization/msf_status /apollo/localization/pose /apollo/monitor /apollo/monitor/static_info /apollo/navigation /apollo/perception/obstacles /apollo/perception/traffic_light /apollo/planning /apollo/prediction /apollo/relative_map /apollo/routing_request /apollo/routing_response /apollo/sensor/conti_radar /apollo/sensor/delphi_esr /apollo/sensor/gnss/best_pose /apollo/sensor/gnss/corrected_imu /apollo/sensor/gnss/gnss_status /apollo/sensor/gnss/imu /apollo/sensor/gnss/ins_stat /apollo/sensor/gnss/odometry /apollo/sensor/gnss/rtk_eph /apollo/sensor/gnss/rtk_obs /apollo/sensor/mobileye /tf /tf_static
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/pad.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" function start() { ${TOP_DIR}/bazel-bin/modules/control/tools/pad_terminal \ --log_dir=${APOLLO_ROOT_DIR}/data/log } function stop() { pkill -SIGKILL -f pad_terminal } case $1 in start) start ;; stop) stop ;; restart) stop start ;; *) start ;; esac
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/ultrasonic_radar.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "$DIR/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name run_customized_path drivers/radar/ultrasonic_radar ultrasonic_radar "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/record_bag.py
#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### """ Start apollo data recorder. It lists all available disks mounted under /media, and prioritize them in order: - Disk#1. Largest NVME disk - Disk#2. Smaller NVME disk - ... - Disk#x. Largest Non-NVME disk - Disk#y. Smaller Non-NVME disk - ... 1. If we have NVME disk, it will be used to record all data. 2. If we have Non-NVME disk, it will only record smaller topics (blacklist LARGE_TOPICS), unless '--all' is specified. 3. If no external disks are available, we will take '/apollo' as a 'Non-NVME disk' and follow the rule above. Run with '--help' to see more options. """ import argparse import datetime import os import subprocess import sys import psutil LARGE_TOPICS = [ '/apollo/sensor/camera/front_12mm/image', '/apollo/sensor/camera/front_12mm/image/compressed', '/apollo/sensor/camera/front_12mm/video/compressed', '/apollo/sensor/camera/front_6mm/image', '/apollo/sensor/camera/front_6mm/image/compressed', '/apollo/sensor/camera/front_6mm/video/compressed', '/apollo/sensor/camera/left_fisheye/image', '/apollo/sensor/camera/left_fisheye/image/compressed', '/apollo/sensor/camera/left_fisheye/video/compressed', '/apollo/sensor/camera/rear_6mm/image', '/apollo/sensor/camera/rear_6mm/image/compressed', '/apollo/sensor/camera/rear_6mm/video/compressed', '/apollo/sensor/camera/right_fisheye/image', '/apollo/sensor/camera/right_fisheye/image/compressed', '/apollo/sensor/camera/right_fisheye/video/compressed', '/apollo/sensor/lidar128/PointCloud2', '/apollo/sensor/lidar128/compensator/PointCloud2', '/apollo/sensor/lidar16/PointCloud2', '/apollo/sensor/lidar16/Scan', '/apollo/sensor/lidar16/compensator/PointCloud2', '/apollo/sensor/lidar16/front/center/PointCloud2', '/apollo/sensor/lidar16/front/up/PointCloud2', '/apollo/sensor/lidar16/fusion/PointCloud2', '/apollo/sensor/lidar16/fusion/compensator/PointCloud2', '/apollo/sensor/lidar16/rear/left/PointCloud2', '/apollo/sensor/lidar16/rear/right/PointCloud2', '/apollo/sensor/microphone', '/apollo/sensor/radar/front', '/apollo/sensor/radar/rear', '/apollo/sensor/velodyne64/compensator/PointCloud2', ] def shell_cmd(cmd, alert_on_failure=True): """Execute shell command and return (ret-code, stdout, stderr).""" print('SHELL > {}'.format(cmd)) proc = subprocess.Popen(cmd, shell=True, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) ret = proc.wait() stdout = proc.stdout.read().decode('utf-8') if proc.stdout else None stderr = proc.stderr.read().decode('utf-8') if proc.stderr else None if alert_on_failure and stderr and ret != 0: sys.stderr.write('{}\n'.format(stderr)) return (ret, stdout, stderr) class ArgManager(object): """Arguments manager.""" def __init__(self): self.parser = argparse.ArgumentParser( description="Manage apollo data recording.") self.parser.add_argument('--start', default=False, action="store_true", help='Start recorder. It is the default ' 'action if no other actions are triggered. In ' 'that case, the False value is ignored.') self.parser.add_argument('--stop', default=False, action="store_true", help='Stop recorder.') self.parser.add_argument('--stop_signal', default="SIGINT", help='Signal to stop the recorder.') self.parser.add_argument('--all', default=False, action="store_true", help='Record all topics even without high ' 'performance disks.') self.parser.add_argument('--small', default=False, action="store_true", help='Record small topics only.') self.parser.add_argument('--split_duration', default="1m", help='Duration to split bags, will be applied ' 'as parameter to "rosbag record --duration".') self._args = None def args(self): """Get parsed args.""" if self._args is None: self._args = self.parser.parse_args() return self._args class DiskManager(object): """Disk manager.""" def __init__(self): """Manage disks.""" disks = [] for disk in psutil.disk_partitions(): if not disk.mountpoint.startswith('/media/'): continue disks.append({ 'mountpoint': disk.mountpoint, 'available_size': DiskManager.disk_avail_size(disk.mountpoint), 'is_nvme': disk.mountpoint.startswith('/media/apollo/internal_nvme'), }) # Prefer NVME disks and then larger disks. self.disks = sorted( disks, reverse=True, key=lambda disk: (disk['is_nvme'], disk['available_size'])) @staticmethod def disk_avail_size(disk_path): """Get disk available size.""" statvfs = os.statvfs(disk_path) return statvfs.f_frsize * statvfs.f_bavail class Recorder(object): """Data recorder.""" def __init__(self, args): self.args = args self.disk_manager = DiskManager() def start(self): """Start recording.""" if Recorder.is_running(): print('Another data recorder is running, skip.') return disks = self.disk_manager.disks # To record all topics if # 1. User requested with '--all' argument. # 2. Or we have a NVME disk and '--small' is not set. record_all = self.args.all or ( len(disks) > 0 and disks[0]['is_nvme'] and not self.args.small) # Use the best disk, or fallback '/apollo' if none available. disk_to_use = disks[0]['mountpoint'] if len(disks) > 0 else '/apollo' # Record small topics to quickly copy and process if record_all: self.record_task(disk_to_use, False) self.record_task(disk_to_use, record_all) def stop(self): """Stop recording.""" shell_cmd('pkill --signal {} -f "cyber_recorder record"'.format( self.args.stop_signal)) def record_task(self, disk, record_all): """Record tasks into the <disk>/data/bag/<task_id> directory.""" task_id = datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S') if not record_all: task_id += "_s" task_dir = os.path.join(disk, 'data/bag', task_id) print('Recording bag to {}'.format(task_dir)) topics_str = "--all" log_file = '/apollo/data/log/apollo_record.out' if not record_all: log_file += "_s" topics_str += " -k {}".format(' -k '.join(list(LARGE_TOPICS))) if not os.path.exists(task_dir): os.makedirs(task_dir) cmd = ''' cd "{}" source /apollo/scripts/apollo_base.sh source /apollo/cyber/setup.bash nohup cyber_recorder record {} >{} 2>&1 & '''.format(task_dir, topics_str, log_file) shell_cmd(cmd) @staticmethod def is_running(): """Test if the given process running.""" _, stdout, _ = shell_cmd('pgrep -f "cyber_recorder record" | grep -cv \'^1$\'', False) # If stdout is the pgrep command itself, no such process is running. return stdout.strip() != '1' if stdout else False def main(): """Main entry.""" arg_manager = ArgManager() args = arg_manager.args() recorder = Recorder(args) if args.stop: recorder.stop() else: recorder.start() if __name__ == '__main__': main()
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/apollo_base.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source ${TOP_DIR}/scripts/apollo.bashrc ARCH="$(uname -m)" # components="$(echo -e "${@// /\\n}" | sort -u)" # if [ ${PIPESTATUS[0]} -ne 0 ]; then ... ; fi APOLLO_OUTSIDE_DOCKER=0 CMDLINE_OPTIONS= SHORTHAND_TARGETS= DISABLED_TARGETS= : ${CROSSTOOL_VERBOSE:=0} : ${NVCC_VERBOSE:=0} : ${HIPCC_VERBOSE:=0} : ${USE_ESD_CAN:=false} USE_GPU=-1 use_cpu=-1 use_gpu=-1 use_nvidia=-1 use_amd=-1 function set_lib_path() { local CYBER_SETUP="${APOLLO_ROOT_DIR}/cyber/setup.bash" [ -e "${CYBER_SETUP}" ] && . "${CYBER_SETUP}" pathprepend ${APOLLO_ROOT_DIR}/modules/tools PYTHONPATH pathprepend ${APOLLO_ROOT_DIR}/modules/teleop/common PYTHONPATH pathprepend /apollo/modules/teleop/common/scripts } function create_data_dir() { local DATA_DIR="${APOLLO_ROOT_DIR}/data" mkdir -p "${DATA_DIR}/log" mkdir -p "${DATA_DIR}/bag" mkdir -p "${DATA_DIR}/core" } function determine_bin_prefix() { APOLLO_BIN_PREFIX=$APOLLO_ROOT_DIR if [ -e "${APOLLO_ROOT_DIR}/bazel-bin" ]; then APOLLO_BIN_PREFIX="${APOLLO_ROOT_DIR}/bazel-bin" fi export APOLLO_BIN_PREFIX } function setup_device_for_aarch64() { local can_dev="/dev/can0" local socket_can_dev="can0" if [ ! -e "${can_dev}" ]; then warning "No CAN device named ${can_dev}. " fi if [[ -x "$(command -v ip)" ]]; then if ! ip link show type can | grep "${socket_can_dev}" &>/dev/null; then warning "No SocketCAN device named ${socket_can_dev}." else sudo ip link set can0 type can bitrate 500000 sudo ip link set can0 up fi else warning "ip command not found." fi } function setup_device_for_amd64() { # setup CAN device local NUM_PORTS=8 for i in $(seq 0 $((${NUM_PORTS} - 1))); do if [[ -e /dev/can${i} ]]; then continue elif [[ -e /dev/zynq_can${i} ]]; then # soft link if sensorbox exist sudo ln -s /dev/zynq_can${i} /dev/can${i} else break # sudo mknod --mode=a+rw /dev/can${i} c 52 ${i} fi done # Check Nvidia device if [[ ! -e /dev/nvidia0 ]]; then warning "No device named /dev/nvidia0" fi if [[ ! -e /dev/nvidiactl ]]; then warning "No device named /dev/nvidiactl" fi if [[ ! -e /dev/nvidia-uvm ]]; then warning "No device named /dev/nvidia-uvm" fi if [[ ! -e /dev/nvidia-uvm-tools ]]; then warning "No device named /dev/nvidia-uvm-tools" fi if [[ ! -e /dev/nvidia-modeset ]]; then warning "No device named /dev/nvidia-modeset" fi } function setup_device() { if [ "$(uname -s)" != "Linux" ]; then info "Not on Linux, skip mapping devices." return fi if [[ "${ARCH}" == "x86_64" ]]; then setup_device_for_amd64 else setup_device_for_aarch64 fi } function decide_task_dir() { # Try to find largest NVMe drive. DISK="$(df | grep "^/dev/nvme" | sort -nr -k 4 \ | awk '{print substr($0, index($0, $6))}')" # Try to find largest external drive. if [ -z "${DISK}" ]; then DISK="$(df | grep "/media/${DOCKER_USER}" | sort -nr -k 4 \ | awk '{print substr($0, index($0, $6))}')" fi if [ -z "${DISK}" ]; then info "Cannot find portable disk. Fallback to apollo data dir." DISK="/apollo" fi # Create task dir. BAG_PATH="${DISK}/data/bag" TASK_ID=$(date +%Y-%m-%d-%H-%M-%S) TASK_DIR="${BAG_PATH}/${TASK_ID}" mkdir -p "${TASK_DIR}" info "Record bag to ${TASK_DIR}..." export TASK_ID="${TASK_ID}" export TASK_DIR="${TASK_DIR}" } function is_stopped_customized_path() { MODULE_PATH=$1 MODULE=$2 NUM_PROCESSES="$(pgrep -f "modules/${MODULE_PATH}/launch/${MODULE}.launch" | grep -cv '^1$')" if [ "${NUM_PROCESSES}" -eq 0 ]; then return 1 else return 0 fi } function start_customized_path() { MODULE_PATH=$1 MODULE=$2 shift 2 is_stopped_customized_path "${MODULE_PATH}" "${MODULE}" if [ $? -eq 1 ]; then # todo(zero): Better to move nohup.out to data/log/nohup.out eval "nohup cyber_launch start ${APOLLO_ROOT_DIR}/modules/${MODULE_PATH}/launch/${MODULE}.launch &" sleep 0.5 is_stopped_customized_path "${MODULE_PATH}" "${MODULE}" if [ $? -eq 0 ]; then ok "Launched module ${MODULE}." return 0 else error "Could not launch module ${MODULE}. Is it already built?" return 1 fi else info "Module ${MODULE} is already running - skipping." return 2 fi } function start() { MODULE=$1 shift start_customized_path $MODULE $MODULE "$@" } function start_prof_customized_path() { MODULE_PATH=$1 MODULE=$2 shift 2 info "Make sure you have built with 'bash apollo.sh build_prof'" LOG="${APOLLO_ROOT_DIR}/data/log/${MODULE}.out" is_stopped_customized_path "${MODULE_PATH}" "${MODULE}" if [ $? -eq 1 ]; then PROF_FILE="/tmp/$MODULE.prof" rm -rf $PROF_FILE BINARY=${APOLLO_BIN_PREFIX}/modules/${MODULE_PATH}/${MODULE} eval "CPUPROFILE=$PROF_FILE $BINARY \ --flagfile=modules/${MODULE_PATH}/conf/${MODULE}.conf \ --log_dir=${APOLLO_ROOT_DIR}/data/log $@ </dev/null >${LOG} 2>&1 &" sleep 0.5 is_stopped_customized_path "${MODULE_PATH}" "${MODULE}" if [ $? -eq 0 ]; then ok "Launched module ${MODULE} in prof mode." echo -e " Export profile by command:\n\t${YELLOW}google-pprof --pdf $BINARY $PROF_FILE > ${MODULE}_prof.pdf${NO_COLOR}" return 0 else error "Could not launch module ${MODULE}. Is it already built?" return 1 fi else info "Module ${MODULE} is already running - skipping." return 2 fi } function start_prof() { MODULE=$1 shift start_prof_customized_path $MODULE $MODULE "$@" } function start_fe_customized_path() { MODULE_PATH=$1 MODULE=$2 shift 2 is_stopped_customized_path "${MODULE_PATH}" "${MODULE}" if [ $? -eq 1 ]; then eval "cyber_launch start ${APOLLO_ROOT_DIR}/modules/${MODULE_PATH}/launch/${MODULE}.launch" else info "Module ${MODULE} is already running - skipping." return 2 fi } function start_fe() { MODULE=$1 shift start_fe_customized_path $MODULE $MODULE "$@" } function start_gdb_customized_path() { MODULE_PATH=$1 MODULE=$2 shift 2 eval "gdb --args ${APOLLO_BIN_PREFIX}/modules/${MODULE_PATH}/${MODULE} \ --flagfile=modules/${MODULE_PATH}/conf/${MODULE}.conf \ --log_dir=${APOLLO_ROOT_DIR}/data/log $@" } function start_gdb() { MODULE=$1 shift start_gdb_customized_path $MODULE $MODULE "$@" } function stop_customized_path() { MODULE_PATH=$1 MODULE=$2 is_stopped_customized_path "${MODULE_PATH}" "${MODULE}" if [ $? -eq 1 ]; then info "${MODULE} process is not running!" return fi cyber_launch stop "${APOLLO_ROOT_DIR}/modules/${MODULE_PATH}/launch/${MODULE}.launch" if [ $? -eq 0 ]; then ok "Successfully stopped module ${MODULE}." else info "Module ${MODULE} is not running - skipping." fi } function stop() { MODULE=$1 stop_customized_path $MODULE $MODULE } # Note: This 'help' function here will overwrite the bash builtin command 'help'. # TODO: add a command to query known modules. function help() { cat << EOF Invoke ". scripts/apollo_base.sh" within docker to add the following commands to the environment: Usage: COMMAND [<module_name>] COMMANDS: help: show this help message start: start the module in background start_fe: start the module without putting in background start_gdb: start the module with gdb stop: stop the module EOF } function run_customized_path() { local module_path=$1 local module=$2 local cmd=$3 shift 3 case $cmd in start) start_customized_path $module_path $module "$@" ;; start_fe) start_fe_customized_path $module_path $module "$@" ;; start_gdb) start_gdb_customized_path $module_path $module "$@" ;; start_prof) start_prof_customized_path $module_path $module "$@" ;; stop) stop_customized_path $module_path $module ;; help) help ;; *) start_customized_path $module_path $module $cmd "$@" ;; esac } # Write log to a file about the env when record a bag. function record_bag_env_log() { if [ -z "${TASK_ID}" ]; then TASK_ID=$(date +%Y-%m-%d-%H-%M) fi git status > /dev/null 2>&1 if [ $? -ne 0 ]; then warning "Not in Git repo, maybe because you are in release container." info "Skip log environment." return fi commit=$(git log -1) echo -e "Date:$(date)\n" >> Bag_Env_$TASK_ID.log git branch | awk '/\*/ { print "current branch: " $2; }' >> Bag_Env_$TASK_ID.log echo -e "\nNewest commit:\n$commit" >> Bag_Env_$TASK_ID.log echo -e "\ngit diff:" >> Bag_Env_$TASK_ID.log git diff >> Bag_Env_$TASK_ID.log echo -e "\n\n\n\n" >> Bag_Env_$TASK_ID.log echo -e "git diff --staged:" >> Bag_Env_$TASK_ID.log git diff --staged >> Bag_Env_$TASK_ID.log } # run command_name module_name function run_module() { local module=$1 shift run_customized_path $module $module "$@" } function _chk_n_set_gpu_arg() { local arg="$1" if [ "${arg}" = "cpu" ]; then use_cpu=1 elif [ "${arg}" = "gpu" ]; then use_gpu=1 elif [ "${arg}" = "nvidia" ]; then use_nvidia=1 elif [ "${arg}" = "amd" ]; then use_amd=1 else return 0 fi if (( $use_cpu == 1 )) && (( $use_gpu == 1 )); then error "${RED}Mixed use of '--config=cpu' and '--config=gpu' may" \ "lead to unexpected behavior. Exiting...${NO_COLOR}" exit 1 fi if (( $use_cpu == 1 )) && (( $use_nvidia == 1 )); then error "${RED}Mixed use of '--config=cpu' and '--config=nvidia' may" \ "lead to unexpected behavior. Exiting...${NO_COLOR}" exit 1 fi if (( $use_cpu == 1 )) && (( $use_amd == 1 )); then error "${RED}Mixed use of '--config=cpu' and '--config=amd' may" \ "lead to unexpected behavior. Exiting...${NO_COLOR}" exit 1 fi if (( $use_nvidia == 1 )) && (( $use_amd == 1 )); then error "${RED}Mixed use of '--config=amd' and '--config=nvidia':" \ "please specify only one GPU target. Exiting...${NO_COLOR}" exit 1 fi if (( $use_nvidia == 1 )) && (( $use_amd == -1 )) && [ "$GPU_PLATFORM" == "AMD" ]; then error "${RED}Cross-compilation for NVIDIA GPU target is not supported on AMD GPU device':" \ "please specify AMD or skip its specification to compile for AMD GPU target."\ "To compile for NVIDIA GPU target NVIDIA GPU device should be installed. Exiting...${NO_COLOR}" exit 1 fi if (( $use_amd == 1 )) && (( $use_nvidia == -1 )) && [ "$GPU_PLATFORM" == "NVIDIA" ]; then error "${RED}Cross-compilation for AMD GPU target is not supported on NVIDIA GPU device':" \ "please specify NVIDIA or skip its specification to compile for NVIDIA GPU target."\ "To compile for AMD GPU target AMD GPU device should be installed. Exiting...${NO_COLOR}" exit 1 fi return 0 } function parse_cmdline_arguments() { local known_options="" local bazel_option="" local remained_args="" local bazel=0 for ((pos = 1; pos <= $#; pos++)); do #do echo "$#" "$i" "${!i}"; done local opt="${!pos}" local optarg local known_bazel_opt=0 if (( ${bazel} == 1 )); then ((++bazel)) fi case "${opt}" in --bazel) ((++pos)) bazel_option="${!pos}" bazel=1 ((--pos)) ;; --config=*) optarg="${opt#*=}" known_options="${known_options} ${opt}" _chk_n_set_gpu_arg "${optarg}" known_bazel_opt=1 ;; --config) ((++pos)) optarg="${!pos}" known_options="${known_options} ${opt} ${optarg}" _chk_n_set_gpu_arg "${optarg}" known_bazel_opt=1 ;; -o) ((++pos)) optarg="${!pos}" known_options="${known_options} ${opt}" APOLLO_OUTSIDE_DOCKER=1 ;; -c) ((++pos)) optarg="${!pos}" known_options="${known_options} ${opt} ${optarg}" ;; *) if (( ${bazel} == 0 )); then remained_args="${remained_args} ${opt}" elif (( ${bazel} == 2 )); then if (( ${known_bazel_opt} == 0 )); then known_options="${known_options} ${bazel_option}" fi bazel=0 fi ;; esac done if (( ${bazel} == 1 )); then warning "Bazel option is not specified. Skipping..." fi # Strip leading whitespaces known_options="$(echo "${known_options}" | sed -e 's/^[[:space:]]*//')" remained_args="$(echo "${remained_args}" | sed -e 's/^[[:space:]]*//')" CMDLINE_OPTIONS="${known_options}" SHORTHAND_TARGETS="${remained_args}" } unset OMP_NUM_THREADS if [ $APOLLO_IN_DOCKER = "true" ]; then create_data_dir set_lib_path $1 if [ -z $APOLLO_BASE_SOURCED ]; then determine_bin_prefix export APOLLO_BASE_SOURCED=1 fi fi function _determine_drivers_disabled() { if ! ${USE_ESD_CAN}; then warning "ESD CAN library supplied by ESD Electronics doesn't exist." warning "If you need ESD CAN, please refer to third_party/can_card_library/esd_can/README.md" DISABLED_TARGETS="${DISABLED_TARGETS} except //modules/drivers/canbus/can_client/esd/..." fi } function _determine_perception_disabled() { if [ "${USE_GPU}" -eq 0 ]; then DISABLED_TARGETS="${DISABLED_TARGETS} except //modules/perception/..." elif [ "$GPU_PLATFORM" == "AMD" ]; then DISABLED_TARGETS="${DISABLED_TARGETS} except //modules/perception/inference/tensorrt/..." elif [ "$GPU_PLATFORM" == "NVIDIA" ]; then DISABLED_TARGETS="${DISABLED_TARGETS} except //modules/perception/inference/migraphx/..." fi } function _determine_localization_disabled() { if [ "${ARCH}" != "x86_64" ]; then # Skip msf for non-x86_64 platforms DISABLED_TARGETS="${disabled} except //modules/localization/msf/..." fi } function _determine_planning_disabled() { if [ "${USE_GPU}" -eq 0 ]; then DISABLED_TARGETS="${DISABLED_TARGETS} \ except //modules/planning/open_space/trajectory_smoother:planning_block" fi } function _determine_map_disabled() { if [ "${USE_GPU}" -eq 0 ]; then DISABLED_TARGETS="${DISABLED_TARGETS} except //modules/map/pnc_map:cuda_pnc_util \ except //modules/map/pnc_map:cuda_util_test" fi } function determine_disabled_targets() { if [[ "$#" -eq 0 ]]; then _determine_drivers_disabled _determine_localization_disabled _determine_perception_disabled _determine_planning_disabled _determine_map_disabled echo "${DISABLED_TARGETS}" return fi for component in $@; do case "${component}" in drivers*) _determine_drivers_disabled ;; localization*) _determine_localization_disabled ;; perception*) _determine_perception_disabled ;; planning*) _determine_planning_disabled ;; map*) _determine_map_disabled ;; esac done echo "${DISABLED_TARGETS}" } function determine_targets() { local targets_all if [[ "$#" -eq 0 ]]; then targets_all="//modules/... union //cyber/..." echo "${targets_all}" return fi for component in $@; do local targets if [ "${component}" = "cyber" ]; then if [[ "${HOST_OS}" == "Linux" ]]; then targets="//cyber/... union //modules/tools/visualizer/..." else targets="//cyber/..." fi elif [[ -d "${APOLLO_ROOT_DIR}/modules/${component}" ]]; then targets="//modules/${component}/..." else error "Directory <APOLLO_ROOT_DIR>/modules/${component} not found. Exiting ..." exit 1 fi if [ -z "${targets_all}" ]; then targets_all="${targets}" else targets_all="${targets_all} union ${targets}" fi done echo "${targets_all}" } function format_bazel_targets() { local targets="$(echo $@ | xargs)" targets="${targets// union / }" # replace all matches of "A union B" to "A B" targets="${targets// except / -}" # replaces all matches of "A except B" to "A-B" echo "${targets}" } function determine_cpu_or_gpu() { USE_GPU="${USE_GPU_TARGET}" if [ "${USE_GPU_TARGET}" -eq 0 ]; then if [ "${use_gpu}" -eq 1 ]; then error "Can't compile for GPU: no GPU found. Exiting ..." exit 1 elif [ "${use_cpu}" -lt 0 ]; then CMDLINE_OPTIONS="--config=cpu ${CMDLINE_OPTIONS}" fi USE_GPU="0" else if [ "${use_cpu}" -eq 1 ]; then USE_GPU="0" else USE_GPU="1" if [ "${use_gpu}" -lt 0 ]; then CMDLINE_OPTIONS="--config=gpu ${CMDLINE_OPTIONS}" fi if [ "${use_amd}" -lt 0 ] && [ "$GPU_PLATFORM" == "AMD" ]; then CMDLINE_OPTIONS="${CMDLINE_OPTIONS} --config=amd" elif [ "${use_nvidia}" -lt 0 ] && [ "$GPU_PLATFORM" == "NVIDIA" ]; then CMDLINE_OPTIONS="${CMDLINE_OPTIONS} --config=nvidia" fi fi fi if [ "${USE_GPU}" -eq 1 ]; then ok "Running ${GREEN}${GPU_PLATFORM} GPU${NO_COLOR} $1 on ${GREEN}${ARCH}${NO_COLOR} platform." else ok "Running ${GREEN}CPU${NO_COLOR} $1 on ${GREEN}${ARCH}${NO_COLOR} platform." fi } function run_bazel() { if [ "${APOLLO_OUTSIDE_DOCKER}" -eq 1 ]; then warning "Assembling outside the docker can cause errors," warning " we recommend using a ready-made container." warning "Make sure that all dependencies are installed," warning " if errors, try running <apollo_path>/docker/build/installers/install.sh" elif ! "${APOLLO_IN_DOCKER}"; then error "The build operation must be run from within docker container" error "Use -o flag to force build" exit 1 fi determine_cpu_or_gpu "${1,,}" if ${USE_ESD_CAN}; then CMDLINE_OPTIONS="${CMDLINE_OPTIONS} --define USE_ESD_CAN=${USE_ESD_CAN}" fi CMDLINE_OPTIONS="$(echo ${CMDLINE_OPTIONS} | xargs)" local build_targets="$(determine_targets ${SHORTHAND_TARGETS})" local disabled_targets="$(determine_disabled_targets ${SHORTHAND_TARGETS})" disabled_targets="$(echo ${disabled_targets} | xargs)" # Note(storypku): Workaround for in case "/usr/bin/bazel: Argument list too long" # bazel build ${CMDLINE_OPTIONS} ${job_args} $(bazel query ${build_targets}) local formatted_targets="$(format_bazel_targets ${build_targets} ${disabled_targets})" local sp=" " local spaces=" " local count=$(nproc) if [ "$1" == "Coverage" ]; then count="$(($(nproc) / 2))" spaces=" " elif [ "$1" == "Test" ]; then sp=" " fi info "${BLUE}$1 Overview:${NO_COLOR}" info "${TAB}USE_GPU: ${spaces}${GREEN}${USE_GPU}${NO_COLOR} [ 0 for CPU, 1 for GPU ]" if [ "${USE_GPU}" -eq 1 ]; then info "${TAB}GPU arch: ${spaces}${GREEN}${GPU_PLATFORM}${NO_COLOR}" info "${TAB}CROSSTOOL_VERBOSE: ${GREEN}${CROSSTOOL_VERBOSE}${NO_COLOR} [ 0 for no verbose, 1 for verbose]" if [ "$GPU_PLATFORM" == "AMD" ]; then info "${TAB}HIPCC_VERBOSE: ${spaces}${GREEN}${HIPCC_VERBOSE}${NO_COLOR} [ 0 for no verbose, 1 for cmd, 2 for env, 4 for args, 3,5,6,7 for combinations of 1,2,4]" elif [ "$GPU_PLATFORM" == "NVIDIA" ]; then info "${TAB}NVCC_VERBOSE: ${spaces}${GREEN}${NVCC_VERBOSE}${NO_COLOR} [ 0 for no verbose, 1 for verbose]" fi else info "${TAB}CPU arch: ${spaces}${GREEN}${ARCH}${NO_COLOR}" fi info "${TAB}Bazel Options: ${spaces}${GREEN}${CMDLINE_OPTIONS}${NO_COLOR}" info "${TAB}$1 Targets: ${sp}${GREEN}${build_targets}${NO_COLOR}" info "${TAB}Disabled: ${spaces}${YELLOW}${disabled_targets}${NO_COLOR}" job_args="--copt=-mavx2 --host_copt=-mavx2 --jobs=${count} --local_ram_resources=HOST_RAM*0.7" set -x bazel ${1,,} ${CMDLINE_OPTIONS} ${job_args} -- ${formatted_targets} set +x }
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/apollo.bashrc
#!/usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### APOLLO_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" APOLLO_IN_DOCKER=false # If inside docker container if [ -f /.dockerenv ]; then APOLLO_IN_DOCKER=true APOLLO_ROOT_DIR="/apollo" fi export APOLLO_CONFIG_HOME="${APOLLO_CONFIG_HOME:=$HOME/.apollo}" export APOLLO_ROOT_DIR="${APOLLO_ROOT_DIR}" export APOLLO_IN_DOCKER="${APOLLO_IN_DOCKER}" export APOLLO_CACHE_DIR="${APOLLO_ROOT_DIR}/.cache" export APOLLO_SYSROOT_DIR="/opt/apollo/sysroot" export TAB=" " # 4 spaces export GPU_SETUP_COMPLETED source ${APOLLO_ROOT_DIR}/scripts/common.bashrc : ${VERBOSE:=yes} BOLD='\033[1m' RED='\033[0;31m' BLUE='\033[1;34;48m' GREEN='\033[32m' WHITE='\033[34m' YELLOW='\033[33m' NO_COLOR='\033[0m' function info() { (echo >&2 -e "[${WHITE}${BOLD}INFO${NO_COLOR}] $*") } function error() { (echo >&2 -e "[${RED}ERROR${NO_COLOR}] $*") } function warning() { (echo >&2 -e "${YELLOW}[WARNING] $*${NO_COLOR}") } function ok() { (echo >&2 -e "[${GREEN}${BOLD} OK ${NO_COLOR}] $*") } function print_delim() { echo "==============================================" } function get_now() { date +%s } function time_elapsed_s() { local start="${1:-$(get_now)}" local end="$(get_now)" echo "$end - $start" | bc -l } function success() { print_delim ok "$1" print_delim } function fail() { print_delim error "$1" print_delim exit 1 } function determine_gpu_use_target() { local arch="$(uname -m)" local gpu_platform="UNKNOWN" local use_gpu=0 local nv=0 local amd=0 local need_cuda=0 local need_rocm=0 if [[ "$USE_GPU_TARGET" != "0" ]]; then if [[ "${arch}" == "aarch64" ]]; then if lsmod | grep -q nvgpu; then if ldconfig -p | grep -q cudart; then use_gpu=1 fi fi else ## x86_64 mode # Check the existence of nvidia-smi and rocm-smi if [[ ! -x "$(command -v nvidia-smi)" ]]; then nv=1 info ${YELLOW}"No nvidia-smi found."${NO_COLOR} elif [[ -z "$(nvidia-smi)" ]]; then nv=2 info ${YELLOW}"No NVIDIA GPU device found."${NO_COLOR} fi if [[ ! -x "$(command -v rocm-smi)" ]]; then amd=1 info ${YELLOW}"No rocm-smi found."${NO_COLOR} elif [[ -z "$(rocm-smi)" ]]; then amd=2 info ${YELLOW}"No AMD GPU device found."${NO_COLOR} fi if (( $nv == 0 )); then use_gpu=1 need_cuda=1 gpu_platform="NVIDIA" info ${GREEN}"NVIDIA GPU device found."${NO_COLOR} elif (( $amd == 0 )); then use_gpu=1 need_rocm=1 gpu_platform="AMD" else gpu_platform="UNKNOWN" warning ${YELLOW}"No any GPU device found."${NO_COLOR} fi if (( $amd == 0 )); then info ${GREEN}"AMD GPU device found."${NO_COLOR} fi if (( $nv == 0)) && (( $amd == 0 )); then info ${GREEN}"NVIDIA GPU device is chosen for the build."${NO_COLOR} fi fi fi export TF_NEED_CUDA="${need_cuda}" export TF_NEED_ROCM="${need_rocm}" export USE_GPU_TARGET="${use_gpu}" export GPU_PLATFORM="${gpu_platform}" } function file_ext() { local filename="$(basename $1)" local actual_ext="${filename##*.}" if [[ "${actual_ext}" == "${filename}" ]]; then actual_ext="" fi echo "${actual_ext}" } function c_family_ext() { local actual_ext actual_ext="$(file_ext $1)" for ext in "h" "hh" "hxx" "hpp" "cxx" "cc" "cpp" "cu"; do if [[ "${ext}" == "${actual_ext}" ]]; then return 0 fi done return 1 } function find_c_cpp_srcs() { find "$@" -type f -name "*.h" \ -o -name "*.c" \ -o -name "*.hpp" \ -o -name "*.cpp" \ -o -name "*.hh" \ -o -name "*.cc" \ -o -name "*.hxx" \ -o -name "*.cxx" \ -o -name "*.cu" } function proto_ext() { if [[ "$(file_ext $1)" == "proto" ]]; then return 0 else return 1 fi } function find_proto_srcs() { find "$@" -type f -name "*.proto" } function py_ext() { if [[ "$(file_ext $1)" == "py" ]]; then return 0 else return 1 fi } function find_py_srcs() { find "$@" -type f -name "*.py" } function bash_ext() { local actual_ext actual_ext="$(file_ext $1)" for ext in "sh" "bash" "bashrc"; do if [[ "${ext}" == "${actual_ext}" ]]; then return 0 fi done return 1 } function bazel_extended() { local actual_ext="$(file_ext $1)" if [[ -z "${actual_ext}" ]]; then if [[ "${arg}" == "BUILD" || "${arg}" == "WORKSPACE" ]]; then return 0 else return 1 fi else for ext in "BUILD" "bazel" "bzl"; do if [[ "${ext}" == "${actual_ext}" ]]; then return 0 fi done return 1 fi } function prettier_ext() { local actual_ext actual_ext="$(file_ext $1)" for ext in "md" "json" "yml"; do if [[ "${ext}" == "${actual_ext}" ]]; then return 0 fi done return 1 } function find_prettier_srcs() { find "$@" -type f -name "*.md" \ -or -name "*.json" \ -or -name "*.yml" } # Exits the script if the command fails. function run() { if [ "${VERBOSE}" = yes ]; then echo "${@}" "${@}" || exit $? else local errfile="${APOLLO_ROOT_DIR}/.errors.log" echo "${@}" >"${errfile}" if ! "${@}" >>"${errfile}" 2>&1; then local exitcode=$? cat "${errfile}" 1>&2 exit $exitcode fi fi } #commit_id=$(git log -1 --pretty=%H) function git_sha1() { if [ -x "$(which git 2>/dev/null)" ] && [ -d "${APOLLO_ROOT_DIR}/.git" ]; then git rev-parse --short HEAD 2>/dev/null || true fi } function git_date() { if [ -x "$(which git 2>/dev/null)" ] && [ -d "${APOLLO_ROOT_DIR}/.git" ]; then git log -1 --pretty=%ai | cut -d " " -f 1 || true fi } function git_branch() { if [ -x "$(which git 2>/dev/null)" ] && [ -d "${APOLLO_ROOT_DIR}/.git" ]; then git rev-parse --abbrev-ref HEAD else echo "@non-git" fi } function read_one_char_from_stdin() { local answer read -r -n1 answer # Bash 4.x+: ${answer,,} to lowercase, ${answer^^} to uppercase echo "${answer}" | tr '[:upper:]' '[:lower:]' } function optarg_check_for_opt() { local opt="$1" local optarg="$2" if [[ -z "${optarg}" || "${optarg}" =~ ^-.* ]]; then error "Missing parameter for ${opt}. Exiting..." exit 3 fi } function setup_gpu_support() { if [ -z "${GPU_SETUP_COMPLETED}" ]; then GPU_SETUP_COMPLETED=1 if [ -e /usr/local/cuda/ ]; then pathprepend /usr/local/cuda/bin fi determine_gpu_use_target local dev="cpu" if [ "${USE_GPU_TARGET}" -gt 0 ]; then dev="gpu" fi local torch_path="/usr/local/libtorch_${dev}/lib" if [ -d "${torch_path}" ]; then # Runtime default: for ./bazel-bin/xxx/yyy to work as expected pathprepend ${torch_path} LD_LIBRARY_PATH fi fi } if ${APOLLO_IN_DOCKER} ; then setup_gpu_support fi
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/planning.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name run_module planning "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/mobileye.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" # run_customized_path command_name module_name run_customized_path drivers/mobileye mobileye "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/navigation_localization.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name run_module localization "$@" --localization_config_file=/apollo/modules/localization/conf/navi_localization_config.pb.txt
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/storytelling.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" # run_module command_name module_name run_module storytelling "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/msf_local_evaluation.sh
#! /bin/bash if [ $# -lt 1 ]; then echo "Usage:" echo "$0 [bags folder] evaluate fusion and lidar localization result" echo "$0 [bags folder] [ant arm file] evaluate fusion, lidar and gnss localization result" exit 1 fi IN_FOLDER=$1 if [ $# -eq 2 ]; then ANT_IMU_FILE=$2 else ANT_IMU_FILE="" fi DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "${DIR}/apollo_base.sh" GNSS_LOC_TOPIC="/apollo/localization/msf_gnss" LIDAR_LOC_TOPIC="/apollo/localization/msf_lidar" FUSION_LOC_TOPIC="/apollo/localization/pose" ODOMETRY_LOC_TOPIC="/apollo/sensor/gnss/odometry" CLOUD_TOPIC="/apollo/sensor/velodyne64/compensator/PointCloud2" GNSS_LOC_FILE="gnss_loc.txt" LIDAR_LOC_FILE="lidar_loc.txt" FUSION_LOC_FILE="fusion_loc.txt" ODOMETRY_LOC_FILE="odometry_loc.txt" function data_exporter() { local BAG_FILE=$1 local OUT_FOLDER=$2 $APOLLO_BIN_PREFIX/modules/localization/msf/local_tool/data_extraction/cyber_record_parser \ --bag_file $BAG_FILE \ --out_folder $OUT_FOLDER \ --cloud_topic $CLOUD_TOPIC \ --gnss_loc_topic $GNSS_LOC_TOPIC \ --lidar_loc_topic $LIDAR_LOC_TOPIC \ --fusion_loc_topic $FUSION_LOC_TOPIC \ --odometry_loc_topic $ODOMETRY_LOC_TOPIC } function compare_poses() { local IN_FOLDER=$1 $APOLLO_BIN_PREFIX/modules/localization/msf/local_tool/data_extraction/compare_poses \ --in_folder $IN_FOLDER \ --loc_file_a $GNSS_LOC_FILE \ --loc_file_b $ODOMETRY_LOC_FILE \ --imu_to_ant_offset_file "$ANT_IMU_FILE" \ --compare_file "compare_gnss_odometry.txt" $APOLLO_BIN_PREFIX/modules/localization/msf/local_tool/data_extraction/compare_poses \ --in_folder $IN_FOLDER \ --loc_file_a $LIDAR_LOC_FILE \ --loc_file_b $ODOMETRY_LOC_FILE \ --compare_file "compare_lidar_odometry.txt" $APOLLO_BIN_PREFIX/modules/localization/msf/local_tool/data_extraction/compare_poses \ --in_folder $IN_FOLDER \ --loc_file_a $FUSION_LOC_FILE \ --loc_file_b $ODOMETRY_LOC_FILE \ --compare_file "compare_fusion_odometry.txt" } cd $IN_FOLDER for item in $(ls -l *record.* | awk '{print $9}'); do SEGMENTS=$(echo $item | awk -F'.' '{print NF}') DIR_NAME=$(echo $item | cut -d . -f ${SEGMENTS}) if [ -d "${DIR_NAME}" ]; then rm -r ${DIR_NAME} fi mkdir ${DIR_NAME} data_exporter "${item}" "${DIR_NAME}" compare_poses "${DIR_NAME}/pcd" done rm -rf compare_fusion_odometry_all.txt touch compare_fusion_odometry_all.txt for item in $(find . -name "compare_fusion_odometry.txt"); do cat $item >> compare_fusion_odometry_all.txt done rm -rf compare_lidar_odometry_all.txt touch compare_lidar_odometry_all.txt for item in $(find . -name "compare_lidar_odometry.txt"); do cat $item >> compare_lidar_odometry_all.txt done rm -rf compare_gnss_odometry_all.txt touch compare_gnss_odometry_all.txt for item in $(find . -name "compare_gnss_odometry.txt"); do cat $item >> compare_gnss_odometry_all.txt done echo "" echo "Fusion localization result:" python ${APOLLO_ROOT_DIR}/modules/tools/localization/evaluate_compare.py compare_fusion_odometry_all.txt echo "" echo "Lidar localization result:" python ${APOLLO_ROOT_DIR}/modules/tools/localization/evaluate_compare.py compare_lidar_odometry_all.txt if [ $# -eq 2 ]; then echo "" echo "GNSS localization result:" python ${APOLLO_ROOT_DIR}/modules/tools/localization/evaluate_compare.py compare_gnss_odometry_all.txt distance_only fi
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/record_map_data.py
#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### """ Start apollo data recorder. It lists all available disks mounted under /media, and prioritize them in order: - Disk#1. Largest NVME disk - Disk#2. Smaller NVME disk - ... - Disk#x. Largest Non-NVME disk - Disk#y. Smaller Non-NVME disk - ... Run with '--help' to see more options. """ import argparse import datetime import os import subprocess import sys import psutil MAP_COLLECTION_DATA_TOPICS = [ '/apollo/monitor/system_status', '/apollo/sensor/gnss/best_pose', '/apollo/sensor/gnss/gnss_status', '/apollo/sensor/gnss/imu', '/apollo/sensor/gnss/ins_stat', '/apollo/sensor/gnss/odometry', '/apollo/sensor/gnss/raw_data', '/tf', '/tf_static', '/apollo/sensor/camera/front_12mm/image/compressed', '/apollo/sensor/camera/front_6mm/image/compressed', '/apollo/sensor/lidar16/front/up/Scan', '/apollo/sensor/lidar16/front/up/PointCloud2', '/apollo/sensor/lidar16/front/up/compensator/PointCloud2', '/apollo/sensor/lidar128/PointCloud2', '/apollo/sensor/lidar128/compensator/PointCloud2', '/apollo/sensor/velodyne64/PointCloud2', '/apollo/sensor/velodyne64/compensator/PointCloud2', '/apollo/sensor/velodyne64/VelodyneScan', ] def shell_cmd(cmd, alert_on_failure=True): """Execute shell command and return (ret-code, stdout, stderr).""" print('SHELL > {}'.format(cmd)) proc = subprocess.Popen(cmd, shell=True, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) ret = proc.wait() stdout = proc.stdout.read().decode('utf-8') if proc.stdout else None stderr = proc.stderr.read().decode('utf-8') if proc.stderr else None if alert_on_failure and stderr and ret != 0: sys.stderr.write('{}\n'.format(stderr)) return (ret, stdout, stderr) class ArgManager(object): """Arguments manager.""" def __init__(self): self.parser = argparse.ArgumentParser( description="Manage apollo data recording.") self.parser.add_argument('--start', default=False, action="store_true", help='Start recorder. It is the default ' 'action if no other actions are triggered. In ' 'that case, the False value is ignored.') self.parser.add_argument('--stop', default=False, action="store_true", help='Stop recorder.') self.parser.add_argument('--split_duration', default="1m", help='Duration to split bags, will be applied ' 'as parameter to "rosbag record --duration".') self._args = None def args(self): """Get parsed args.""" if self._args is None: self._args = self.parser.parse_args() return self._args class DiskManager(object): """Disk manager.""" def __init__(self): """Manage disks.""" disks = [] for disk in psutil.disk_partitions(): if not disk.mountpoint.startswith('/media/'): continue disks.append({ 'mountpoint': disk.mountpoint, 'available_size': DiskManager.disk_avail_size(disk.mountpoint), 'is_nvme': disk.mountpoint.startswith('/media/apollo/internal_nvme'), }) # Prefer NVME disks and then larger disks. self.disks = sorted( disks, reverse=True, key=lambda disk: (disk['is_nvme'], disk['available_size'])) @staticmethod def disk_avail_size(disk_path): """Get disk available size.""" statvfs = os.statvfs(disk_path) return statvfs.f_frsize * statvfs.f_bavail class Recorder(object): """Data recorder.""" def __init__(self, args): self.args = args self.disk_manager = DiskManager() def start(self): """Start recording.""" if Recorder.is_running(): print('Another data recorder is running, skip.') return disks = self.disk_manager.disks # Use the best disk, or fallback '/apollo' if none available. disk_to_use = disks[0]['mountpoint'] if len(disks) > 0 else '/apollo' topics = list(MAP_COLLECTION_DATA_TOPICS) self.record_task(disk_to_use, topics) def stop(self): """Stop recording.""" shell_cmd('pkill -f "cyber_recorder record"') def record_task(self, disk, topics): """Record tasks into the <disk>/data/bag/<task_id> directory.""" task_id = datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S') task_dir = os.path.join(disk, 'data/bag', task_id) print('Recording bag to {}'.format(task_dir)) log_file = '/apollo/data/log/apollo_record.out' topics_str = ' -c '.join(topics) os.makedirs(task_dir) cmd = ''' cd "{}" source /apollo/scripts/apollo_base.sh source /apollo/cyber/setup.bash nohup cyber_recorder record -c {} >{} 2>&1 & '''.format(task_dir, topics_str, log_file) shell_cmd(cmd) @staticmethod def is_running(): """Test if the given process running.""" _, stdout, _ = shell_cmd('pgrep -f "cyber_recorder record" | grep -cv \'^1$\'', False) # If stdout is the pgrep command itself, no such process is running. return stdout.strip() != '1' if stdout else False def main(): """Main entry.""" arg_manager = ArgManager() args = arg_manager.args() recorder = Recorder(args) if args.stop: recorder.stop() else: recorder.start() if __name__ == '__main__': main()
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/routing.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name run_module routing "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/clear.py
#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### """ clear the extra -dev due to install rule """ import os from pathlib import Path output_dir = "/opt/apollo/neo/packages" if __name__ == "__main__": for d in os.listdir(output_dir): d_wrapper = Path(os.path.join(output_dir, d)) cyberfile = d_wrapper / "local" / "cyberfile.xml" if cyberfile.exists(): content = None with cyberfile.open("r") as f: content = f.read() while "-dev-dev" in content: content = content.replace("-dev-dev", "-dev") with cyberfile.open("w+") as f: f.write(content)
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/apollo_lint.sh
#! /usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" # shellcheck source=./apollo.bashrc source "${TOP_DIR}/scripts/apollo.bashrc" : ${STAGE:=dev} PYTHON_LINT_FLAG=0 CPP_LINT_FLAG=0 SHELL_LINT_FLAG=0 function _cpp_lint_impl() { bazel test --config=cpplint "$@" } function run_cpp_lint() { pushd "${APOLLO_ROOT_DIR}" >/dev/null local cpp_dirs="cyber" if [[ "${STAGE}" == "dev" ]]; then cpp_dirs="${cpp_dirs} modules" fi for prey in $(find ${cpp_dirs} -name BUILD \ | xargs grep -l -E 'cc_library|cc_test|cc_binary|gpu_library' \ | xargs grep -L 'cpplint()'); do warning "unattended BUILD file found: ${prey}. Add cpplint() automatically." sed -i '1i\load("//tools:cpplint.bzl", "cpplint")\n' "${prey}" sed -i -e '$a\\ncpplint()' "${prey}" local buidifier buidifier="$(command -v buildifier)" if [ ! -z "${buidifier}" ]; then ${buidifier} -lint=fix "${prey}" fi done popd >/dev/null local targets="//cyber/..." _cpp_lint_impl "${targets}" if [[ "${STAGE}" == "dev" ]]; then _cpp_lint_impl "//modules/..." fi } function run_sh_lint() { local shellcheck_cmd shellcheck_cmd="$(command -v shellcheck)" if [ -z "${shellcheck_cmd}" ]; then warning "Command 'shellcheck' not found. For Debian/Ubuntu systems," \ "please run the following command to install it: " warning " sudo apt-get -y update" warning " sudo apt-get -y install shellcheck" exit 1 fi local sh_dirs="cyber scripts docker tools" if [[ "${STAGE}" == "dev" ]]; then sh_dirs="modules ${sh_dirs}" fi sh_dirs=$(printf "${APOLLO_ROOT_DIR}/%s " ${sh_dirs}) run find ${sh_dirs} -type f \( -name "*.sh" -or -name "*.bashrc" \) -exec \ shellcheck -x --shell=bash {} + for script in ${APOLLO_ROOT_DIR}/*.sh; do run shellcheck -x --shell=bash "${script}" done } function run_py_lint() { local flake8_cmd flake8_cmd="$(command -v flake8)" if [ -z "${flake8_cmd}" ]; then warning "Command flake8 not found. You can install it manually via:" warning " '[sudo -H] python3 -m pip install flake8'" exit 1 fi local py_dirs="cyber docker tools" if [[ "${STAGE}" == "dev" ]]; then py_dirs="modules ${py_dirs}" fi py_dirs=$(printf "${APOLLO_ROOT_DIR}/%s " ${py_dirs}) run find ${py_dirs} -type f \( -name "*.py" \) -exec \ flake8 {} \; } function print_usage() { info "Usage: $0 [Options]" info "Options:" info "${TAB}--py Lint Python files" info "${TAB}--sh Lint Bash scripts" info "${TAB}--cpp Lint cpp source files" info "${TAB}-a|--all Lint all. Equivalent to \"--py --sh --cpp\"" info "${TAB}-h|--help Show this message and exit" } function parse_cmdline_args() { if [[ "$#" -eq 0 ]]; then CPP_LINT_FLAG=1 return 0 fi while [[ "$#" -gt 0 ]]; do local opt="$1" shift case "${opt}" in --py) PYTHON_LINT_FLAG=1 ;; --cpp) CPP_LINT_FLAG=1 ;; --sh) SHELL_LINT_FLAG=1 ;; -a | --all) PYTHON_LINT_FLAG=1 CPP_LINT_FLAG=1 SHELL_LINT_FLAG=1 ;; -h | --help) print_usage exit 0 ;; *) warning "Unknown option: ${opt}" print_usage exit 1 ;; esac done } function main() { parse_cmdline_args "$@" if [[ "${CPP_LINT_FLAG}" -eq 1 ]]; then run_cpp_lint fi if [[ "${PYTHON_LINT_FLAG}" -eq 1 ]]; then run_py_lint fi if [[ "${SHELL_LINT_FLAG}" -eq 1 ]]; then run_sh_lint fi } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/transform.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${DIR}/scripts/apollo_base.sh" function start() { LOG="${APOLLO_ROOT_DIR}/data/log/transform.out" CMD="cyber_launch start /apollo/modules/transform/launch/static_transform.launch" NUM_PROCESSES="$(pgrep -f "modules/transform/dag/static_transform.dag" | grep -cv '^1$')" if [ "${NUM_PROCESSES}" -eq 0 ]; then eval "nohup ${CMD} </dev/null >${LOG} 2>&1 &" fi } function stop() { eval "nohup cyber_launch stop /apollo/modules/transform/launch/static_transform.launch < /dev/null 2>&1 &" } # run command_name module_name function run() { case $1 in start) start ;; stop) stop ;; restart) stop start ;; *) start ;; esac } run "$1"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/transcribe.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" ${TOP_DIR}/bazel-bin/modules/tools/rosbag/transcribe "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/shfmt.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### # Usage: # shfmt.sh <path/to/src/dir/or/files> # Fail on error set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" SHELL_FORMAT_CMD="shfmt" function _find_shell_srcs() { find "$@" -type f -name "*.sh" \ -o -name "*.bash" \ -o -name "*.bashrc" } function _shell_ext() { local __ext __ext="$(file_ext $1)" for ext in "sh" "bash" "bashrc"; do if [ "${ext}" == "${__ext}" ]; then return 0 fi done return 1 } function check_shfmt() { SHELL_FORMAT_CMD="$(command -v shfmt)" if [ -z "${SHELL_FORMAT_CMD}" ]; then error "Oops, shfmt missing..." error "Please make sure shfmt is installed and check your PATH settings." exit 1 fi } function shell_format_run() { # Use settings in .editorconfig ${SHELL_FORMAT_CMD} -w "$@" } function run_shfmt() { for target in "$@"; do if [ -f "${target}" ]; then if _shell_ext "${target}"; then shell_format_run "${target}" info "Done formatting ${target}" else warning "Do nothing. ${target} is not a bash scripts." fi else local srcs srcs="$(_find_shell_srcs ${target})" if [ -z "${srcs}" ]; then ok "No need to format shell scripts under ${target} as none found" continue fi shell_format_run ${srcs} ok "Done formatting shell scripts under ${target}" fi done } function main() { check_shfmt if [ "$#" -eq 0 ]; then error "Usage: $0 <path/to/dirs/or/files>" exit 1 fi run_shfmt "$@" } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/third_party_perception.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "$DIR/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name # run third_party_perception "$@" --use_navigation_mode cyber_launch stop modules/third_party_perception/launch/third_party_perception.launch cyber_launch start modules/third_party_perception/launch/third_party_perception.launch
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/install_gcc.sh
#! /usr/bin/env bash # This script installs multiple versions of gcc/g++ on ubuntu 18.04. if [ ! -x "$(which add-apt-repository)" ]; then sudo apt-get -y update sudo apt-get -y install software-properties-common fi ubuntu_release="$(lsb_release -rs)" if [ "${ubuntu_release}" == "16.04" ] || [ "${ubuntu_release}" == "18.04" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test fi sudo apt-get -y update \ && sudo apt-get -y install \ gcc-7 \ g++-7 \ gcc-8 \ g++-8 \ gcc-9 \ g++-9 \ && sudo apt-get clean sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 80 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 70 # sudo update-alternatives --config gcc # sudo update-alternatives --config g++
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/map_xysl.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$DIR/apollo_base.sh" ${DIR}/../bazel-bin/modules/map/tools/map_xysl --flagfile=${DIR}/../modules/common/data/global_flagfile.txt $@
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/canbus.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" # run function from apollo_base.sh run_module canbus "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/record_message.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2022 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### # """ # Save the full data into /apollo/data/bag/ReusedRecordsPool, # which will be cleared every time the smart recorder get started. # Meanwhile, restore the messages we are interested in to /apollo/data/bag/<task_id> directory. # """ function start() { local APOLLO_ROOT_DIR="/apollo" TIME="$(date +%F-%H-%M-%S)" MODULE="smart_recorder" REUSE_POOL_DIR="${APOLLO_ROOT_DIR}/data/ReusedRecordsPool" TASK_EXE_DIR="${APOLLO_ROOT_DIR}/data/${MODULE}/${TIME}" LOG_DIR="${APOLLO_ROOT_DIR}/data/log" mkdir -p $LOG_DIR sudo chmod -R 777 $LOG_DIR LOG="${LOG_DIR}/smart_recorder.out" RECORD_EXE="${APOLLO_BIN_PREFIX}/modules/data/tools/${MODULE}/${MODULE}" if [[ ! -f ${RECORD_EXE} ]]; then RECORD_EXE="/opt/apollo/neo/packages/apollo-data-dev/latest/bin/tools/${MODULE}/${MODULE}" fi if [[ ! -f ${RECORD_EXE} ]]; then echo "can't fine smart_recorder. Have you installed apollo-data-dev?" exit -1 fi NUM_PROCESSES="$(pgrep -f "smart_recorder" | grep -cv '^1$')" if [ "${NUM_PROCESSES}" -ne 0 ]; then pkill -SIGINT -f smart_recorder fi nohup ${RECORD_EXE} --source_records_dir=${REUSE_POOL_DIR} \ --restored_output_dir=${TASK_EXE_DIR} < /dev/null > ${LOG} 2>&1 & } function stop() { pkill -SIGINT -f smart_recorder } case $1 in start) start ;; stop) stop ;; restart) stop start ;; *) start ;; esac
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/control_info.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" ${TOP_DIR}/bazel-bin/modules/tools/control_info/control_info "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/velodyne.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${DIR}/scripts/apollo_base.sh" function start() { LOG="${APOLLO_ROOT_DIR}/data/log/velodyne.out" CMD="cyber_launch start /apollo/modules/drivers/lidar/velodyne/launch/velodyne.launch" NUM_PROCESSES="$(pgrep -f "/apollo/modules/drivers/lidar/velodyne/dag/velodyne.dag" | grep -cv '^1$')" if [ "${NUM_PROCESSES}" -eq 0 ]; then eval "nohup ${CMD} </dev/null >${LOG} 2>&1 &" fi } function stop() { eval "nohup cyber_launch stop /apollo/modules/drivers/lidar/velodyne/launch/velodyne.launch < /dev/null 2>&1 &" } # run command_name module_name function run() { case $1 in start) start ;; stop) stop ;; restart) stop start ;; *) start ;; esac } run "$1"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/cyberfile.xml
<package format="2"> <name>origin-scripts</name> <version>local</version> <description> Some apollo origin scripts. </description> <maintainer email="apollo-support@baidu.com">Apollo</maintainer> <license>Apache License 2.0</license> <url type="website">https://www.apollo.auto/</url> <url type="repository">https://github.com/ApolloAuto/apollo</url> <url type="bugtracker">https://github.com/ApolloAuto/apollo/issues</url> <type>module-wrapper</type> <src_path url="https://github.com/ApolloAuto/apollo">//dev/scripts</src_path> </package>
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/after_install.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" APOLLO_OUTPUT="/opt/apollo/neo/packages" clear_dev_scripts=${TOP_DIR}/scripts/clear.py dreamview_launch=${APOLLO_OUTPUT}/dreamview-dev/local/launch/dreamview.launch dreamview_src_launch=${APOLLO_OUTPUT}/dreamview-dev/local/src/launch/dreamview.launch planning_dag=${APOLLO_OUTPUT}/planning-dev/local/dag/planning.dag planning_src_dag=${APOLLO_OUTPUT}/planning-dev/local/src/dag/planning.dag sed -i "s/\/apollo\/bazel-bin\/modules\/dreamview\/dreamview/dreamview/g" $dreamview_launch sed -i "s/\/apollo\/bazel-bin\/modules\/dreamview\/dreamview/dreamview/g" $dreamview_src_launch sed -i "s/\/opt\/apollo\/neo\/packages\/planning-gpu-dev\/latest\/lib\/libplanning_component.so/\/opt\/apollo\/neo\/packages\/planning-dev\/latest\/lib\/libplanning_component.so/g" $planning_dag sed -i "s/\/opt\/apollo\/neo\/packages\/planning-gpu-dev\/latest\/lib\/libplanning_component.so/\/opt\/apollo\/neo\/packages\/planning-dev\/latest\/lib\/libplanning_component.so/g" $planning_src_dag python3 $clear_dev_scripts
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/install_esdcan_library.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### set -ex action="install" if [[ $# -ge 1 ]]; then action="$1" fi DEST_DIR_BASE="third_party/can_card_library/esd_can" CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DEST_DIR="${CURR_DIR}/../${DEST_DIR_BASE}" [[ -d ${DEST_DIR}/include ]] && rm -rf ${DEST_DIR}/include [[ -d ${DEST_DIR}/lib ]] && rm -rf ${DEST_DIR}/lib if [[ "${action}" == "install" ]]; then mkdir -p "${DEST_DIR}/include" mkdir -p "${DEST_DIR}/lib" CONTRIB_REPO="${CURR_DIR}/../../apollo-contrib" if [[ -d "${CONTRIB_REPO}" ]]; then echo "apollo-contrib found." else sudo git clone https://github.com/ApolloAuto/apollo-contrib.git ${CONTRIB_REPO} fi pushd "${CONTRIB_REPO}" cp esd/include/* ${DEST_DIR}/include/ cp esd/lib64/libntcan.so.4.0.1 ${DEST_DIR}/lib popd pushd ${DEST_DIR}/lib ln -s libntcan.so.4.0.1 libntcan.so.4.0 ln -s libntcan.so.4.0.1 libntcan.so.4 popd fi
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/perception.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name # run perception "$@" cyber_launch stop /apollo/modules/perception/production/launch/perception_all.launch cyber_launch stop /apollo/modules/drivers/tools/image_decompress/launch/image_decompress.launch cyber_launch stop /apollo/modules/transform/launch/static_transform.launch cyber_launch start /apollo/modules/transform/launch/static_transform.launch & cyber_launch start /apollo/modules/drivers/tools/image_decompress/launch/image_decompress.launch & cyber_launch start /apollo/modules/perception/production/launch/perception_all.launch &
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/filter_planning.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### function print_help() { echo "Example: filter_planning.sh -[pc|np|wp] [-d|--dir] record1 record2 record3 ..." echo "-d|--dir the target storage directory" echo "This script works in three modes:" echo " -pc filter for perfect control, produces *.pc.record" echo " -po filter only for perception topic, produces *.po.record" echo " -np filter for planning dependencies, produces *.np.record" echo " -wp filter for planning and its dependencies, produces *.wp.record" echo " -pn filter out planning and prediction, produces *.npp.record" echo " -co filter out perception, prediction and planning, produces *.co.record" echo " -ni filter out pointcloud and images, produces *.ni.record" } routing_topic="/apollo/routing_response" planning_topic="/apollo/planning" prediction_topic="/apollo/prediction" drive_event_topic="/apollo/drive_event" pointcloud_topic="/apollo/sensor/velodyne64/compensator/PointCloud2" perception_topic=( '/apollo/perception/obstacles' '/apollo/perception/traffic_light' ) perfect_control_topic=() perfect_control_topic+=${perception_topic[@]} perfect_control_topic+=($routing_topic) perfect_control_topic+=("$prediction_topic") perfect_control_topic+=("/apollo/perception/traffic_light") planning_deps=() planning_deps+=${perfect_control_topic[@]} planning_deps+=('/apollo/canbus/chassis') planning_deps+=('/apollo/localization/pose') planning_deps+=('/apollo/navigation') planning_deps+=('/apollo/guardian') planning_deps+=('/apollo/monitor/system_status') planning_deps+=('/apollo/relative_map') image_topic=( '/apollo/sensor/camera/traffic/image_long' '/apollo/sensor/camera/traffic/image_short' ) planning_all=() planning_all+=${planning_deps[@]} planning_all+=($planning_topic) planning_all+=($drive_event_topic) #Three different filter mode #create perfect control mode record is_perfect_control=false #create a rosrecord with planning and its dependencies is_with_planning=false #create a rosrecord only with planning's dependencies is_no_planning=false #only perception topic is_perception=false #no prediction and no planning is_no_prediction_planning=false #no perception, no prediction and no planning, with only camera topic is_camera_only=false # no pointcloud, no image is_no_pointcloud_image=false work_mode_num=0 #argument parsing code from https://stackoverflow.com/a/14203146 POSITIONAL=() target_dir="" while [[ $# -gt 0 ]]; do key="$1" case $key in -po | --perception_only) is_perception=true work_mode_num=$((work_mode_num + 1)) shift # past argument ;; -pc | --perfectcontrol) is_perfect_control=true work_mode_num=$((work_mode_num + 1)) shift # past argument ;; -np | --noplanning) is_no_planning=true work_mode_num=$((work_mode_num + 1)) shift # past argument ;; -pn | --nopredictionplanning) is_no_prediction_planning=true work_mode_num=$((work_mode_num + 1)) shift # past argument ;; -wp | --withplanning) is_with_planning=true work_mode_num=$((work_mode_num + 1)) shift # past value ;; -co | --cameraonly) is_camera_only=true work_mode_num=$((work_mode_num + 1)) shift # past value ;; -ni | --noimage) is_no_pointcloud_image=true work_mode_num=$((work_mode_num + 1)) shift # past argument ;; -d | --dir) target_dir="$2" shift # past argument shift # past value ;; -h | --help) print_help exit 0 ;; *) # unknown option POSITIONAL+=("$1") # save it in an array for later shift # past argument ;; esac done if [[ $work_mode_num -eq 0 ]]; then print_help exit 0 fi set -- "${POSITIONAL[@]}" # restore positional parameters function filter() { target="" name=$(basename $1) ext=${name##*.} name="$name.$ext" if $is_perfect_control; then target="$2/${name%.*}.pc.record" cyber_recorder split -f $1 $(echo ${perfect_control_topic[@]} | sed 's/^\| / -c /g') -o $target fi if $is_no_prediction_planning; then target="$2/${name%.*}.npp.record" cyber_recorder split -f $1 -k $prediction_topic -k $planning_topic -o $target fi if $is_perception; then target="$2/${name%.*}.po.record" cyber_recorder split -f $1 $(echo ${perception_topic[@]} | sed 's/^\| / -k /g') -o $target fi if $is_no_planning; then target="$2/${name%.*}.np.record" cyber_recorder split -f $1 -k $planning_topic -o $target fi if $is_with_planning; then target="$2/${name%.*}.wp.record" cyber_recorder split -f $1 $(echo ${planning_all[@]} | sed 's/^\| / -c /g') -o $target fi if $is_camera_only; then target="$2/${name%.*}.co.record" cyber_recorder split -f $1 $(echo ${image_topic[@]} | sed 's/^\| / -c /g') -o $target fi if $is_no_pointcloud_image; then target="$2/${name%.*}.ni.record" cyber_recorder split -f $1 $(echo ${pointcloud_topic} ${image_topic[@]} | sed 's/^\| / -k /g') -o $target fi echo "filtered ${record} to $target" } for record in $@; do folder="" if [ -z $target_dir ]; then folder="$(dirname $record)" else folder=$target_dir fi filter $record $folder done
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/localization_online_visualizer.sh
#! /bin/bash DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "${DIR}/apollo_base.sh" cyber_launch start /apollo/modules/localization/launch/msf_visualizer.launch
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/record_play_pnc.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### source "$(dirname "${BASH_SOURCE[0]}")/apollo_base.sh" if [ $# -lt 1 ]; then echo "$0 record_file" exit fi cyber_recorder play \ -c /apollo/perception/obstacles \ -c /apollo/control \ -c /apollo/canbus/chassis \ -c /apollo/localization/pose \ -c /apollo/routing_request \ -c /apollo/routing_response \ -c /apollo/prediction \ -c /apollo/planning \ -c /apollo/canbus/chassis \ -c /apollo/guardian \ -c /apollo/perception/traffic_light \ -c /apollo/monitor/system_status \ -c /tf_static \ -c /apollo/control/pad \ -c /apollo/drive_event \ -c /apollo/monitor \ -c /tf \ -c /apollo/sensor/gnss/best_pose \ -f $*
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/start_gdb_server.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### function print_usage() { RED='\033[0;31m' BLUE='\033[0;34m' BOLD='\033[1m' NONE='\033[0m' echo -e "\n${RED}Usage${NONE}: .${BOLD}/start_gdb_server.sh${NONE} MODULE_NAME PORT_NUMBER" echo -e "${RED}MODULE_NAME${NONE}: ${BLUE}planning${NONE}: debug the planning module. ${BLUE}control${NONE}: debug the control module. ${BLUE}routing${NONE}: debug the routing module. ..., and so on." echo -e "${RED}PORT_NUMBER${NONE}: ${NONE}a port number, such as '1111'." } if [ $# -lt 2 ]; then print_usage exit 1 fi DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" MODULE_NAME=$1 PORT_NUM=$2 shift 2 # If there is a gdbserver process running, stop it first. GDBSERVER_NUMS=$(pgrep -c -x "gdbserver") if [ ${GDBSERVER_NUMS} -ne 0 ]; then sudo pkill -SIGKILL -f "gdbserver" fi echo ${MODULE_NAME} # Because the "grep ${MODULE_NAME}" always generates a process with the name of # "${MODULE_NAME}", I added another grep to remove grep itself from the output. PROCESS_ID=$(ps -ef | grep "mainboard" | grep "${MODULE_NAME}" | grep -v "grep" | awk '{print $2}') echo ${PROCESS_ID} # If the moudle is not started, start it first. if [ -z ${PROCESS_ID} ]; then #echo "The '${MODULE_NAME}' module is not started, please start it in the dreamview first. " #exit 1 # run function from apollo_base.sh # run command_name module_name run_module ${MODULE_NAME} "$@" PROCESS_ID=$(ps -ef | grep "mainboard" | grep "${MODULE_NAME}" | grep -v "grep" | awk '{print $2}') echo ${PROCESS_ID} fi sudo gdbserver :${PORT_NUM} --attach ${PROCESS_ID}
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/deploy_local_sanity_check.sh
#!/bin/bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### ##Install #$APOLLO_ROOT/scripts/deploy_local_sanity_check.sh ##Uninstall #$APOLLO_ROOT/scripts/deploy_local_sanity_check.sh -u APOLLO_ROOT=$(cd $(dirname $0)/.. && pwd) APOLLO_FILE="modules/dreamview" . $APOLLO_ROOT/scripts/apollo_base.sh if [ ! -e "$APOLLO_FILE" ]; then warning "Please run this script under Apollo source root dir." exit 1 fi if [ ! -e "$APOLLO_ROOT/.git" ]; then warning "$APOLLO_ROOT seems not a git repo." exit 1 fi type curl > /dev/null 2>&1 || { error >&2 "command curl not found, please install it with: sudo apt-get install curl" exit 1 } type perl > /dev/null 2>&1 || { error >&2 "command perl not found, please install it with: sudo apt-get install perl-base" exit 1 } function uninstall() { if [ -L "$APOLLO_ROOT/.git/hooks/post-commit" ]; then pushd $APOLLO_ROOT/.git/hooks > /dev/null rm post-commit popd > /dev/null ok "sanity check was removed." fi } while [ $# -gt 0 ]; do case "$1" in -u) uninstall && exit 0 ;; *) ;; esac shift done HOOKS_URL="http://code.qt.io/cgit/qt/qtrepotools.git/plain/git-hooks" HOOKS_DIR=$APOLLO_ROOT/tools/git-hooks HOOK_SCRITPS="git_post_commit_hook sanitize-commit" if [ ! -e $HOOKS_DIR ]; then mkdir -p $HOOKS_DIR fi pushd $HOOKS_DIR > /dev/null || error "Enter $HOOKS_DIR failed." for i in $HOOK_SCRITPS; do if [ ! -e "$HOOKS_DIR/$i" ]; then #info "pulling hooks: $i ..." curl -O $HOOKS_URL/$i if [ $? -ne 0 ]; then error "Failed to pull hooks: $i ." fi chmod +x $i fi done popd > /dev/null if [ ! -e "$APOLLO_ROOT/.git/hooks/post-commit" ]; then pushd $APOLLO_ROOT/.git/hooks > /dev/null || error "Enter target dir failed. " #info "deploy hooks..." ln -s $HOOKS_DIR/git_post_commit_hook post-commit if [ $? -eq 0 ]; then ok "Deploy sanity check done." else error "Failed to deploy sanity check." fi popd > /dev/null elif [ -L "$APOLLO_ROOT/.git/hooks/post-commit" ]; then info "Sanity check seems already deployed." elif [ -f "$APOLLO_ROOT/.git/hooks/post-commit" ]; then info "$APOLLO_ROOT/.git/hooks/post-commit hook seems already exists, please backup it and run this script again." fi
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/canbus_teleop.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." ./bazel-bin/modules/canbus/tools/teleop
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/ota.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### APOLLO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" CACHE_DIR="${APOLLO_ROOT}/.cache" function update() { UPDATE_TAG=$(python ${APOLLO_ROOT}/modules/tools/ota/query_client.py) if [ "$?" != "0" ]; then echo $UPDATE_TAG exit 1 fi tip="Type 'y' or 'Y' to start upgrade, or type any other key to exit" echo $tip read -n 1 user_agreed if [ "$user_agreed" != "y" ] && [ "$user_agreed" != "Y" ]; then exit 1 fi cp ${APOLLO_ROOT}/scripts/ota.sh "${CACHE_DIR}" ssh $DOCKER_USER@localhost bash ${CACHE_DIR}/ota.sh download $UPDATE_TAG python ${APOLLO_ROOT}/modules/tools/ota/verify_client.py if [ "$?" != "0" ]; then exit 1 fi [ -e "${CACHE_DIR}/apollo_release" ] && rm -rf "${CACHE_DIR}/apollo_release" tar xzf ${CACHE_DIR}/apollo_release.tar.gz -C ${CACHE_DIR} NEW_TAG="${UPDATE_TAG}-local" ssh $DOCKER_USER@localhost bash ${CACHE_DIR}/ota.sh setup $NEW_TAG python ${APOLLO_ROOT}/modules/tools/ota/update_client.py ${UPDATE_TAG} } function clean() { rm -rf ${CACHE_DIR}/apollo_update rm -rf ${CACHE_DIR}/apollo_release.tar.gz rm -rf ${CACHE_DIR}/sec_apollo_release.tar.gz rm -rf ${CACHE_DIR}/ota.sh docker stop test_container 1> /dev/null docker rm test_container 1> /dev/null } function setup() { docker exec test_container cp -Lr /root/mnt/apollo_release/apollo / docker commit test_container $1 echo "Please restart release docker with new release image: $1" clean } function download() { UPDATE_TAG=$1 docker pull $UPDATE_TAG if [ "$?" != "0" ]; then echo "Downloading fails!" exit 1 else echo "New release image has been downloaded!" fi docker ps -a --format "{{.Names}}" | grep 'test_container' 1> /dev/null if [ $? == 0 ]; then docker stop test_container 1> /dev/null docker rm -f test_container 1> /dev/null fi docker run -d -it --name test_container -v ${CACHE_DIR}:/root/mnt $UPDATE_TAG docker exec test_container cp /root/sec_apollo_release.tar.gz /root/mnt } case $1 in update) update ;; download) download $2 ;; setup) setup $2 ;; *) echo "Usage: ota.sh update" ;; esac
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/msf_poses_interpolation.sh
#! /bin/bash if [ $# -lt 4 ]; then echo "Usage: msf_poses_interpolator.sh [input_poses_path] [ref_timestamps_path] [extrinsic_path] [output_poses_path]" exit 1 fi DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "${DIR}/apollo_base.sh" $APOLLO_BIN_PREFIX/modules/localization/msf/local_tool/map_creation/poses_interpolator \ --input_poses_path $1 \ --ref_timestamps_path $2 \ --extrinsic_path $3 \ --output_poses_path $4
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/localization_ndt.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name case $1 in start) start_customized_path localization ndt_localization "$@" ;; stop) stop_customized_path localization ndt_localization "$@" ;; restart) stop_customized_path localization ndt_localization "$@" start_customized_path localization ndt_localization "$@" ;; *) start_customized_path localization ndt_localization "$@" ;; esac
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/create_map_from_xy.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### APOLLO_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" print_help() { echo "$0 --xy [--map_name MAP_NAME][--left_lane_num 0][--right_lane_num 0]" echo "$0 --xy set the input xy file, file that contains x,y" echo "$0 --map_name set the name of the map, default is the base name of the csv file" #echo "$0 --left_lane_num set the number of lanes at the left side of the trajectory, default is zero" #echo "$0 --right_lane_num set the number of lanes at the right side of the trajectory, default is zero" } POSITIONAL=() g_map_name="" g_xy_file="" #left_lane_num="0" #right_lane_num="0" while [[ $# -gt 0 ]]; do key="$1" case $key in -d | --dir) target_dir="$2" shift # past argument shift # past value ;; --xy) g_xy_file="$2" shift # past argument shift # past value ;; #-l|--left_lane_num) #left_lane_num="$2" #shift # past argument #shift # past value #;; #-r|--right_lane_num) #right_lane_num="$2" #shift # past argument #shift # past value #;; -h | --help) print_help exit 0 ;; *) # unknown option POSITIONAL+=("$1") # save it in an array for later shift # past argument ;; esac done if [ "$g_xy_file" == "" ]; then echo "argument --xy is required" print_help exit 0 fi if [ "$map_name" == "" ]; then map_name=$(basename $g_xy_file) map_name="${map_name%.*}" fi generate_map() { xy_file=$1 dir_name="${APOLLO_ROOT_DIR}/modules/map/data/$2" #left_num=$3 #right_num=$4 if [ -d ${dir_name} ]; then rm -rf ${dir_name}.last mv ${dir_name} ${dir_name}.last fi mkdir -p ${dir_name} python ${APOLLO_ROOT_DIR}/modules/tools/map_gen/map_gen_single_lane.py $xy_file $dir_name/base_map.txt 1.0 echo "--map_dir=${dir_name}" >> modules/common/data/global_flagfile.txt bash ${APOLLO_ROOT_DIR}/scripts/generate_routing_topo_graph.sh ${APOLLO_BIN_PREFIX}/modules/map/tools/sim_map_generator --map_dir=${dir_name} --output_dir=${dir_name} } generate_map $g_xy_file $map_name $left_lane_num $right_lane_num
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/planning_regenerate_golden.sh
#! /bin/bash # regenerate planning golden test log data. set -x D=/apollo/bazel-bin/modules/planning/ for T in integration_tests/garage_test \ integration_tests/sunnyvale_loop_test \ integration_tests/sunnyvale_big_loop_test; do $D/$T --test_update_golden_log done
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/navigation_perception.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" # run function from apollo_base.sh # run command_name module_name run_module perception "$@" --flagfile=/apollo/modules/perception/conf/perception_lowcost.conf
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/docker_start_user.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ############################################################################### function _create_user_account() { local user_name="$1" local uid="$2" local group_name="$3" local gid="$4" addgroup --gid "${gid}" "${group_name}" adduser --disabled-password --force-badname --gecos '' \ "${user_name}" --uid "${uid}" --gid "${gid}" # 2>/dev/null # copy init scripts manually cp /etc/skel/.* $(getent passwd ${user_name} | cut -d: -f6)/ usermod -aG sudo "${user_name}" usermod -aG video "${user_name}" } function setup_user_bashrc() { local uid="$1" local gid="$2" local user_home="/home/$3" # cp -rf /etc/skel/.{profile,bash*} "${user_home}" local RCFILES_DIR="/opt/apollo/rcfiles" local rc if [[ -d "${RCFILES_DIR}" ]]; then for entry in ${RCFILES_DIR}/*; do rc=$(basename "${entry}") if [[ "${rc}" = user.* ]]; then cp -rf "${entry}" "${user_home}/${rc##user}" fi done fi # Set user files ownership to current user, such as .bashrc, .profile, etc. # chown -R "${uid}:${gid}" "${user_home}" chown -R "${uid}:${gid}" ${user_home}/.* } function setup_user_account_if_not_exist() { local user_name="$1" local uid="$2" local group_name="$3" local gid="$4" if grep -q "^${user_name}:" /etc/passwd; then echo "User ${user_name} already exist. Skip setting user account." return fi _create_user_account "$@" setup_user_bashrc "${uid}" "${gid}" "${user_name}" } function grant_device_permissions() { # setup GPS device [ -e /dev/novatel0 ] && chmod a+rw /dev/novatel0 [ -e /dev/novatel1 ] && chmod a+rw /dev/novatel1 [ -e /dev/novatel2 ] && chmod a+rw /dev/novatel2 [ -e /dev/ttyACM0 ] && chmod a+rw /dev/ttyACM0 [ -e /dev/imu ] && chmod a+rw /dev/imu # setup camera device [ -e /dev/camera/obstacle ] && chmod a+rw /dev/camera/obstacle [ -e /dev/camera/trafficlights ] && chmod a+rw /dev/camera/trafficlights # setup audio device [ -e /dev/snd ] && usermod -a -G audio "$1" # setup compute device [ -e /dev/kfd ] && ! getent group render && \ echo "render:x:$(stat -c %g /dev/kfd):$1" >> /etc/group getent group render && usermod -a -G render $1 true } function setup_apollo_directories() { local apollo_dir="/opt/apollo" [[ -d "${apollo_dir}" ]] || mkdir -p "${apollo_dir}" # chown -R "${uid}:${gid}" "${apollo_dir}" chmod a+rw /opt /opt/apollo } # FIXME(infra): This will change core pattern on the host also, # where the `/apollo` directory may not exist. function setup_core_pattern() { if [[ -w /proc/sys/kernel/core_pattern ]]; then echo "/apollo/data/core/core_%e.%p" > /proc/sys/kernel/core_pattern fi } ##===================== Main ==============================## function main() { local user_name="$1" local uid="$2" local group_name="$3" local gid="$4" if [ "${uid}" != "${gid}" ]; then echo "Warning: uid(${uid}) != gid(${gid}) found." fi if [ "${user_name}" != "${group_name}" ]; then echo "Warning: user_name(${user_name}) != group_name(${group_name}) found." fi setup_user_account_if_not_exist "$@" setup_apollo_directories "${uid}" "${gid}" grant_device_permissions "${user_name}" setup_core_pattern } main "${DOCKER_USER}" "${DOCKER_USER_ID}" "${DOCKER_GRP}" "${DOCKER_GRP_ID}"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/apollo_release.sh
#! /usr/bin/env bash set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" export OPT_APOLLO="$(dirname "${APOLLO_SYSROOT_DIR}")" export PREFIX_DIR=/opt/apollo/neo/packages/ LIST_ONLY=0 RESOLVE_DEPS=0 PRE_CLEAN=0 BAZEL_OPTS=" -c opt --copt=-mavx2 --host_copt=-mavx2 --jobs=$(nproc) --local_ram_resources=HOST_RAM*0.5" SHORTHAND_TARGETS= CMDLINE_OPTIONS= INSTALL_OPTIONS= USE_GPU=-1 function _usage() { info "Usage: $0 <module>(Can be empty) [Options]" info "Options:" info "${TAB} -p, --prefix <DIR> Use absolute path <DIR> as install prefix instead of '/apollo/output'" info "${TAB} -l, --list Print the list of installed files; don't install anything" info "${TAB} -c, --clean Ensure clean install by removing prefix dir if exist before installing" info "${TAB} -r, --resolve Also resolve APT packages on which this release build depends" info "${TAB} -h, --help Show this message and exit" info "${TAB} --gpu Running GPU build" info "${TAB} --cpu Running CPU build" } function _check_arg_for_opt() { local opt="$1" local optarg="$2" if [[ -z "${optarg}" || "${optarg}" =~ ^-.* ]]; then error "Missing argument for ${opt}. Exiting..." exit 2 fi } function parse_cmdline_args() { local prefix_dir= local remained_args= while [[ $# -gt 0 ]]; do local opt="$1" shift case "${opt}" in -p | --prefix) _check_arg_for_opt "${opt}" "$1" prefix_dir="$1"; shift ;; -l | --list) LIST_ONLY=1 ;; -r | --resolve) RESOLVE_DEPS=1 ;; -c | --clean) PRE_CLEAN=1 ;; -h | --help) _usage exit 0 ;; --cpu) USE_GPU=0 ;; --gpu) USE_GPU=1 ;; *) remained_args="${remained_args} ${opt}" ;; esac done if [[ "${RESOLVE_DEPS}" -gt 0 && "${LIST_ONLY}" -gt 0 ]]; then error "'-l,--list' and '-r,--resolve' cannot be used together" _usage exit 1 fi if [[ "${prefix_dir}" = /* ]]; then PREFIX_DIR="${prefix_dir}" elif [[ -n "${prefix_dir}" ]]; then echo "Absolute prefix dir expected, got '${prefix_dir}'" exit 1 fi SHORTHAND_TARGETS="${remained_args}" } function determine_cpu_or_gpu_build() { if [ "${USE_GPU}" -lt 0 ]; then # USE_GPU unset, defaults to USE_GPU_TARGET USE_GPU="${USE_GPU_TARGET}" elif [ "${USE_GPU}" -gt "${USE_GPU_TARGET}" ]; then warning "USE_GPU=${USE_GPU} without GPU can't compile. Exiting ..." exit 1 fi if [ "${USE_GPU}" -eq 1 ]; then CMDLINE_OPTIONS="--config=gpu ${CMDLINE_OPTIONS}" INSTALL_OPTIONS=" --gpu ${INSTALL_OPTIONS}" ok "Running GPU build." else CMDLINE_OPTIONS="--config=cpu ${CMDLINE_OPTIONS}" ok "Running CPU build." fi } function determine_release_targets() { local targets_all if [[ "$#" -eq 0 ]]; then targets_all="//:install" echo "${targets_all}" return fi for component in $@; do local release_targets if [ "${component}" = "cyber" ]; then release_targets="//cyber:install" elif [[ -d "${APOLLO_ROOT_DIR}/modules/${component}" ]]; then release_targets="//modules/${component}:install" elif [ "${component}" = "scripts" ]; then release_targets="//docker/scripts:install union //scripts:install" else error "Unknown option: ${component}" _usage exit 1 fi if [ -z "${targets_all}" ]; then targets_all="${release_targets}" else targets_all="${targets_all} union ${release_targets}" fi done echo "${targets_all}" } function retrieve_so_deps() { ldd $1 | awk '/=>/ {print $3}' | sort -u | \ grep -Ev "^(${OPT_APOLLO}|/usr/local|${PREFIX_DIR})/" } export -f retrieve_so_deps function generate_solibs() { listing="$1" find ${PREFIX_DIR}/bin ${APOLLO_SYSROOT_DIR}/bin -executable -type f \ -exec bash -c 'retrieve_so_deps "$0"' {} \ >> ${listing} \; find ${PREFIX_DIR}/lib ${PREFIX_DIR}/cyber ${PREFIX_DIR}/modules \ -name "*.so" -exec bash -c 'retrieve_so_deps "$0"' {} \ >> ${listing} \; SYSLIB_DIRS=( /usr/local/fast-rtps/lib /usr/local/libtorch_cpu/lib /usr/local/libtorch_gpu/lib ${APOLLO_SYSROOT_DIR}/lib ) for libdir in ${SYSLIB_DIRS[@]}; do find ${libdir} \( -type f -or -type l \) -name "*.so" \ -exec bash -c 'retrieve_so_deps "$0"' {} \ >> ${listing} \; done find /usr/local/qt5/ -name "*.so" -exec bash -c 'retrieve_so_deps "$0"' {} \ >> ${listing} \; cat ${listing} | sort -u } function solib_locate() { solib="$1" if [[ ${solib} != "/"* || ! -e ${solib} ]]; then return fi dest="$2" # https://superuser.com/questions/363444 # /how-do-i-get-the-output-and-exit-value-of-a-subshell-when-using-bash-e if ! msg="$(dpkg -S ${solib} 2>/dev/null)" ; then echo "Warning: ${solib} doesn't seem to belong to any APT package." else result="$(echo "${msg}" | awk -F ': ' '{print $1}')" echo "${result}" >> ${dest} fi } PKGS_TXT="${PREFIX_DIR}/syspkgs.txt" function generate_apt_pkgs() { sudo apt-get -y update listing="$(mktemp /tmp/syslibs.XXXXXX)" pkgs="$(mktemp /tmp/pkgs.XXXXXX)" for solib in $(generate_solibs "${listing}"); do solib_locate "${solib}" "${pkgs}" done sort -u ${pkgs} > ${PKGS_TXT} rm -f ${listing} ${pkgs} } function generate_py_packages() { pushd ${PREFIX_DIR} > /dev/null touch __init__.py for dir in $(find cyber modules -type d); do touch $dir/__init__.py done popd > /dev/null } function resolve_directory_path() { pushd ${PREFIX_DIR} > /dev/null info "Resolve directory path for Apollo binary distribution..." mkdir -p bazel-bin ln -s ../cyber bazel-bin/cyber ln -s ../modules bazel-bin/modules ok "Done." popd > /dev/null } function run_install() { local install_targets install_targets="$(determine_release_targets ${SHORTHAND_TARGETS})" bazel run ${BAZEL_OPTS} ${CMDLINE_OPTIONS} ${install_targets} \ -- ${install_opts} ${INSTALL_OPTIONS} "${PREFIX_DIR}" # install files copy from source code. bazel run ${BAZEL_OPTS} ${CMDLINE_OPTIONS} //:install_src \ -- ${install_opts} ${INSTALL_OPTIONS} "${PREFIX_DIR}" } function export_python_path() { if [ `grep -c /opt/apollo/neo/packages/python-support/local ~/.bashrc` -ne 0 ]; then echo '\nexport PYTHONPATH=/opt/apollo/neo/packages/python-support/local:$PYTHONPATH' >> ~/.bashrc fi } function main() { parse_cmdline_args "$@" local install_opts= if [[ "${LIST_ONLY}" -gt 0 ]]; then install_opts="${install_opts} --list" fi if [[ "${PRE_CLEAN}" -gt 0 ]]; then install_opts="${install_opts} --pre_clean" fi determine_cpu_or_gpu_build run_install if [[ "${LIST_ONLY}" -gt 0 ]]; then return fi DIRS=("${PREFIX_DIR}/data/log" "${PREFIX_DIR}/data/bag" "${PREFIX_DIR}/data/core") for dir in ${DIRS[@]}; do if [[ ! -d "${dir}" ]]; then mkdir -p "${dir}" fi done if [[ "${RESOLVE_DEPS}" -gt 0 ]]; then info "Resolve runtime library dependencies and generate APT packages list..." generate_apt_pkgs ok "Done. Packages list has been writen to ${PKGS_TXT}" fi export_python_path # generate_py_packages # resolve_directory_path } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/record_bag.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${DIR}/apollo_base.sh" function start() { decide_task_dir $@ cd "${TASK_DIR}" # Start recording. record_bag_env_log LOG="/tmp/apollo_record.out" NUM_PROCESSES="$(pgrep -f "cyber_recorder record" | grep -cv '^1$')" if [ "${NUM_PROCESSES}" -eq 0 ]; then nohup cyber_recorder record -a -i 60 -m 2048 < /dev/null > "${LOG}" 2>&1 & fi } function stop() { pkill -SIGINT -f record } function help() { echo "Usage:" echo "$0 [start] Record bag to data/bag." echo "$0 stop Stop recording." echo "$0 help Show this help message." } case $1 in start) shift start $@ ;; stop) shift stop $@ ;; help) shift help $@ ;; restart) shift stop $@ start $@ ;; *) start $@ ;; esac
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/AGREEMENT.txt
THE APOLLO OPEN PLATFORM (“PLATFORM”) FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT ("AGREEMENT"). PLEASE READ THE AGREEMENT CAREFULLY. BY SELECTING THE "ACCEPT LICENSE AGREEMENT" (OR THE EQUIVALENT) BUTTON AND/OR BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, THEN SELECT THE "DECLINE LICENSE AGREEMENT" (OR THE EQUIVALENT) BUTTON AND YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. 1. DEFINITIONS. "Software" means the software identified above in binary form that you selected for download, install or use (in the version You selected for download, install or use) from Baidu or its authorized licensees, any other machine readable materials (including, but not limited to, libraries, source files, header files, and data files), any updates or error corrections provided by Baidu, and any user manuals, programming guides and other documentation provided to you by Baidu under this Agreement. 2. LICENSE GRANT: Subject to the terms and conditions of this Agreement, with the exception of different license terms and license grants for separate, individual third-party components as set forth below, the Software is licensed to you under the terms of the Apache 2.0 license available at: https://www.apache.org/licenses/LICENSE-2.0. You agree to these terms with respect to the Software. 3. THIRD PARTY CODE: Additional copyright notices and license terms applicable to portions of the Software are set forth below in Appendix A. You expressly agree to the license terms associated with third party code set forth in Appendix A. In addition to any terms and conditions of any third party license identified in Appendix A, the disclaimer of warranty and limitation of liability provisions in paragraphs 4 and 5 of this License Agreement shall apply to all Software in this distribution. YOU EXPRESSLY AGREE THAT YOU HAVE REVIEWED THE TERMS OF THE AGREEMENTS LINKED TO AND RESTATED IN APPENDIX A TO THIS AGREEMENT, AND THAT YOU AGREE TO THE TERMS OF THOSE AGREEMENTS. 4. DISCLAIMER OF WARRANTY. THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. BAIDU FURTHER DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. 5. LIMITATION OF LIABILITY. IN NO EVENT SHALL BAIDU BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR DATA USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT, EVEN IF BAIDU HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BAIDU’S ENTIRE LIABILITY FOR DAMAGES HEREUNDER SHALL IN NO EVENT EXCEED ONE CENT (U.S. $0.01). Copyright (c) 2018 Various License Holders. All Rights Reserved Apollo software is built on top of various other open source software packages, a complete list of licenses are located at https://github.com/ApolloAuto/apollo/blob/master/third_party/ACKNOWLEDGEMENT.txt By accepting this Service License Agreements, you confirm that you are not a resident or citizen of any country currently embargoed by the U.S. and that you are not otherwise prohibited from receiving the Licensed Software. You agree to the terms of all the License Agreements.
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/yapf.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2021 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### # Usage: # yapf.sh <path/to/python/dir/or/files> # Fail on error set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" function check_yapf() { if [ -z "$(command -v yapf)" ]; then error "Oops, yapf missing..." error "Please make sure yapf is installed and check your PATH" \ "settings. For Debian/Ubuntu, you can run the following command:" error " sudo pip3 install --upgrade --no-cache-dir yapf" exit 1 fi } function yapf_run() { # TODO(storypku): yapf has a '--recursive' option. yapf -i --style='{based_on_style: google}' "$@" } function run_yapf() { for target in "$@"; do if [ -f "${target}" ]; then if py_ext "${target}"; then yapf_run "${target}" info "Done formatting ${target}" else warning "Do nothing. ${target} is not a Python file." fi else local srcs srcs="$(find_py_srcs ${target})" if [ -z "${srcs}" ]; then warning "Do nothing. No Python files found under ${target} ." continue fi yapf_run ${srcs} ok "Done formatting Python files under ${target}" fi done } function main() { check_yapf if [ "$#" -eq 0 ]; then error "Usage: $0 <path/to/python/dirs/or/files>" exit 1 fi run_yapf "$@" } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/apollo_clean.sh
#! /usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" CORE_DIR="${TOP_DIR}/data/core" LOG_DIR="${TOP_DIR}/data/log" BAZEL_CLEAN_EXPUNGE=0 CORE_DUMP_CLEANUP=0 LOG_FILES_CLEANUP=0 function _clean_bazel_cache() { local opt="--async" if [ "$1" == "--expunge" ]; then opt="--expunge_async" fi bazel clean ${opt} # Remove bazel cache in associated directories if [ -d /apollo-simulator ]; then pushd /apollo-simulator >/dev/null bazel clean ${opt} popd >/dev/null fi } function _clean_config() { # Remove local bazel config. bash "${TOP_DIR}/scripts/apollo_config.sh" --clean } function _clean_core() { if [ -d "${CORE_DIR}" ]; then rm -f ${CORE_DIR}/core_* fi } function _clean_log() { if [ -d "${LOG_DIR}" ]; then rm -rf ${LOG_DIR}/* fi } function _clean_docs() { local docs_sh="${TOP_DIR}/scripts/apollo_docs.sh" if [ -f "${docs_sh}" ]; then bash "${docs_sh}" clean fi } function _print_usage() { echo -e "Usage:\n $0 [options]\nOptions:" echo "${TAB}--bazel Remove bazel output" echo "${TAB}--core Remove coredump files" echo "${TAB}--log Remove log files" echo "${TAB}-a, --all Equivalent to \"--bazel --core --log\"" echo "${TAB}--expunge Run \"bazel clean --expunge\"" echo "${TAB}-h, --help Show this message and exit" } function parse_arguments() { if [[ $# -eq 0 ]]; then _print_usage exit 1 fi while [ $# -gt 0 ]; do local opt="$1" shift case "${opt}" in --bazel) [ "${BAZEL_CLEAN_EXPUNGE}" -eq 0 ] && BAZEL_CLEAN_EXPUNGE=1 ;; --core) CORE_DUMP_CLEANUP=1 ;; --log) LOG_FILES_CLEANUP=1 ;; --expunge) BAZEL_CLEAN_EXPUNGE=2 ;; -a | --all) CORE_DUMP_CLEANUP=1 LOG_FILES_CLEANUP=1 [ "${BAZEL_CLEAN_EXPUNGE}" -eq 0 ] && BAZEL_CLEAN_EXPUNGE=1 ;; -h | --help) _print_usage exit 1 ;; *) _print_usage exit 1 ;; esac done } function main() { parse_arguments "$@" if ! "${APOLLO_IN_DOCKER}"; then error "The clean operation should be run from within docker container" exit 1 fi if [ "${BAZEL_CLEAN_EXPUNGE}" -eq 2 ]; then info "Clean bazel cache, opcode=${BAZEL_CLEAN_EXPUNGE}" _clean_bazel_cache "--expunge" elif [ "${BAZEL_CLEAN_EXPUNGE}" -eq 1 ]; then info "Clean bazel cache, opcode=${BAZEL_CLEAN_EXPUNGE}" _clean_bazel_cache fi _clean_config _clean_docs if [ "${CORE_DUMP_CLEANUP}" -eq 1 ]; then info "Cleanup core dump files under data/core/ ..." _clean_core fi if [ "${LOG_FILES_CLEANUP}" -eq 1 ]; then info "Cleanup log files under data/log/ ..." _clean_log fi success "Apollo cleanup done." } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/gps.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo_base.sh" # run function from apollo_base.sh run_customized_path drivers/gnss gnss "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/create_map_from_mobileye.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### if [ "$1" == "" ]; then echo "Must designate a map name" else echo "Generating map ${MAP}" MAP=$1 rm -rf modules/map/data/${MAP} mkdir modules/map/data/${MAP} if [ "$2" == "" ]; then echo "Generating map with a single lane" python ./modules/tools/create_map/create_map.py -i /tmp/lane.csv -o modules/map/data/${MAP}/base_map.txt -e modules/map/data/${MAP}/default_end_way_point.txt else LEFT_LANES=$2 RIGHT_LANES=$3 echo "Generating map with one center lane, ${LEFT_LANES} left lane(s), ${RIGHT_LANES} right lane(s)" python ./modules/tools/create_map/create_map.py -i /tmp/lane.csv -o modules/map/data/${MAP}/base_map.txt -e modules/map/data/${MAP}/default_end_way_point.txt --left_lanes ${LEFT_LANES} --right_lanes ${RIGHT_LANES} fi echo "--map_dir=modules/map/data/${MAP}" >> modules/common/data/global_flagfile.txt ./scripts/generate_routing_topo_graph.sh ${APOLLO_BIN_PREFIX}/modules/map/tools/sim_map_generator --map_dir=modules/map/data/${MAP} --output_dir=modules/map/data/${MAP} fi
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/mdfmt.sh
#! /usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" NPM_DOCS="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" function check_if_tools_installed() { if [ ! -x "$(command -v npm)" ]; then error "Please install npm first. Refer to ${NPM_DOCS} for help." exit 1 fi if ! npm list -g | grep -q prettier; then error "'prettier' not found. Please install it manually by running:" error "${TAB}sudo npm install -g --save-dev --save-exact prettier" exit 1 fi } function prettier_run() { npx prettier --write "$@" } function format_markdown_by_prettier() { for mypath in "$@"; do if [ -d "${mypath}" ]; then local srcs="$(find_prettier_srcs ${mypath})" if [[ -n "${srcs}" ]]; then prettier_run ${srcs} fi ok "Done formatting markdown/json/yaml files under ${mypath}." elif [ -f "${mypath}" ]; then if prettier_ext "${mypath}"; then prettier_run "${mypath}" else warning "Only regular markdown/json/yaml files will be formatted. Ignored ${mypath}" fi else warning "Special/Symlink file won't be formatted. Ignored ${mypath}" fi done } function main() { if [ "$#" -eq 0 ]; then warning "Usage: $0 <path/to/markdown/dir/or/file>" exit 1 fi check_if_tools_installed format_markdown_by_prettier "$@" } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/bootstrap.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2017-2021 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DREAMVIEW_URL="http://localhost:8888" cd "${DIR}/.." # Make sure supervisord has correct coredump file limit. ulimit -c unlimited source "${DIR}/apollo_base.sh" function start() { for mod in ${APOLLO_BOOTSTRAP_EXTRA_MODULES}; do echo "Starting ${mod}" nohup cyber_launch start ${mod} & done ./scripts/monitor.sh start ./scripts/dreamview.sh start if [ $? -eq 0 ]; then sleep 2 # wait for some time before starting to check http_status="$(curl -o /dev/null -x '' -I -L -s -w '%{http_code}' ${DREAMVIEW_URL})" if [ $http_status -eq 200 ]; then echo "Dreamview is running at" $DREAMVIEW_URL else echo "Failed to start Dreamview. Please check /apollo/nohup.out or /apollo/data/core for more information" fi fi } function stop() { ./scripts/dreamview.sh stop ./scripts/monitor.sh stop for mod in ${APOLLO_BOOTSTRAP_EXTRA_MODULES}; do echo "Stopping ${mod}" nohup cyber_launch stop ${mod} done } case $1 in start) start ;; stop) stop ;; restart) stop start ;; *) start ;; esac
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/apollo_buildify.sh
#! /usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" # STAGE="${STAGE:-dev}" : ${STAGE:=dev} function buildify() { local stage="${STAGE}" local buildifier_cmd="$(command -v buildifier)" if [ -z "${buildifier_cmd}" ]; then local download_link="https://github.com/bazelbuild/buildtools/releases" error "Command buildifier not found. You can download and install" \ "(or build) it from:" error "${TAB}${download_link}" exit 1 fi buildifier_cmd="${buildifier_cmd} -lint=fix" local build_dirs="cyber third_party tools" if [ "${stage}" == "dev" ]; then build_dirs="modules ${build_dirs}" fi build_dirs=$(printf "${APOLLO_ROOT_DIR}/%s " $build_dirs) set -x find ${build_dirs} -type f \ \( -name "BUILD" -or -name "*.BUILD" -or -name "*.bzl" -or -name "*.bazel" \) \ -exec ${buildifier_cmd} {} + set +x success "buildifier run finished successfully." if [ -f "${APOLLO_ROOT_DIR}/BUILD" ]; then ${buildifier_cmd} "${APOLLO_ROOT_DIR}/BUILD" fi if [ -f "${APOLLO_ROOT_DIR}/WORKSPACE.in" ]; then ${buildifier_cmd} "${APOLLO_ROOT_DIR}/WORKSPACE.in" fi } function main() { buildify "$@" } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/msf_simple_map_creator.sh
#! /bin/bash if [ $# -lt 4 ]; then echo "Usage: msf_simple_map_creator.sh [records folder] [extrinsic_file] [zone_id] [map folder] [lidar_type]" exit 1 fi DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${DIR}/.." source "${DIR}/apollo_base.sh" GNSS_LOC_TOPIC="/apollo/localization/msf_gnss" LIDAR_LOC_TOPIC="/apollo/localization/msf_lidar" FUSION_LOC_TOPIC="/apollo/localization/pose" ODOMETRY_LOC_TOPIC="/apollo/sensor/gnss/odometry" GNSS_LOC_FILE="gnss_loc.txt" LIDAR_LOC_FILE="lidar_loc.txt" FUSION_LOC_FILE="fusion_loc.txt" ODOMETRY_LOC_FILE="odometry_loc.txt" IN_FOLDER=$1 EXTRINSIC_FILE=$2 ZONE_ID=$3 OUT_MAP_FOLDER=$4 LIDAR_TYPE=${5:-lidar128} PARSED_DATA_FOLDER="$OUT_MAP_FOLDER/parsed_data" CLOUD_TOPIC="/apollo/sensor/$LIDAR_TYPE/compensator/PointCloud2" function data_exporter() { local BAG_FILE=$1 local OUT_FOLDER=$2 /apollo/bazel-bin/modules/localization/msf/local_tool/data_extraction/cyber_record_parser \ --bag_file $BAG_FILE \ --out_folder $OUT_FOLDER \ --cloud_topic $CLOUD_TOPIC \ --gnss_loc_topic $GNSS_LOC_TOPIC \ --lidar_loc_topic $LIDAR_LOC_TOPIC \ --fusion_loc_topic $FUSION_LOC_TOPIC \ --odometry_loc_topic $ODOMETRY_LOC_TOPIC } function poses_interpolation() { local INPUT_POSES_PATH=$1 local REF_TIMESTAMPS_PATH=$2 local EXTRINSIC_PATH=$3 local OUTPUT_POSES_PATH=$4 /apollo/bazel-bin/modules/localization/msf/local_tool/map_creation/poses_interpolator \ --input_poses_path $INPUT_POSES_PATH \ --ref_timestamps_path $REF_TIMESTAMPS_PATH \ --extrinsic_path $EXTRINSIC_PATH \ --output_poses_path $OUTPUT_POSES_PATH } function create_lossless_map() { /apollo/bazel-bin/modules/localization/msf/local_tool/map_creation/lossless_map_creator \ --use_plane_inliers_only true \ --pcd_folders $1 \ --pose_files $2 \ --map_folder $OUT_MAP_FOLDER \ --zone_id $ZONE_ID \ --coordinate_type UTM \ --map_resolution_type single } function create_lossy_map() { /apollo/bazel-bin/modules/localization/msf/local_tool/map_creation/lossless_map_to_lossy_map \ --srcdir $OUT_MAP_FOLDER/lossless_map \ --dstdir $OUT_MAP_FOLDER rm -fr $OUT_MAP_FOLDER/lossless_map rm -fr $OUT_MAP_FOLDER/parsed_data mv $OUT_MAP_FOLDER/lossy_map $OUT_MAP_FOLDER/local_map } cd $IN_FOLDER mkdir -p $OUT_MAP_FOLDER mkdir -p $PARSED_DATA_FOLDER for item in $(ls -l *.record* | awk '{print $9}'); do SEGMENTS=$(echo $item | awk -F'.' '{print NF}') DIR_NAME=$(echo $item | cut -d . -f ${SEGMENTS}) DIR_NAME="${PARSED_DATA_FOLDER}/${DIR_NAME}" mkdir -p ${DIR_NAME} data_exporter "${item}" "${DIR_NAME}" poses_interpolation "${DIR_NAME}/pcd/${ODOMETRY_LOC_FILE}" "${DIR_NAME}/pcd/pcd_timestamp.txt" "${EXTRINSIC_FILE}" "${DIR_NAME}/pcd/corrected_poses.txt" create_lossless_map "${DIR_NAME}/pcd" "${DIR_NAME}/pcd/corrected_poses.txt" done create_lossy_map echo "Done."
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/proto_build_generator.py
#!/usr/bin/env python3 import os import re import sys import subprocess TAB = " " * 4 ##==================== REFERENCE ===========================================## # # https://github.com/grpc/grpc/blob/master/bazel/test/python_test_repo/BUILD # ##==================== HEADER TEMPLATE =====================================## TEMPLATE_HEADER = """## Auto generated by `proto_build_generator.py` load("@rules_proto//proto:defs.bzl", "proto_library") load("@rules_cc//cc:defs.bzl", "cc_proto_library") load("//tools:python_rules.bzl", {}"py_proto_library") {} package(default_visibility = ["//visibility:public"]) """ HEADER_PY_GRPC = """"py_grpc_library", """ HEADER_CC_GRPC = \ """load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") """ ##=================== NON-GRPC TEMPLATE ====================================## TEMPLATE_NO_DEPS = \ """cc_proto_library( name = "{cc_name}", deps = [ ":{pb_name}", ], ) proto_library( name = "{pb_name}", srcs = ["{protofile}"], ) py_proto_library( name = "{py_name}", deps = [ ":{pb_name}", ], ) """ TEMPLATE_DEPS = \ """cc_proto_library( name = "{cc_name}", deps = [ ":{pb_name}", ], ) proto_library( name = "{pb_name}", srcs = ["{protofile}"], deps = [ {pb_context} ], ) py_proto_library( name = "{py_name}", deps = [ ":{pb_name}", {py_context} ], ) """ ##=========================== GRPC TEMPLATE ================================## TEMPLATE_GRPC_NO_DEPS = \ """cc_grpc_library( name = "{cc_name_grpc}", srcs = [":{pb_name}"], grpc_only = True, deps = [":{cc_name}"], ) cc_proto_library( name = "{cc_name}", deps = [ ":{pb_name}", ], ) proto_library( name = "{pb_name}", srcs = ["{protofile}"], ) py_grpc_library( name = "{py_name_grpc}", srcs = [":{pb_name}"], deps = [":{py_name}"], ) py_proto_library( name = "{py_name}", deps = [ ":{pb_name}", ], ) """ TEMPLATE_GRPC_DEPS = \ """cc_grpc_library( name = "{cc_name_grpc}", srcs = [":{pb_name}"], grpc_only = True, deps = [":{cc_name}"], ) cc_proto_library( name = "{cc_name}", deps = [ ":{pb_name}", ], ) proto_library( name = "{pb_name}", srcs = ["{protofile}"], deps = [ {pb_context} ], ) py_grpc_library( name = "{py_name_grpc}", srcs = [":{pb_name}"], deps = [":{py_name}"], ) py_proto_library( name = "{py_name}", deps = [ ":{pb_name}", {py_context} ], ) """ ##==================== PRETTY FORMAT SETTINGS ==============================## TEMPLATE_DEPENDENCY_FIRST_ENTRY = """"{}",""" TEMPLATE_DEPENDENCY_OTHER_ENTRY = """ {}"{}",""" ##==========================================================================## # ONLY .proto files in these topdirs are supported ALLOWED_MODULES = ["modules", "cyber"] def _path_check(build_file_path): return any( build_file_path.startswith(mod + "/") for mod in ALLOWED_MODULES) ##================ REGEX FOR GRPC CHECK ====================================## PATT_SERVICE = re.compile("^service\s+\S+\s+{$") PATT_RPC_RET = re.compile("^rpc\s+\S+\(\S+\)\s+returns") PATT_RPC_ONLY = re.compile("^rpc\s+\S+\(\S+\)") PATT_RET_ONLY = re.compile("^returns\s+\(\S+\)\s+{") ##=============== GRPC CHECK ==============================================## def grpc_check(fpath): """ Check whether grpc service is enabled in this .proto file. Note: only proto file with the following form will pass our check. service MyService { rpc MethodA(XXX) returns (XXX) { rpc MethodB(XXX) returns (XXX) { } } """ if not fpath.endswith(".proto"): return False grpc_found = False with open(fpath) as fin: kw1_found = False kw2_found = False for line in fin: line = line.strip() if kw1_found and kw2_found: if PATT_RET_ONLY.match(line): grpc_found = True break elif kw1_found: if PATT_RPC_RET.match(line): kw2_found = True grpc_found = True break if PATT_RPC_ONLY.match(line): kw2_found = True elif PATT_SERVICE.match(line): kw1_found = True return grpc_found ##================== FORMAT GENERATED FILE =================================## def run_buildifier(build_file_path): script_path = "/apollo/scripts/buildifier.sh" if os.path.exists(script_path): subprocess.call(["bash", script_path, build_file_path]) ##================== MAIN FUNCTION =========================================## def main(build_file_path): if not _path_check(build_file_path): print("Expect to run this script at $APOLLO_ROOT_DIR") return workdir = os.path.dirname(build_file_path) files_all = [f for f in os.listdir(workdir) if os.path.isfile(os.path.join(workdir, f)) and f != "BUILD" and f != "CMakeLists.txt"] ok = all(f.endswith(".proto") for f in files_all) if not ok: print( "Except for BUILD/CMakeLists.txt, some files under {} are NOT proto files.". format(workdir)) return grpc_found = any(grpc_check(os.path.join(workdir, f)) for f in files_all) fout = open(build_file_path, "w") if grpc_found: fout.write(TEMPLATE_HEADER.format(HEADER_PY_GRPC, HEADER_CC_GRPC)) else: fout.write(TEMPLATE_HEADER.format("", "")) for protofile in files_all: (proto_deptext, py_proto_deptext) = generate_dependency_text( workdir, protofile) rules = generate_rule_for_protofile(workdir, protofile, proto_deptext, py_proto_deptext) fout.write(rules) fout.close() print("Congratulations, {} was successfully generated.".format( build_file_path)) run_buildifier(build_file_path) ##=========== BAZEL BUILD RULE FOR A SINGLE PROTO FILE =====================## def generate_rule_for_protofile(workdir, protofile, proto_deps, py_proto_deps): grpc_found = grpc_check(os.path.join(workdir, protofile)) cc_name = cc_proto_name(protofile) py_name = py_proto_name(protofile) pb_name = proto_name(protofile) if not grpc_found: if len(proto_deps) == 0: return TEMPLATE_NO_DEPS.format(cc_name=cc_name, py_name=py_name, pb_name=pb_name, protofile=protofile) return TEMPLATE_DEPS.format(cc_name=cc_name, py_name=py_name, pb_name=pb_name, protofile=protofile, pb_context=proto_deps, py_context=py_proto_deps) else: cc_name_grpc = cc_grpc_name(protofile) py_name_grpc = py_grpc_name(protofile) if len(proto_deps) == 0: return TEMPLATE_GRPC_NO_DEPS.format(cc_name=cc_name, py_name=py_name, pb_name=pb_name, py_name_grpc=py_name_grpc, cc_name_grpc=cc_name_grpc, protofile=protofile) else: return TEMPLATE_GRPC_DEPS.format(cc_name=cc_name, py_name=py_name, pb_name=pb_name, py_name_grpc=py_name_grpc, cc_name_grpc=cc_name_grpc, protofile=protofile, pb_context=proto_deps, py_context=py_proto_deps) ##================ UNIFIED TARGET NAMING FOR PROTO FILE ====================## def cc_grpc_name(protofile): (sketch, _) = os.path.splitext(protofile) return sketch + "_cc_grpc" def cc_proto_name(protofile): (sketch, _) = os.path.splitext(protofile) return sketch + "_cc_proto" def py_grpc_name(protofile): (sketch, _) = os.path.splitext(protofile) return sketch + "_py_pb2_grpc" def py_proto_name(protofile): (sketch, _) = os.path.splitext(protofile) return sketch + "_py_pb2" def proto_name(protofile): (sketch, _) = os.path.splitext(protofile) return sketch + "_proto" ##====================== DEPENDENCY TEXT GENERATION ========================## def generate_dependency_text(workdir, protofile): dependencies = dependency_analysis(workdir, protofile) if len(dependencies) == 0: return ("", "") proto_notes = [] py_proto_notes = [] for dep in dependencies: depdir = os.path.dirname(dep) dep_name = os.path.basename(dep) proto_dep_name = proto_name(dep_name) py_dep_name = py_proto_name(dep_name) if depdir == workdir: proto_notes.append(":{}".format(proto_dep_name)) py_proto_notes.append(":{}".format(py_dep_name)) else: proto_notes.append("//{}:{}".format(depdir, proto_dep_name)) py_proto_notes.append("//{}:{}".format(depdir, py_dep_name)) proto_result = TEMPLATE_DEPENDENCY_FIRST_ENTRY.format(proto_notes[0]) for note in proto_notes[1:]: proto_result += TEMPLATE_DEPENDENCY_OTHER_ENTRY.format(TAB * 2, note) py_proto_result = TEMPLATE_DEPENDENCY_FIRST_ENTRY.format(py_proto_notes[0]) for note in py_proto_notes[1:]: py_proto_result += TEMPLATE_DEPENDENCY_OTHER_ENTRY.format( TAB * 2, note) return (proto_result, py_proto_result) ##================= DEPENDENCY ANALYSIS ====================================## def _import_line_check(line): return "import " in line and \ any("\"{}/".format(mod) in line for mod in ALLOWED_MODULES) def dependency_analysis(workdir, protofile): dependencies = [] fullpath = os.path.join(workdir, protofile) with open(fullpath) as fin: for line in fin: if _import_line_check(line): dependencies.append(line.split('"')[1]) return dependencies ##================= COMMAND LINE ===========================================## if __name__ == "__main__": if len(sys.argv) != 2: print("Usage:\n{}{} path/to/proto/BUILD".format(TAB, sys.argv[0])) sys.exit(1) main(sys.argv[1])
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/apollo_config.sh
#! /usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/cyber/setup.bash" BAZEL_CONF="${TOP_DIR}/.apollo.bazelrc" function run_bootstrap() { py3_bin="$(which python3 || true)" # Set all env variables "${py3_bin}" "${TOP_DIR}/tools/bootstrap.py" "$@" } function print_usage() { info "Usage: $0 [Options]" info "Options:" info "${TAB}-i|--interactive Run in interactive mode" info "${TAB}-n|--noninteractive Run in non-interactive mode" info "${TAB}-h|--help Show this message and exit" } function main() { local mycfg="$(basename ${BAZEL_CONF})" if [[ "$#" -eq 0 ]]; then print_usage exit 1 fi case "$1" in --clean) rm -f "${BAZEL_CONF}" exit 0 ;; -h | --help) print_usage exit 0 ;; -i | --interactive) info "Configure ${GREEN}${mycfg}${NO_COLOR} in interactive mode" run_bootstrap --interactive ok "Successfully configured ${GREEN}${mycfg}${NO_COLOR} in interactive mode." exit 0 ;; -n | --noninteractive) info "Configure ${GREEN}${mycfg}${NO_COLOR} in non-interactive mode" run_bootstrap --interactive false ok "Successfully configured ${GREEN}${mycfg}${NO_COLOR} in non-interactive mode." exit 0 ;; *) print_usage exit 1 ;; esac } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/clang_format.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### # Usage: # clang-format.sh <path/to/src/dir/or/files> # Fail on error set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" CLANG_FORMAT_CMD="clang-format" function check_clang_format() { if [[ -z "$(command -v clang-format)" ]]; then error "Command \"clang-format\" not found." error "Please make sure clang-format is installed and check your PATH" \ "settings. For Debian/Ubuntu, you can run the following command:" error " sudo apt-get -y update && sudo apt-get -y install clang-format" exit 1 fi } function clang_format_run() { # Note: `${CLANG_FORMAT_CMD} -i -style=Google "$@"` # will override the settings in .clang-format ${CLANG_FORMAT_CMD} -i "$@" } function run_clang_format() { for target in "$@"; do if [[ -f "${target}" ]]; then if c_family_ext "${target}" || proto_ext "${target}"; then clang_format_run "${target}" info "Done formatting ${target}" else warning "Do nothing. ${target} is not a c/c++/cuda header/source or proto file." fi else local srcs srcs="$(find_proto_srcs ${target})" if [[ -n "${srcs}" ]]; then clang_format_run ${srcs} fi srcs="$(find_c_cpp_srcs ${target})" if [[ -n "${srcs}" ]]; then clang_format_run ${srcs} fi ok "Done formatting c/cpp/cuda/proto source files under ${target}" fi done } function main() { check_clang_format if [ "$#" -eq 0 ]; then error "Usage: $0 <path/to/dirs/or/files>" exit 1 fi run_clang_format "$@" } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/perf.sh
#! /usr/bin/env bash ############################################################################### # Copyright 2020 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### # eg. # perf.sh gen_data -m planning # perf.sh gen_svg set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" source "${TOP_DIR}/scripts/apollo_base.sh" OUTPUT_DIR="${TOP_DIR}/.cache/perf" PERF_DATA="perf.data" PERF_DATA_FULL_PATH="${OUTPUT_DIR}/${PERF_DATA}" PERF_UNFOLD="perf.unfold" PERF_FOLDED="perf.folded" PERF_SVG="perf.svg" PERF_CMD="perf" FLAME_GRAPH_DIR="${TOP_DIR}/tools/FlameGraph" FLAME_GRAPH_VERSION="1.0" function print_usage() { info "Usage: $0 COMMAND [ARGS] " info "COMMANDS:" info "${TAB}help # Show this message" info "${TAB}gen_data generate perf.data by running specified command or module" info "${TAB}gen_svg generate perf.svg from perf.data" info "${TAB}clean cleanup .cache/perf and tools/FlameGraph" } function _check_perf() { if [ -z "$(which perf)" ]; then error "Seems that perf has not been installed..." error "You can install it manually by running:" error "${TAB}sudo apt-get -y update" error "${TAB}sudo apt-get -y install linux-tools-$(uname -r) linux-tools-common" exit 1 fi } function _check_out_dir() { if [ ! -d "${OUTPUT_DIR}" ]; then mkdir -p "${OUTPUT_DIR}" fi if [ -f "${PERF_DATA_FULL_PATH}" ]; then rm -f "${PERF_DATA_FULL_PATH}" fi } # Note(All): if permission denied, run `echo 1 > /proc/sys/kernel/perf_event_paranoid` as root user out of docker function gen_perf_data() { _check_perf _check_out_dir local cmd=$1 if [ "${cmd}" == "-m" ]; then shift local module=$1 if [ ! -z "${module}" ]; then ${PERF_CMD} record -e cpu-clock -o "${PERF_DATA_FULL_PATH}" -g mainboard -d \ /apollo/modules/${module}/dag/${module}.dag \ --flagfile=/apollo/modules/${module}/conf/${module}.conf \ --log_dir=/apollo/data/log else error "Please specify which module to run." exit 1 fi else ${PERF_CMD} record -e cpu-clock -o "${PERF_DATA_FULL_PATH}" -g "$@" fi } function _check_flame_graph() { if [ ! -d "${FLAME_GRAPH_DIR}" ]; then local answer typeset -l answer echo -n "FlameGraph does not exist. Do you want to download it (Y/n)? " answer=$(read_one_char_from_stdin) echo if [ "${answer}" == "y" ]; then local download_link="https://github.com/brendangregg/FlameGraph/archive/v${FLAME_GRAPH_VERSION}.tar.gz" local pkg_name="v${FLAME_GRAPH_VERSION}.tar.gz" wget "${download_link}" tar -xvf ${pkg_name} mv -f "FlameGraph-${FLAME_GRAPH_VERSION}" "${FLAME_GRAPH_DIR}" rm -f ${pkg_name} else exit 1 fi fi } function gen_perf_svg() { cd "${OUTPUT_DIR}" if [ ! -f "${PERF_DATA}" ]; then error "There is no perf.data under ${OUTPUT_DIR}" exit 1 else _check_flame_graph ${PERF_CMD} script -i "${PERF_DATA}" > "${PERF_UNFOLD}" ${FLAME_GRAPH_DIR}/stackcollapse-perf.pl ${PERF_UNFOLD} > ${PERF_FOLDED} ${FLAME_GRAPH_DIR}/flamegraph.pl ${PERF_FOLDED} > ${PERF_SVG} fi success "perf.svg generated under ${OUTPUT_DIR}" } function _clean_up() { for folder in "$@"; do if [ -d "${folder}" ]; then rm -rf "${folder}" success "Done cleanup ${folder}" else success "Nothing to do for empty directory '${folder}'." fi done } function clean_all() { _clean_up "${OUTPUT_DIR}" "${FLAME_GRAPH_DIR}" } function main() { if [ "$#" -eq 0 ]; then print_usage exit 1 fi local opt="$1" shift case "${opt}" in help) print_usage exit 1 ;; gen_data) gen_perf_data "$@" ;; gen_svg) gen_perf_svg ;; clean) clean_all ;; *) echo "Unknown command: ${opt}" print_usage exit 1 ;; esac } main "$@"
0
apollo_public_repos/apollo
apollo_public_repos/apollo/scripts/bootstrap_lgsvl.sh
#!/usr/bin/env bash ############################################################################### # Copyright 2020-2021 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" export APOLLO_BOOTSTRAP_EXTRA_MODULES="modules/drivers/tools/image_decompress/launch/image_decompress.launch" ${DIR}/bootstrap.sh $*
0