repo_id
stringlengths
19
138
file_path
stringlengths
32
200
content
stringlengths
1
12.9M
__index_level_0__
int64
0
0
apollo_public_repos/application-demo/example_components
apollo_public_repos/application-demo/example_components/src/timer_common_component_example.h
/****************************************************************************** * 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. *****************************************************************************/ #pragma once #include <memory> #include "cyber/class_loader/class_loader.h" #include "cyber/component/timer_component.h" #include "cyber/component/component.h" #include "example_components/proto/examples.pb.h" class TimerCommonComponentSample : public apollo::cyber::TimerComponent { public: bool Init() override; bool Proc() override; private: std::shared_ptr<apollo::cyber::Writer<example::proto::Driver>> driver_writer_ = nullptr; std::shared_ptr<apollo::cyber::Writer<example::proto::Driver>> second_driver_writer_ = nullptr; }; CYBER_REGISTER_COMPONENT(TimerCommonComponentSample)
0
apollo_public_repos/application-demo/example_components
apollo_public_repos/application-demo/example_components/src/common_component_example.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "example_components/src/common_component_example.h" bool CommonComponentSample::Init() { AINFO << "Commontest component init"; return true; } bool CommonComponentSample::Proc(const std::shared_ptr<example::proto::Driver>& msg0, const std::shared_ptr<example::proto::Driver>& msg1) { AINFO << "Start common component Proc [" << msg0->msg_id() << "] [" << msg1->msg_id() << "]"; return true; }
0
apollo_public_repos/application-demo/example_components
apollo_public_repos/application-demo/example_components/src/common_component_example.h
/****************************************************************************** * 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. *****************************************************************************/ #pragma once #include <memory> #include "cyber/component/component.h" #include "example_components/proto/examples.pb.h" class CommonComponentSample : public apollo::cyber::Component<example::proto::Driver, example::proto::Driver> { public: bool Init() override; bool Proc(const std::shared_ptr<example::proto::Driver>& msg0, const std::shared_ptr<example::proto::Driver>& msg1) override; }; CYBER_REGISTER_COMPONENT(CommonComponentSample)
0
apollo_public_repos/application-demo/example_components
apollo_public_repos/application-demo/example_components/src/BUILD
load("//tools:cpplint.bzl", "cpplint") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") package(default_visibility = ["//visibility:public"]) cc_binary( name = "libcomponent_examples.so", linkshared = True, linkstatic = True, deps = [ ":timer_common_component_example_lib", ":common_component_example_lib" ], ) cc_library( name = "timer_common_component_example_lib", srcs = ["timer_common_component_example.cc"], hdrs = ["timer_common_component_example.h"], visibility = ["//visibility:private"], alwayslink = True, deps = [ "//cyber", "//example_components/proto:examples_cc_proto", ], ) cc_library( name = "common_component_example_lib", srcs = ["common_component_example.cc"], hdrs = ["common_component_example.h"], visibility = ["//visibility:private"], alwayslink = True, deps = [ "//cyber", "//example_components/proto:examples_cc_proto", ], ) cpplint()
0
apollo_public_repos/application-demo
apollo_public_repos/application-demo/planning_customization/cyberfile.xml
<package> <name>planning-customization</name> <version>1.0.0</version> <description> planning_customization </description> <maintainer email="apollo-support">apollo-support@baidu.com</maintainer> <type>module</type> <src_path>//planning_customization</src_path> <license>BSD</license> <author>Apollo</author> <depend>bazel-extend-tools-dev</depend> <depend type="binary" repo_name="dreamview">dreamview-dev</depend> <depend type="binary" repo_name="routing">routing-dev</depend> <depend type="binary" repo_name="task-manager">task-manager-dev</depend> <depend type="binary" repo_name="monitor">monitor-dev</depend> <depend type="src" repo_name="planning">planning-dev</depend> <depend expose="False">3rd-rules-python-dev</depend> <depend expose="False">3rd-grpc-dev</depend> <depend expose="False">3rd-bazel-skylib-dev</depend> <depend expose="False">3rd-rules-proto-dev</depend> <depend expose="False">3rd-py-dev</depend> <depend expose="False">3rd-gpus-dev</depend> <builder>bazel</builder> </package>
0
apollo_public_repos/application-demo
apollo_public_repos/application-demo/planning_customization/BUILD
load("//tools/install:install.bzl", "install", "install_src_files") load("//tools:cpplint.bzl", "cpplint") package(default_visibility = ["//visibility:public"]) install( name = "install", data = [":cyberfile.xml"], data_dest = "planning-customization" ) install_src_files( name = "install_src", src_dir = ["."], dest = "planning-customization", filter = "*", )
0
apollo_public_repos
apollo_public_repos/application-pnc/WORKSPACE
workspace(name = "application-pnc") #######################################APOLLO####################################### load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") new_local_repository( name = "apollo_src", build_file = "//tools/proto:apollo.BUILD", path = "/opt/apollo/neo/src", ) http_archive( name = "remotejdk11_linux", sha256 = "360626cc19063bc411bfed2914301b908a8f77a7919aaea007a977fa8fb3cde1", urls = [ "https://apollo-pkg-beta.bj.bcebos.com/bazel/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz", ], ) http_archive( name = "go_sdk", sha256 = "0052d452af7742c8f3a4e0929763388a66403de363775db7e90adecb2ba4944b", urls = [ "https://apollo-pkg-beta.bj.bcebos.com/bazel/go1.12.5.linux-amd64.tar.gz", ], ) http_archive( name = "build_bazel_rules_apple", sha256 = "0052d452af7742c8f3a4e0929763388a66403de363775db7e90adecb2ba4944b", urls = [ "https://apollo-system.cdn.bcebos.com/archive/8.0/rules_apple.0.31.3.tar.gz", "https://github.com/bazelbuild/rules_apple/releases/download/0.31.3/rules_apple.0.31.3.tar.gz", ], ) http_archive( name = "rules_foreign_cc", sha256 = "6041f1374ff32ba711564374ad8e007aef77f71561a7ce784123b9b4b88614fc", strip_prefix = "rules_foreign_cc-0.8.0", urls = [ "https://apollo-system.bj.bcebos.com/archive/6.0/rules_foreign_cc-0.8.0.tar.gz", "https://github.com/bazelbuild/rules_foreign_cc/archive/0.8.0.tar.gz", ], ) load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") rules_foreign_cc_dependencies() http_archive( name = "rules_cc", patches = ["//tools/package:rules_cc.patch"], sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241", urls = [ "https://apollo-system.cdn.bcebos.com/archive/8.0/rules_cc-0.0.1.tar.gz", "https://github.com/bazelbuild/rules_cc/releases/download/0.0.1/rules_cc-0.0.1.tar.gz", ], ) load("//dev/bazel:deps.bzl", "init_deps") init_deps() load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") grpc_deps() load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") grpc_extra_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") rules_proto_dependencies() rules_proto_toolchains() #######################################APOLLO#######################################
0
apollo_public_repos
apollo_public_repos/application-pnc/.editorconfig
# http://editorconfig.org root = true [*] charset = utf-8 # like -i=2 indent_style = space indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true [*.{sh,bash,bashrc}] shell_variant = bash # like -ln=bash binary_next_line = true # like -bn switch_case_indent = true # like -ci space_redirects = true # like -sr # in case third party libraries need a Makefile. [Makefile] indent_style = tab
0
apollo_public_repos
apollo_public_repos/application-pnc/.env
APOLLO_ENV_NAME=pnc APOLLO_ENV_WORKLOCAL=1 APOLLO_ENV_CONTAINER_REPO='registry.baidubce.com/apollo/apollo-env-gpu' APOLLO_ENV_CONTAINER_TAG='9.0-latest'
0
apollo_public_repos
apollo_public_repos/application-pnc/.workspace.json
{ "repositories" : [{"name": "apollo-core", "version": "9.0.0-alpha2-r28"}] }
0
apollo_public_repos
apollo_public_repos/application-pnc/.clang-format
--- BasedOnStyle: Google --- Language: Cpp Cpp11BracedListStyle: true Standard: Cpp11 CommentPragmas: '^ NOLINT' AccessModifierOffset: -4 AlignAfterOpenBracket: AlwaysBreak AlignOperands: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakTemplateDeclarations: true BinPackArguments: false BinPackParameters: false BreakConstructorInitializers: AfterColon ColumnLimit: 120 ConstructorInitializerIndentWidth: 8 ContinuationIndentWidth: 8 DerivePointerAlignment: true FixNamespaceComments: true IndentCaseLabels: false IndentWidth: 4 MaxEmptyLinesToKeep: 1 NamespaceIndentation: None PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 1 PenaltyBreakComment: 500 PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 400 PointerAlignment: Left SortIncludes: false BreakBeforeBinaryOperators: true # Mimic cpplint style IncludeCategories: # Note that the "main" header is priority 0 # The priority is assigned to first match in the ordered list # Miscelaneous system libraries - Regex: '<(immintrin.h|malloc.h|wait.h|x86intrin.h|cuda.*)>' Priority: 3 # C standard libraries - Regex: '<(arpa/|netinet/|net/if|sys/)?[^\./]*\.h>' Priority: 1 # C++ standard libraries - Regex: '<[^/\./]*>' Priority: 2 # Experimental or other system libraries - Regex: '<' Priority: 3 # Test libs - Regex: '"(gtest|gmock)/' Priority: 4 # Protobuf Files - Regex: '\.pb\.h' Priority: 6 # Apollo libs - Regex: '^"(cyber|modules)' Priority: 7 # The rest - Regex: '.*' Priority: 5 ---
0
apollo_public_repos
apollo_public_repos/application-pnc/.buildtool.conf
[url] metadata=https://apollo-pkg-beta.cdn.bcebos.com/apollo/core/dists/bionic/main/binary-amd64/Packages head=https://apollo-pkg-beta.cdn.bcebos.com/apollo/core
0
apollo_public_repos/application-pnc
apollo_public_repos/application-pnc/core/cyberfile.xml
<package> <name>core</name> <version>local</version> <description> depends of apollo core </description> <maintainer email="apollo-support@baidu.com">Apollo Maintainer</maintainer> <type>module</type> <src_path>//core</src_path> <license>Apache License 2.0</license> <author>Apollo</author> <!-- basic --> <depend repo_name="common" type="binary">common</depend> <depend repo_name="cyber" type="binary">cyber</depend> <depend repo_name="common-msgs" type="binary">common-msgs</depend> <!-- dreamview && monitor --> <depend repo_name="dreamview" type="binary">dreamview</depend> <depend repo_name="monitor" type="binary">monitor</depend> <depend repo_name="studio-connector" type="binary">studio-connector</depend> <depend repo_name="sim-obstacle" type="binary">sim-obstacle</depend> <!-- external_command --> <depend repo_name="external-command-action" type="binary">external-command-action</depend> <depend repo_name="external-command-demo" type="binary">external-command-demo</depend> <depend repo_name="external-command-lane-follow" type="binary">external-command-lane-follow</depend> <depend repo_name="external-command-process" type="binary">external-command-process</depend> <depend repo_name="external-command-processor-base" type="binary">external-command-processor-base</depend> <depend repo_name="external-command-valet-parking" type="binary">external-command-valet-parking</depend> <depend repo_name="old-routing-adpter" type="binary">old-routing-adpter</depend> <depend repo_name="routing" type="binary">routing</depend> <!-- planning1 --> <depend repo_name="planning" type="binary">planning</depend> <depend repo_name="planning-scenario-bare-intersection-unprotected" type="binary">planning-scenario-bare-intersection-unprotected</depend> <depend repo_name="planning-scenario-emergency-pull-over" type="binary">planning-scenario-emergency-pull-over</depend> <depend repo_name="planning-scenario-emergency-stop" type="binary">planning-scenario-emergency-stop</depend> <depend repo_name="planning-scenario-lane-follow" type="binary">planning-scenario-lane-follow</depend> <depend repo_name="planning-scenario-park-and-go" type="binary">planning-scenario-park-and-go</depend> <depend repo_name="planning-lane-follow-map" type="binary">planning-lane-follow-map</depend> <depend repo_name="planning-scenario-pull-over" type="binary">planning-scenario-pull-over</depend> <depend repo_name="planning-scenario-stop-sign-unprotected" type="binary">planning-scenario-stop-sign-unprotected</depend> <depend repo_name="planning-scenario-traffic-light-protected" type="binary">planning-scenario-traffic-light-protected</depend> <depend repo_name="planning-scenario-traffic-light-unprotected-left-turn" type="binary">planning-scenario-traffic-light-unprotected-left-turn</depend> <depend repo_name="planning-scenario-traffic-light-unprotected-right-turn" type="binary">planning-scenario-traffic-light-unprotected-right-turn</depend> <depend repo_name="planning-scenario-valet-parking" type="binary">planning-scenario-valet-parking</depend> <depend repo_name="planning-scenario-yield-sign" type="binary">planning-scenario-yield-sign</depend> <depend repo_name="planning-task-fallback-path" type="binary">planning-task-fallback-path</depend> <depend repo_name="planning-task-lane-borrow-path" type="binary">planning-task-lane-borrow-path</depend> <depend repo_name="planning-task-lane-change-path" type="binary">planning-task-lane-change-path</depend> <depend repo_name="planning-task-lane-follow-path" type="binary">planning-task-lane-follow-path</depend> <depend repo_name="planning-task-open-space-fallback-decider" type="binary">planning-task-open-space-fallback-decider</depend> <depend repo_name="planning-task-open-space-pre-stop-decider" type="binary">planning-task-open-space-pre-stop-decider</depend> <depend repo_name="planning-task-open-space-roi-decider" type="binary">planning-task-open-space-roi-decider</depend> <depend repo_name="planning-task-open-space-trajectory-partition" type="binary">planning-task-open-space-trajectory-partition</depend> <depend repo_name="planning-task-open-space-trajectory-provider" type="binary">planning-task-open-space-trajectory-provider</depend> <depend repo_name="planning-task-path-decider" type="binary">planning-task-path-decider</depend> <depend repo_name="planning-task-path-reference-decider" type="binary">planning-task-path-reference-decider</depend> <depend repo_name="planning-task-path-time-heuristic" type="binary">planning-task-path-time-heuristic</depend> <depend repo_name="planning-task-piecewise-jerk-speed" type="binary">planning-task-piecewise-jerk-speed</depend> <depend repo_name="planning-task-piecewise-jerk-speed-nonlinear" type="binary">planning-task-piecewise-jerk-speed-nonlinear</depend> <depend repo_name="planning-task-pull-over-path" type="binary">planning-task-pull-over-path</depend> <depend repo_name="planning-task-reuse-path" type="binary">planning-task-reuse-path</depend> <depend repo_name="planning-task-rss-decider" type="binary">planning-task-rss-decider</depend> <depend repo_name="planning-task-rule-based-stop-decider" type="binary">planning-task-rule-based-stop-decider</depend> <depend repo_name="planning-task-speed-bounds-decider" type="binary">planning-task-speed-bounds-decider</depend> <depend repo_name="planning-task-speed-decider" type="binary">planning-task-speed-decider</depend> <depend repo_name="planning-task-st-bounds-decider" type="binary">planning-task-st-bounds-decider</depend> <depend repo_name="planning-traffic-rules-backside-vehicle" type="binary">planning-traffic-rules-backside-vehicle</depend> <depend repo_name="planning-traffic-rules-crosswalk" type="binary">planning-traffic-rules-crosswalk</depend> <depend repo_name="planning-traffic-rules-destination" type="binary">planning-traffic-rules-destination</depend> <depend repo_name="planning-traffic-rules-keepclear" type="binary">planning-traffic-rules-keepclear</depend> <depend repo_name="planning-traffic-rules-rerouting" type="binary">planning-traffic-rules-rerouting</depend> <depend repo_name="planning-traffic-rules-stop-sign" type="binary">planning-traffic-rules-stop-sign</depend> <depend repo_name="planning-traffic-rules-traffic-light" type="binary">planning-traffic-rules-traffic-light</depend> <depend repo_name="planning-traffic-rules-yield-sign" type="binary">planning-traffic-rules-yield-sign</depend> <depend repo_name="planning-traffic-rules-reference-line-end" type="binary">planning-traffic-rules-reference-line-end</depend> <!-- transform --> <depend repo_name="transform" type="binary">transform</depend> <!-- prediction --> <depend repo_name="prediction" type="binary">prediction</depend> <!-- control --> <depend repo_name="control-controller-demo-control-task" type="binary">control-controller-demo-control-task</depend> <depend repo_name="control-controller-lat-based-lqr-controller" type="binary">control-controller-lat-based-lqr-controller</depend> <depend repo_name="control-controller-lon-based-pid-controller" type="binary">control-controller-lon-based-pid-controller</depend> <depend repo_name="control-controller-mpc-controller" type="binary">control-controller-mpc-controller</depend> <depend repo_name="control" type="binary">control</depend> <!-- map --> <depend repo_name="map" type="binary">map</depend> <builder>bazel</builder> </package>
0
apollo_public_repos/application-pnc
apollo_public_repos/application-pnc/core/BUILD
load("//tools:cpplint.bzl", "cpplint") load("//tools:apollo_package.bzl", "apollo_package") package(default_visibility = ["//visibility:public"]) apollo_package()
0
apollo_public_repos/application-pnc
apollo_public_repos/application-pnc/.vscode/settings.json
{ "files.associations": { "*.inc": "cpp", "*.ipp": "cpp", "atomic": "cpp", "*.tcc": "cpp", "bitset": "cpp", "cmath": "cpp", "complex": "cpp", "random": "cpp", "functional": "cpp", "future": "cpp", "limits": "cpp", "regex": "cpp", "tuple": "cpp", "type_traits": "cpp", "valarray": "cpp", "chrono": "cpp", "deque": "cpp", "forward_list": "cpp", "list": "cpp", "string": "cpp", "unordered_map": "cpp", "unordered_set": "cpp", "vector": "cpp", "optional": "cpp", "string_view": "cpp", "algorithm": "cpp", "hash_map": "cpp", "fstream": "cpp", "iomanip": "cpp", "istream": "cpp", "mutex": "cpp", "ostream": "cpp", "numeric": "cpp", "ratio": "cpp", "sstream": "cpp", "streambuf": "cpp", "core": "cpp", "fft": "cpp", "*.txx": "cpp", "iostream": "cpp", "memory": "cpp", "*.cc": "cpp", "*.cu": "cpp", "array": "cpp", "hash_set": "cpp", "rope": "cpp", "slist": "cpp", "initializer_list": "cpp" }, "git.ignoreLimitWarning": true, "search.useIgnoreFiles": false, "editor.formatOnSave": true }
0
apollo_public_repos/application-pnc
apollo_public_repos/application-pnc/.vscode/c_cpp_properties.json
{ "env": { "defaultSrcPath": "${workspaceFolder}/.aem/envroot/opt/apollo/neo/src", "defaultIncludePath": "${workspaceFolder}/.aem/envroot/opt/apollo/neo/include" }, "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/**", "${defaultSrcPath}", "${defaultIncludePath}" ], "defines": [], "compilerPath": "/usr/bin/gcc", "cStandard": "c11", "cppStandard": "c++14", "browse": { "path": [ "${defaultSrcPath}" ], "limitSymbolsToIncludedHeaders": true } } ], "version": 4 }
0
apollo_public_repos
apollo_public_repos/application-urban/WORKSPACE
#######################################APOLLO####################################### load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "remotejdk11_linux", sha256 = "360626cc19063bc411bfed2914301b908a8f77a7919aaea007a977fa8fb3cde1", urls = [ "https://apollo-pkg-beta.bj.bcebos.com/bazel/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz", ], ) http_archive( name = "go_sdk", sha256 = "0052d452af7742c8f3a4e0929763388a66403de363775db7e90adecb2ba4944b", urls = [ "https://apollo-pkg-beta.bj.bcebos.com/bazel/go1.12.5.linux-amd64.tar.gz", ], ) http_archive( name = "build_bazel_rules_apple", sha256 = "0052d452af7742c8f3a4e0929763388a66403de363775db7e90adecb2ba4944b", urls = [ "https://apollo-system.cdn.bcebos.com/archive/8.0/rules_apple.0.31.3.tar.gz", "https://github.com/bazelbuild/rules_apple/releases/download/0.31.3/rules_apple.0.31.3.tar.gz", ], ) http_archive( name = "rules_foreign_cc", sha256 = "6041f1374ff32ba711564374ad8e007aef77f71561a7ce784123b9b4b88614fc", strip_prefix = "rules_foreign_cc-0.8.0", urls = [ "https://apollo-system.bj.bcebos.com/archive/6.0/rules_foreign_cc-0.8.0.tar.gz", "https://github.com/bazelbuild/rules_foreign_cc/archive/0.8.0.tar.gz", ], ) load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") rules_foreign_cc_dependencies() http_archive( name = "rules_cc", urls = ["https://apollo-system.cdn.bcebos.com/archive/8.0/rules_cc-0.0.1.tar.gz", "https://github.com/bazelbuild/rules_cc/releases/download/0.0.1/rules_cc-0.0.1.tar.gz"], sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241", patches = ["//tools/package:rules_cc.patch"], ) load("//dev/bazel:deps.bzl", "init_deps") init_deps() load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") grpc_deps() load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") grpc_extra_deps() load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") rules_proto_dependencies() rules_proto_toolchains() #######################################APOLLO#######################################
0
apollo_public_repos/application-urban
apollo_public_repos/application-urban/mkz/cyberfile.xml
<?xml version='1.0' encoding='utf-8'?> <package> <name>mkz</name> <version>1.0.0</version> <description> mkz is end to end project, providing a quick setup for Apollo. </description> <maintainer email="apollo-support@baidu.com">Apollo</maintainer> <type>module</type> <src_path>//mkz</src_path> <license>BSD</license> <author>Apollo</author> <builder>bazel</builder> <depend repo_name="audio" type="binary">audio-dev</depend> <depend repo_name="bridge" type="binary">bridge-dev</depend> <depend repo_name="canbus" type="binary">canbus-dev</depend> <depend repo_name="control" type="binary">control-dev</depend> <depend repo_name="dreamview" type="binary">dreamview-dev</depend> <depend repo_name="drivers" type="binary">drivers-dev</depend> <depend repo_name="guardian" type="binary">guardian-dev</depend> <depend repo_name="localization" lib_names="localization" type="binary">localization-dev</depend> <depend repo_name="map" type="binary">map-dev</depend> <depend repo_name="monitor" type="binary">monitor-dev</depend> <depend repo_name="perception" type="binary">perception-dev</depend> <depend repo_name="planning" type="binary">planning-gpu-dev</depend> <depend repo_name="prediction" type="binary">prediction-dev</depend> <depend repo_name="routing" type="binary">routing-dev</depend> <depend repo_name="storytelling" type="binary">storytelling-dev</depend> <depend repo_name="task-manager" type="binary">task-manager-dev</depend> <depend repo_name="tools" type="binary">tools-dev</depend> <depend repo_name="transform" type="binary">transform-dev</depend> <depend repo_name="v2x" type="binary">v2x-dev</depend> <depend expose="False">3rd-rules-python-dev</depend> <depend expose="False">3rd-grpc-dev</depend> <depend expose="False">3rd-bazel-skylib-dev</depend> <depend expose="False">3rd-rules-proto-dev</depend> <depend expose="False">3rd-py-dev</depend> <depend expose="False">3rd-gpus-dev</depend></package>
0
apollo_public_repos/application-urban
apollo_public_repos/application-urban/mkz/BUILD
load("//tools/install:install.bzl", "install", "install_src_files") load("//tools:cpplint.bzl", "cpplint") package(default_visibility = ["//visibility:public"]) install( name = "install", data = [":cyberfile.xml"], data_dest = "mkz" ) install_src_files( name = "install_src", src_dir = ["."], dest = "mkz", filter = "*", )
0
apollo_public_repos
apollo_public_repos/apollo/readthedocs.yml
conda: file: cyber/doxy-docs/environment.yml
0
apollo_public_repos
apollo_public_repos/apollo/CODE_OF_CONDUCT.md
# Apollo Code of Conduct In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: - Using welcoming and inclusive language. - Being respectful of differing viewpoints and experiences. - Gracefully accepting constructive criticism. - Focusing on what is best for the community. - Showing empathy towards other community members. Examples of unacceptable behavior by participants include: - The use of sexualized language or imagery and unwelcome sexual attention or advances. - Trolling, insulting/derogatory comments, and personal or political attacks. - Public or private harassment. - Publishing others' private information, such as a physical or electronic address, without explicit permission. - Conduct which could reasonably be considered inappropriate for the forum in which it occurs. All Apollo forums and spaces are meant for professional interactions, and any behavior which could reasonably be considered inappropriate in a professional setting is unacceptable. ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies to all content on apollo.auto, Apollo’s GitHub organization, or any other official Apollo web presence allowing for community interactions, as well as at all official Apollo events, whether offline or online. The Code of Conduct also applies within project spaces and in public spaces whenever an individual is representing Apollo or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed or de facto representative at an online or offline event. ## Conflict Resolution Conflicts in an open source project can take many forms, from someone having a bad day and using harsh and hurtful language in the issue queue, to more serious instances such as sexist/racist statements or threats of violence, and everything in between. If the behavior is threatening or harassing, or for other reasons requires immediate escalation, please see below. However, for the vast majority of issues, we aim to empower individuals to first resolve conflicts themselves, asking for help when needed, and only after that fails to escalate further. This approach gives people more control over the outcome of their dispute. If you are experiencing or witnessing conflict, we ask you to use the following escalation strategy to address the conflict: 1. Address the perceived conflict directly with those involved, preferably in a real-time medium. 2. If this fails, get a third party (e.g. a mutual friend, and/or someone with background on the issue, but not involved in the conflict) to intercede. 3. If you are still unable to resolve the conflict, and you believe it rises to harassment or another code of conduct violation, report it. ## Reporting Violations Violations of the Code of Conduct can be reported to the project team at apollo-beijing@baidu.com. The team will determine whether the Code of Conduct was violated, and will issue an appropriate sanction, possibly including a written warning or expulsion from the project, project sponsored spaces, or project forums. We ask that you make a good-faith effort to resolve your conflict via the conflict resolution policy before submitting a report. Violations of the Code of Conduct can occur in any setting, even those unrelated to the project. We will only consider complaints about conduct that has occurred within one year of the report. ## Enforcement If the project team receives a report alleging a violation of the Code of Conduct, it will notify the accused of the report, and provide them an opportunity to discuss the report before a sanction is issued. The team will do its utmost to keep the reporter anonymous. If the act is ongoing (such as someone engaging in harassment), or involves a threat to anyone's safety (e.g. threats of violence), the team may issue sanctions without notice. ## Attribution This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://contributor-covenant.org/version/1/4, and includes some aspects of the [Geek Feminism Code of Conduct](https://geekfeminismdotorg.wordpress.com).
0
apollo_public_repos
apollo_public_repos/apollo/version.json
{ "version": "8.0.0" }
0
apollo_public_repos
apollo_public_repos/apollo/.bazelignore
.cache docker/build
0
apollo_public_repos
apollo_public_repos/apollo/LICENSE
Copyright (c) 2018 Apollo Authors. All Rights Reserved Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright (c) 2017 Apollo Authors. All Rights Reserve. 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.
0
apollo_public_repos
apollo_public_repos/apollo/CODE_OF_CONDUCT_cn.md
# Apollo 行为准则 为促进一个开放透明且友好的环境,我们作为贡献者和维护者保证:无论参与者的年龄、体 型、身体健全与否、种族、性别认同及表达、经验水平、国籍、外貌、人种、宗教或性取向 如何,在我们项目和社区中均有免于骚扰的自由。 ## 我们的标准 有助于创造良好的环境的行为包括: - 使用友好和包容性的语言 - 尊重不同的观点和经历 - 得体地接受建设性批评 - 关注对社区有益的事情 - 友善地对待社区其他成员 作为参与者,不可接受的行为包括: - 使用与性有关的言语或是图像,以及不受欢迎的性骚扰 - 捣乱/煽动/造谣的行为或意含侮辱/贬损的评论;人身攻击及政治攻击 - 公开或私下的骚扰 - 未经许可,发布他人的个人资料,如住址或电子地址 - 其他可以被合理地认定为不恰当的论坛行为 Apollo 的论坛和空间旨在提供专业交流之所,任何可以被合理地认定为不恰当/不符合职业 操守的行为均不可接受。 ## 我们的责任 项目维护者有责任阐明「可接受的行为」标准,并对已发生的不被接受的行为采取恰当且公 正的纠正措施。 项目维护者有权利及责任删除、编辑、拒绝有悖于本行为准则的评论(comments)、提交 (commits)、代码、wiki 编辑、问题(issues)及其他贡献; 也可暂时或永久性地禁止他们 认为有不当、威胁、冒犯、有害的其他行为的贡献者。 ## 适用范围 本行为准则适用于 https://apollo.auto 网站,Apollo GitHub 组织,其他用于社区交流 的 Apollo 网上地址,以及线上线下所有的 Apollo 官方活动。 当个人代表 Apollo 项目或是社区时,本行为准则同样适用于 Apollo 项目平台和相关公共 平台。 代表项目或是社区的情况,如,使用项目官方电子邮件地址、通过社交媒体上的官方账号发 布消息,以及在线上线下活动中担任指定或事实代表。 ## 冲突之解决 开源项目中可能的冲突有多种形式,从某人某日糟心在问题(Issues)中使用尖酸刻薄的语 言,到更严重的如性别种族歧视或威胁使用暴力的情形,或是任何介于二者之间者。 如果发现威胁或者骚扰行为,或其他理由需要立即投诉的,请参考下节。 然而,在绝大多数情形下,我们期望个人能够先尝试自己解决这些冲突,如有必要可寻求帮 助。晋档自行解决无效的情况下再来投诉。这一方式可使人们更好地管控与他人争论的后果 。 如果您正经历或目击着冲突,我们请求您采用如下策略来解决冲突: 1. 直接与冲突所涉当事人私下沟通,最好是实时沟通。 2. 如果不行,可请求第三方(如共同好友,或对此冲突有所了解但不牵涉其中者)出面调 解。 3. 如果这还不行,而且你相信这造成了骚扰或有悖于其他行为准则,举报之。 ## 举报违反本行为准则的行为 违反本行为准则的行为可举报给本项目团队 apollo-beijing@baidu.com . Apollo 团队将 判断是否被举报行为违背了本行为准则,并执行恰当的判罚,包括书面警告或从项目、项目 空间和论坛中除名。我们建议您在提交举报之前,先待人以诚地按照上面提到的冲突解决策 略,尝试自行解决。 违反本行为准则的行为可以发生在任何背景下,甚至发生在与本项目无关的情形下。我们将 只处理距已发生的违背行为一年之内的投诉。 ## 强制执行 如果本项目团队收到指控违背本行为准则的举报,将会通知被举报人,在判罚做出之前,给 其提供机会来讨论该举报。项目团队将尽最大可能,为举报人保密。如果被举报行为还在进 行(如骚扰行为仍在继续),或是涉及对任何人的安全威胁(如暴力威胁),本团队将不经 通知直接做出相应处罚。 ## 来源 本行为准则改编自贡献者公约 1.4 版,地址: https://contributor-covenant.org/version/1/4 , 同时包含 [女性极客行为准则](https://geekfeminismdotorg.wordpress.com) 的若干方面。
0
apollo_public_repos
apollo_public_repos/apollo/WORKSPACE
workspace(name = "apollo") load("//tools:workspace.bzl", "apollo_repositories") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_foreign_cc", sha256 = "6041f1374ff32ba711564374ad8e007aef77f71561a7ce784123b9b4b88614fc", strip_prefix = "rules_foreign_cc-0.8.0", urls = [ "https://apollo-system.bj.bcebos.com/archive/6.0/rules_foreign_cc-0.8.0.tar.gz", "https://github.com/bazelbuild/rules_foreign_cc/archive/0.8.0.tar.gz", ], ) load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") rules_foreign_cc_dependencies() apollo_repositories() http_archive( name = "rules_cc", urls = [ "https://apollo-system.cdn.bcebos.com/archive/8.0/rules_cc-0.0.1.tar.gz", "https://github.com/bazelbuild/rules_cc/releases/download/0.0.1/rules_cc-0.0.1.tar.gz", ], sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241", patches = ["//tools/package:rules_cc.patch"], ) http_archive( name = "bazel_skylib", sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", urls = [ "https://apollo-system.cdn.bcebos.com/archive/6.0/bazel-skylib-1.0.3.tar.gz", "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", ], ) load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() load("@bazel_skylib//lib:versions.bzl", "versions") versions.check(minimum_bazel_version = "3.7.0") http_archive( name = "rules_proto", sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208", strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313", urls = [ "https://apollo-system.cdn.bcebos.com/archive/6.0/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz", "https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz", ], ) load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") rules_proto_dependencies() rules_proto_toolchains() http_archive( name = "rules_python", sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0", urls = [ "https://apollo-system.cdn.bcebos.com/archive/6.0/rules_python-0.1.0.tar.gz", "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz", ], ) # load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") # grpc http_archive( name = "com_github_grpc_grpc", sha256 = "419dba362eaf8f1d36849ceee17c3e2ff8ff12ac666b42d3ff02a164ebe090e9", patches = ["//third_party/absl:grpc.patch"], strip_prefix = "grpc-1.30.0", urls = [ "https://apollo-system.cdn.bcebos.com/archive/6.0/v1.30.0.tar.gz", "https://github.com/grpc/grpc/archive/v1.30.0.tar.gz", ], ) http_archive( name = "zlib", build_file = "@com_google_protobuf//:third_party/zlib.BUILD", sha256 = "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff", strip_prefix = "zlib-1.2.11", urls = [ "https://apollo-system.cdn.bcebos.com/archive/6.0/zlib-v1.2.11.tar.gz", "https://github.com/madler/zlib/archive/v1.2.11.tar.gz", ], ) load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") grpc_deps() load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") grpc_extra_deps()
0
apollo_public_repos
apollo_public_repos/apollo/apollo.doxygen
# Doxyfile 1.8.6 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. # # All text after a single hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv # built into libc) for the transcoding. See http://www.gnu.org/software/libiconv # for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by # double-quotes, unless you are using Doxywizard) that should identify the # project for which the documentation is generated. This name is used in the # title of most generated pages and in a few other places. # The default value is: My Project. PROJECT_NAME = "Apollo" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. PROJECT_NUMBER = 2.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = "Open source self driving car software" # With the PROJECT_LOGO tag one can specify an logo or icon that is included in # the documentation. The maximum height of the logo should not exceed 55 pixels # and the maximum width should not exceed 200 pixels. Doxygen will copy the logo # to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. OUTPUT_DIRECTORY = .cache/docs # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and # will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes # performance problems for the file system. # The default value is: NO. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, # Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), # Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, # Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, # Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, # Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, # Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. # The default value is: YES. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator that is # used to form the text in various listings. Each string in this list, if found # as the leading text of the brief description, will be stripped from the text # and the result, after processing the whole list, is used as the annotated # text. Otherwise, the brief description is used as-is. If left blank, the # following values are used ($name is automatically replaced with the name of # the entity):The $name class, The $name widget, The $name file, is, provides, # specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # doxygen will generate a detailed section even if there is only a brief # description. # The default value is: NO. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. # The default value is: NO. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. FULL_PATH_NAMES = YES # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand # part of the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the path to # strip. # # Note that you can specify absolute paths here, but also relative paths, which # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which # header file to include in order to use a class. If left blank only the name of # the header file containing the class definition is used. Otherwise one should # specify the list of include paths that are normally passed to the compiler # using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the # first line (until the first dot) of a Javadoc-style comment as the brief # description. If set to NO, the Javadoc-style will behave just like regular Qt- # style comments (thus requiring an explicit @brief command for a brief # description.) # The default value is: NO. JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus # requiring an explicit \brief command for a brief description.) # The default value is: NO. QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a # multi-line C++ special comment block (i.e. a block of //! or /// comments) as # a brief description. This used to be the default behavior. The new default is # to treat a multi-line C++ comment block as a detailed description. Set this # tag to YES if you prefer the old behavior instead. # # Note that setting this tag to YES also means that rational rose comments are # not recognized any more. # The default value is: NO. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a # new page for each member. If set to NO, the documentation of a member will be # part of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen # uses this value to replace tabs by spaces in code fragments. # Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that act as commands in # the documentation. An alias has the form: # name=value # For example, adding # "sideeffect=@par Side Effects:\n" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert # newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example, adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all # members will be omitted, etc. # The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored # for that language. For instance, namespaces will be presented as packages, # qualified scopes will look different, etc. # The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources. Doxygen will then generate output that is tailored for Fortran. # The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for VHDL. # The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, Javascript, # C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. # # Note For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. # The default value is: YES. MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word # or globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this # tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); # versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. # The default value is: NO. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. # The default value is: NO. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES will make # doxygen to replace the get and set methods by a property in the documentation. # This will only work if the methods are indeed getting or setting a simple # type. If this is not the case, or you want to show the methods anyway, you # should set this option to NO. # The default value is: YES. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent # subgrouping. Alternatively, this can be done per class using the # \nosubgrouping command. # The default value is: YES. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions # are shown inside the group in which they are included (e.g. using \ingroup) # instead of on a separate page (for HTML and Man pages) or section (for LaTeX # and RTF). # # Note that this feature does not work in combination with # SEPARATE_MEMBER_PAGES. # The default value is: NO. INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions # with only public data fields or simple typedef fields will be shown inline in # the documentation of the scope in which they are defined (i.e. file, # namespace, or group documentation), provided this scope is documented. If set # to NO, structs, classes, and unions are shown on a separate page (for HTML and # Man pages) or section (for LaTeX and RTF). # The default value is: NO. INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or # enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically be # useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. # The default value is: NO. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. # Note: This will also disable the warnings about undocumented members that are # normally produced when WARNINGS is set to YES. # The default value is: NO. EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined # locally in source files will be included in the documentation. If set to NO # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local methods, # which are defined in the implementation section but not in the interface are # included in the documentation. If set to NO only methods in the interface are # included. # The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base name of # the file that contains the anonymous namespace. By default anonymous namespace # are hidden. # The default value is: NO. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation # section is generated. This option has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO these classes will be included in the various overviews. This option has # no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # (class|struct|union) declarations. If set to NO these declarations will be # included in the documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # documentation blocks found inside the body of a function. If set to NO these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation that is typed after a # \internal command is included. If the tag is set to NO then the documentation # will be excluded. Set it to YES to include the internal documentation. # The default value is: NO. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file # names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. # The default value is: system dependent. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. SHOW_INCLUDE_FILES = YES # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader # which file to include in order to use the member. # The default value is: NO. SHOW_GROUPED_MEMB_INC = NO # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. # The default value is: YES. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member # name. If set to NO the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member # name. If set to NO the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and # destructors are listed first. If set to NO the constructors will appear in the # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief # member documentation. # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting # detailed member documentation. # The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will # appear in their defined order. # The default value is: NO. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will # be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the alphabetical # list. # The default value is: NO. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper # type resolution of all parameters of a function it will reject a match between # the prototype and the implementation of a member function even if there is # only one candidate or it is obvious which candidate to choose by doing a # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still # accept a match between prototype and implementation in such cases. # The default value is: NO. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the # todo list. This list is created by putting \todo commands in the # documentation. # The default value is: YES. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the # test list. This list is created by putting \test commands in the # documentation. # The default value is: YES. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional documentation # sections, marked by \if <section_label> ... \endif and \cond <section_label> # ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the # documentation. If the initializer consists of more lines than specified here # it will be hidden. Use a value of 0 to hide initializers completely. The # appearance of the value of individual variables and macros / defines can be # controlled using \showinitializer or \hideinitializer command in the # documentation regardless of this setting. # Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # the bottom of the documentation of classes and structs. If set to YES the list # will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This # will remove the Files entry from the Quick Index and from the Folder Tree View # (if specified). # The default value is: YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the # Folder Tree View (if specified). # The default value is: YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command command input-file, where command is the value of the # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml # will be used as the name of the layout file. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool # to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. Do not use file names with spaces, bibtex cannot handle them. See # also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated to # standard output by doxygen. If QUIET is set to YES this implies that the # messages are off. # The default value is: NO. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. # The default value is: YES. WARNINGS = YES # If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some parameters # in a documented function, or documenting parameters that don't exist or using # markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO doxygen will only warn about wrong or incomplete parameter # documentation, but not about the absence of documentation. # The default value is: NO. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard # error (stderr). WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with # spaces. # Note: If this tag is empty the current directory is searched. INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: http://www.gnu.org/software/libiconv) for the list of # possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank the # following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, # *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, # *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, # *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, # *.qsf, *.as and *.js. FILE_PATTERNS = *.cc, *.h # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. # The default value is: NO. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = *_test.cc */third_party/* */bazel-* */modules/kernel/* */modules/ros/* */modules/simulator/dreamview/node_modules/* */modules/simulation/dreamview/node_modules/* */apollo/release/* *.py # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands # irrespective of the value of the RECURSIVE tag. # The default value is: NO. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the # \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command: # # <filter> <input-file> # # where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the # name of an input file. Doxygen will then use the output that the filter # program writes to standard output. If FILTER_PATTERNS is specified, this tag # will be ignored. # # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: pattern=filter # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER ) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and # it is also possible to disable source filtering for a specific pattern using # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = README.md #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will be # generated. Documented entities will be cross-referenced with these sources. # # Note: To get rid of all source code in the generated output, make sure that # also VERBATIM_HEADERS is set to NO. # The default value is: NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and # Fortran comments will always remain visible. # The default value is: YES. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # function all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES, then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. REFERENCES_LINK_SOURCE = YES # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the # source code will show a tooltip with additional information such as prototype, # brief description and links to the definition and documentation. Since this # will make the HTML file larger and loading of large files a bit slower, you # can opt to disable this feature. # The default value is: YES. # This tag requires that the tag SOURCE_BROWSER is set to YES. SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system # (see http://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global # - Enable SOURCE_BROWSER and USE_HTAGS in the config file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # # Doxygen will invoke htags (and that will in turn invoke gtags), so these # tools must be available from the command line (i.e. in the search path). # # The result: instead of the source browser generated by doxygen, the links to # source code will now point to the output of htags. # The default value is: NO. # This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a # verbatim copy of the header file for each class for which an include is # specified. Set to NO to disable this. # See also: Section \class. # The default value is: YES. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all # compounds will be generated. Enable this if the project contains a lot of # classes, structs, unions or interfaces. # The default value is: YES. ALPHABETICAL_INDEX = YES # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in # which the alphabetical index list will be split. # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored # while generating the index headers. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). # The default value is: .html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a user-defined HTML header file for # each generated HTML page. If the tag is left blank doxygen will generate a # standard header. # # To get valid HTML the header file that includes any scripts and style sheets # that doxygen needs, which is dependent on the configuration options used (e.g. # the setting GENERATE_TREEVIEW). It is highly recommended to start with a # default header using # doxygen -w html new_header.html new_footer.html new_stylesheet.css # YourConfigFile # and then modify the file new_header.html. See also section "Doxygen usage" # for information on how to generate the default header that doxygen normally # uses. # Note: The header is subject to change so you typically have to regenerate the # default header when upgrading to a newer version of doxygen. For a description # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard # footer. See HTML_HEADER for more information on how to generate a default # footer and what special commands can be used inside the footer. See also # section "Doxygen usage" for information on how to generate the default footer # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of # the HTML output. If left blank doxygen will generate a default style sheet. # See also section "Doxygen usage" for information on how to generate the style # sheet that doxygen normally uses. # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as # it is more robust and this tag (HTML_STYLESHEET) will in the future become # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- # defined cascading style sheet that is included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the # standard style sheet and is therefor more robust against future updates. # Doxygen will copy the style sheet file to the output directory. For an example # see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that the # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the stylesheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see # http://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use grayscales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 # gradually make the output lighter, whereas values above 100 make the output # darker. The value divided by 100 is the actual gamma applied, so 80 represents # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not # change the gamma. # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this # to NO can help when comparing the output of multiple runs. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to # such a level that at most the specified number of entries are visible (unless # a fully collapsed tree already exceeds this amount). So setting the number of # entries 1 will produce a full collapsed tree by default. 0 is a special value # representing an infinite number of entries and will result in a full expanded # tree by default. # Minimum value: 0, maximum value: 9999, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development # environment (see: http://developer.apple.com/tools/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO # This tag determines the name of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider # (such as a company or product suite) can be grouped. # The default value is: Doxygen generated docs. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. # The default value is: org.doxygen.Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. # The default value is: Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop # (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML # files are now used as the Windows 98 help format, and will replace the old # Windows help format (.hlp) on all Windows platforms in the future. Compressed # HTML files also contain an index, a table of contents, and you can search for # words in the documentation. The HTML workshop also contains a viewer for # compressed HTML files. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler ( hhc.exe). If non-empty # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( # YES) or that it should be included in the master .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO # The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated ( # YES) or a normal table of contents ( NO) in the .chm file. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members to # the table of contents of the HTML help documentation and to the tree view. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help # (.qch) of the generated HTML documentation. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify # the file name of the resulting .qch file. The path specified is relative to # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace # (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual # Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- # folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the # generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To # install this plugin and make it available under the help contents menu in # Eclipse, the contents of the directory containing the HTML and XML files needs # to be copied into the plugins directory of eclipse. The name of the directory # within the plugins directory should be the same as the ECLIPSE_DOC_ID value. # After copying Eclipse needs to be restarted before the help appears. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO # A unique identifier for the Eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have this # name. Each documentation set should have its own identifier. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top # of each HTML page. A value of NO enables the index and the value YES disables # it. Since the tabs in the index contain the same information as the navigation # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag # value is set to YES, a side panel will be generated containing a tree-like # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has # the same information as the tab index, you could consider setting # DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # # Note that a value of 0 will completely suppress the enum values from appearing # in the overview section. # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML # output directory to force them to be regenerated. # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # # Note that when changing this option you need to delete any form_*.png files in # the HTML output directory before the changes have effect. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # http://www.mathjax.org) which uses client side Javascript for the rendering # instead of using prerendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: # http://docs.mathjax.org/en/latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the HTML # output directory using the MATHJAX_RELPATH option. The destination directory # should contain the MathJax.js script. For instance, if the mathjax directory # is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from http://www.mathjax.org before deployment. # The default value is: http://cdn.mathjax.org/mathjax/latest. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example, # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site # (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and # should work on any modern browser. Note that when using HTML help # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) # there is already a search function so this one should typically be disabled. # For large projects the javascript based search engine can be slow, then # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to # search using the keyboard; to jump to the search box use <access key> + S # (what the <access key> is depends on the OS and browser, but it is typically # <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down # key> to jump into the search results window, the results can be navigated # using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel # the search. The filter options can be selected when the cursor is inside the # search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys> # to select a filter and <Enter> or <escape> to activate or cancel the filter # option. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using Javascript. There # are two flavours of web server based searching depending on the # EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for # searching and an index file used by the script. When EXTERNAL_SEARCH is # enabled the indexing and searching needs to be provided by external tools. See # the section "External Indexing and Searching" for details. # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. SERVER_BASED_SEARCH = NO # When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP # script for searching. Instead the search results are written to an XML file # which needs to be processed by an external indexer. Doxygen will invoke an # external search engine pointed to by the SEARCHENGINE_URL option to obtain the # search results. # # Doxygen ships with an example indexer ( doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library # Xapian (see: http://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will return the search results when EXTERNAL_SEARCH is enabled. # # Doxygen ships with an example indexer ( doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library # Xapian (see: http://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed # search data is written to a file for indexing by an external tool. With the # SEARCHDATA_FILE tag the name of this file can be specified. # The default file is: searchdata.xml. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHDATA_FILE = searchdata.xml # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is # useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple # projects and redirect the results back to the right project. # This tag requires that the tag SEARCHENGINE is set to YES. EXTERNAL_SEARCH_ID = # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen # projects other than the one defined by this configuration file, but that are # all added to the same external search index. Each project needs to have a # unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of # to a relative location where the documentation can be found. The format is: # EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... # This tag requires that the tag SEARCHENGINE is set to YES. EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # Configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. # The default value is: YES. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: latex. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. # # Note that when enabling USE_PDFLATEX this option is only used for generating # bitmaps for formulas in the HTML output, but not in the Makefile that is # written to the output directory. # The default file is: latex. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate # index for LaTeX. # The default file is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some # trees in general. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used by the # printer. # Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x # 14 inches) and executive (7.25 x 10.5 inches). # The default value is: a4. # This tag requires that the tag GENERATE_LATEX is set to YES. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names # that should be included in the LaTeX output. To get the times font for # instance you can specify # EXTRA_PACKAGES=times # If left blank no extra packages will be included. # This tag requires that the tag GENERATE_LATEX is set to YES. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for the # generated LaTeX document. The header should contain everything until the first # chapter. If it is left blank doxygen will generate a standard header. See # section "Doxygen usage" for information on how to let doxygen write the # default header to a separate file. # # Note: Only use a user-defined header if you know what you are doing! The # following commands have a special meaning inside the header: $title, # $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will # replace them by respectively the title of the page, the current date and time, # only the current date, the version number of doxygen, the project name (see # PROJECT_NAME), or the project number (see PROJECT_NUMBER). # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the # generated LaTeX document. The footer should contain everything after the last # chapter. If it is left blank doxygen will generate a standard footer. # # Note: Only use a user-defined footer if you know what you are doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the LATEX_OUTPUT output # directory. Note that the files will be copied as-is; there are no commands or # markers available. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_EXTRA_FILES = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is # prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will # contain links (just like the HTML output) instead of page references. This # makes the output suitable for online browsing using a PDF viewer. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. PDF_HYPERLINKS = YES # If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate # the PDF file directly from the LaTeX files. Set this option to YES to get a # higher quality PDF documentation. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # command to the generated LaTeX files. This will instruct LaTeX to keep running # if errors occur, instead of asking the user for help. This option is also used # when generating formulas in HTML. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BATCHMODE = NO # If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the # index chapters (such as File Index, Compound Index, etc.) in the output. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HIDE_INDICES = NO # If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source # code with syntax highlighting in the LaTeX output. # # Note that which sources are shown also depends on other settings such as # SOURCE_BROWSER. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See # http://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The # RTF output is optimized for Word 97 and may not look too pretty with other RTF # readers/editors. # The default value is: NO. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: rtf. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF # documents. This may be useful for small projects and may help to save some # trees in general. # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will # contain hyperlink fields. The RTF file will contain links (just like the HTML # output) instead of page references. This makes the output suitable for online # browsing using Word or some other Word compatible readers that support those # fields. # # Note: WordPad (write) and others do not support links. # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's config # file, i.e. a series of assignments. You only have to provide replacements, # missing definitions are set to their default value. # # See also section "Doxygen usage" for information on how to generate the # default style sheet that doxygen normally uses. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is # similar to doxygen's config file. A template extensions file can be generated # using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES doxygen will generate man pages for # classes and files. # The default value is: NO. GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. A directory man3 will be created inside the directory specified by # MAN_OUTPUT. # The default directory is: man. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to the generated # man pages. In case the manual section does not start with a number, the number # 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is # optional. # The default value is: .3. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and doxygen generates man output, then it # will generate one additional man file for each entity documented in the real # man page(s). These additional files only source the real man page, but without # them the man command would be unable to find the correct page. # The default value is: NO. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_LINKS = NO #--------------------------------------------------------------------------- # Configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES doxygen will generate an XML file that # captures the structure of the code including all documentation. # The default value is: NO. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: xml. # This tag requires that the tag GENERATE_XML is set to YES. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a # validating XML parser to check the syntax of the XML files. # This tag requires that the tag GENERATE_XML is set to YES. XML_SCHEMA = # The XML_DTD tag can be used to specify a XML DTD, which can be used by a # validating XML parser to check the syntax of the XML files. # This tag requires that the tag GENERATE_XML is set to YES. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program # listings (including syntax highlighting and cross-referencing information) to # the XML output. Note that enabling this will significantly increase the size # of the XML output. # The default value is: YES. # This tag requires that the tag GENERATE_XML is set to YES. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- # If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files # that can be used to generate PDF. # The default value is: NO. GENERATE_DOCBOOK = NO # The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be put in # front of it. # The default directory is: docbook. # This tag requires that the tag GENERATE_DOCBOOK is set to YES. DOCBOOK_OUTPUT = docbook #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen # Definitions (see http://autogen.sf.net) file that captures the structure of # the code including all documentation. Note that this feature is still # experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # Configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module # file that captures the structure of the code including all documentation. # # Note that this feature is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary # Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI # output from the Perl module output. # The default value is: NO. # This tag requires that the tag GENERATE_PERLMOD is set to YES. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely # formatted so it can be parsed by a human reader. This is useful if you want to # understand what is going on. On the other hand, if this tag is set to NO the # size of the Perl module output will be much smaller and Perl will parse it # just the same. # The default value is: YES. # This tag requires that the tag GENERATE_PERLMOD is set to YES. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file are # prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful # so different doxyrules.make files included by the same Makefile don't # overwrite each other's variables. # This tag requires that the tag GENERATE_PERLMOD is set to YES. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all # C-preprocessor directives found in the sources and include files. # The default value is: YES. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names # in the source code. If set to NO only conditional compilation will be # performed. Macro expansion can be done in a controlled way by setting # EXPAND_ONLY_PREDEF to YES. # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then # the macro expansion is limited to the macros specified with the PREDEFINED and # EXPAND_AS_DEFINED tags. # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES the includes files in the # INCLUDE_PATH will be searched if a #include is found. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the # preprocessor. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will be # used. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that are # defined before the preprocessor is started (similar to the -D option of e.g. # gcc). The argument of the tag is a list of macros of the form: name or # name=definition (no spaces). If the definition and the "=" are omitted, "=1" # is assumed. To prevent a macro definition from being undefined via #undef or # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The # macro definition that is found in the sources will be used. Use the PREDEFINED # tag if you want to use a different macro definition that overrules the # definition found in the source code. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will # remove all references to function-like macros that are alone on a line, have an # all uppercase name, and do not end with a semicolon. Such function macros are # typically used for boiler-plate code, and will confuse the parser if not # removed. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration options related to external references #--------------------------------------------------------------------------- # The TAGFILES tag can be used to specify one or more tag files. For each tag # file the location of the external documentation should be added. The format of # a tag file without this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where loc1 and loc2 can be relative or absolute paths or URLs. See the # section "Linking to external documentation" for more information about the use # of tag files. # Note: Each tag file must have a unique name (where the name does NOT include # the path). If a tag file is not located in the directory in which doxygen is # run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create a # tag file that is based on the input files it reads. See section "Linking to # external documentation" for more information about the usage of tag files. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external class will be listed in the # class index. If set to NO only the inherited external classes will be listed. # The default value is: NO. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in # the modules index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. EXTERNAL_GROUPS = YES # If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in # the related pages index. If set to NO, only the current project's pages will # be listed. # The default value is: YES. EXTERNAL_PAGES = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of 'which perl'). # The default file (with absolute path) is: /usr/bin/perl. PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram # (in HTML and LaTeX) for classes with base or super classes. Setting the tag to # NO turns the diagrams off. Note that this option also works with HAVE_DOT # disabled, but it is recommended to install and use dot, since it yields more # powerful graphs. # The default value is: YES. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see: # http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. # If left empty dia is assumed to be found in the default search path. DIA_PATH = # If set to YES, the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: # http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of # processors available in the system. You can set it explicitly to a value # larger than 0 to get control over the balance between CPU load and processing # speed. # Minimum value: 0, maximum value: 32, default value: 0. # This tag requires that the tag HAVE_DOT is set to YES. DOT_NUM_THREADS = 0 # When you want a differently looking font n the dot files that doxygen # generates you can specify the font name using DOT_FONTNAME. You need to make # sure dot is able to find the font, which can be done by putting it in a # standard location or by setting the DOTFONTPATH environment variable or by # setting DOT_FONTPATH to the directory containing the font. # The default value is: Helvetica. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size (in points) of the font of # dot graphs. # Minimum value: 4, maximum value: 24, default value: 10. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the default font as specified with # DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set # the path where dot can find it using this tag. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = # If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for # each documented class showing the direct and indirect inheritance relations. # Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a # graph for each documented class showing the direct and indirect implementation # dependencies (inheritance, containment, and class references variables) of the # class with other documented classes. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for # groups, showing the direct groups dependencies. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. UML_LOOK = YES # If the UML_LOOK tag is enabled, the fields and methods are shown inside the # class node. If there are many fields or methods and many nodes the graph may # become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the # number of items for each type to make the size more manageable. Set this to 0 # for no limit. Note that the threshold may be exceeded by 50% before the limit # is enforced. So when you set the threshold to 10, up to 15 fields may appear, # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. # This tag requires that the tag HAVE_DOT is set to YES. UML_LIMIT_NUM_FIELDS = 10 # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. TEMPLATE_RELATIONS = NO # If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to # YES then doxygen will generate a graph for each documented file showing the # direct and indirect include dependencies of the file with other documented # files. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. INCLUDE_GRAPH = YES # If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are # set to YES then doxygen will generate a graph for each documented file showing # the direct and indirect include dependencies of the file with other documented # files. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH tag is set to YES then doxygen will generate a call # dependency graph for every global function or class method. # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. CALL_GRAPH = NO # If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller # dependency graph for every global function or class method. # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected # functions only using the \callergraph command. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical # hierarchy of all classes instead of a textual one. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the # dependencies a directory has on other directories in a graphical way. The # dependency relations are determined by the #include relations between the # files in the directories. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). # Possible values are: png, jpg, gif and svg. # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # # Note that this requires a modern browser other than Internet Explorer. Tested # and working are Firefox, Chrome, Safari, and Opera. # Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make # the SVG files visible. Older versions of IE do not have SVG support. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. INTERACTIVE_SVG = NO # The DOT_PATH tag can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile # command). # This tag requires that the tag HAVE_DOT is set to YES. DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the \mscfile # command). MSCFILE_DIRS = # The DIAFILE_DIRS tag can be used to specify one or more directories that # contain dia files that are included in the documentation (see the \diafile # command). DIAFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes # that will be shown in the graph. If the number of nodes in a graph becomes # larger than this value, doxygen will truncate the graph, which is visualized # by representing a node as a red box. Note that doxygen if the number of direct # children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that # the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. # Minimum value: 0, maximum value: 10000, default value: 50. # This tag requires that the tag HAVE_DOT is set to YES. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs # generated by dot. A depth value of 3 means that only nodes reachable from the # root by following a path via at most 3 edges will be shown. Nodes that lay # further from the root node will be omitted. Note that setting this option to 1 # or 2 may greatly reduce the computation time needed for large code bases. Also # note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. # Minimum value: 0, maximum value: 1000, default value: 0. # This tag requires that the tag HAVE_DOT is set to YES. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not seem # to support this out of the box. # # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support # this, this feature is disabled by default. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot # files that are used to generate the various graphs. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES
0
apollo_public_repos
apollo_public_repos/apollo/env.json
{ "OS": { "distro": "Ubuntu", "release": "18.04", "codename": "bionic" }, "Python": "3.6" }
0
apollo_public_repos
apollo_public_repos/apollo/collect_pre.sh
#! /usr/bin/env bash MOUNT_RES="$(df -h | grep /dev/nvme1n1)" echo ${MOUNT_RES} if [ -n MOUNT_RES ];then echo "mount nvme..." sudo mount /dev/nvme1n1 /media/caros/nvme2 sudo chmod 777 -R /media/caros/nvme2 else echo "nvme has been mount" fi if [ -e 'collect_data' ];then echo 'collect_data exist' else echo 'collect_data creating' mkdir collect_data fi echo "finish"
0
apollo_public_repos
apollo_public_repos/apollo/.prettierignore
bazel-* .cache # Temporarily settings for markdown prettier # tools *.py *.sh *.bash *.bashrc *.bazelrc *.html
0
apollo_public_repos
apollo_public_repos/apollo/.editorconfig
# http://editorconfig.org root = true [*] charset = utf-8 # like -i=2 indent_style = space indent_size = 2 insert_final_newline = true trim_trailing_whitespace = true [*.{sh,bash,bashrc}] shell_variant = bash # like -ln=bash binary_next_line = true # like -bn switch_case_indent = true # like -ci space_redirects = true # like -sr # in case third party libraries need a Makefile. [Makefile] indent_style = tab
0
apollo_public_repos
apollo_public_repos/apollo/README.md
![](docs/02_Quick%20Start/demo_guide/images/Apollo_logo.png) [![Build Status](http://180.76.142.62:8111/app/rest/builds/buildType:Apollo_Build/statusIcon)](http://180.76.142.62:8111/viewType.html?buildTypeId=Apollo_Build&guest=1) [![Simulation Status](https://azure.apollo.auto/dailybuildstatus.svg)](https://azure.apollo.auto/daily-build/public) ``` We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard. -- John F. Kennedy, 1962 ``` Welcome to Apollo's GitHub page! [Apollo](http://apollo.auto) is a high performance, flexible architecture which accelerates the development, testing, and deployment of Autonomous Vehicles. For business and partnership, please visit [our website](http://apollo.auto). ## Table of Contents 1. [Introduction](#introduction) 2. [Prerequisites](#prerequisites) 3. [Individual Versions](#individual-versions) 4. [Architecture](#architecture) 5. [Installation](#installation) 6. [Quick Starts](#quick-starts) 7. [Documents](#documents) ## Introduction Apollo is loaded with new modules and features but needs to be calibrated and configured perfectly before you take it for a spin. Please review the prerequisites and installation steps in detail to ensure that you are well equipped to build and launch Apollo. You could also check out Apollo's architecture overview for a greater understanding of Apollo's core technology and platforms. ## Prerequisites **[New 2021-01]** The Apollo platform (stable version) is now upgraded with software packages and library dependencies of newer versions including: 1. CUDA upgraded to version 11.1 to support Nvidia Ampere (30x0 series) GPUs, with NVIDIA driver >= 455.32 2. LibTorch (both CPU and GPU version) bumped to version 1.7.0 accordingly. We do not expect a disruption to your current work, but to ease your life of migration, you would need to: 1. Update NVIDIA driver on your host to version >= 455.32. ([Web link](https://www.nvidia.com/Download/index.aspx?lang=en-us)) 2. Pull latest code and run the following commands after restarting and logging into Apollo Development container: ```bash # Remove Bazel output of previous builds rm -rf /apollo/.cache/{bazel,build,repos} # Re-configure bazelrc. ./apollo.sh config --noninteractive ``` --- * The vehicle equipped with the by-wire system, including but not limited to brake-by-wire, steering-by-wire, throttle-by-wire and shift-by-wire (Apollo is currently tested on Lincoln MKZ) * A machine with a 8-core processor and 16GB memory minimum * NVIDIA Turing GPU / AMD GFX9/RDNA/CDNA GPU is strongly recommended * Ubuntu 18.04 * NVIDIA driver version 455.32.00 and above ([Web link](https://www.nvidia.com/Download/index.aspx?lang=en-us)) or [ROCm v5.1](https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.1/page/Prerequisite_Actions.html) and above. * Docker-CE version 19.03 and above ([Official doc](https://docs.docker.com/engine/install/ubuntu/)) * NVIDIA Container Toolkit ([Official doc](https://github.com/NVIDIA/nvidia-docker)) **Please note**, it is recommended that you install the versions of Apollo in the following order: **1.0 -> whichever version you would like to test out**. The reason behind this recommendation is that you need to confirm whether individual hardware components and modules are functioning correctly, and clear various version test cases before progressing to a higher and more capable version for your safety and the safety of those around you. ## Individual Versions: The following diagram highlights the scope and features of each Apollo release: ![](docs/02_Quick%20Start/demo_guide/images/Apollo_Roadmap_8_0.png) [**Apollo 1.0:**](docs/11_Hardware%20Integration%20and%20Calibration/%E8%BD%A6%E8%BE%86%E9%9B%86%E6%88%90/%E7%A1%AC%E4%BB%B6%E5%AE%89%E8%A3%85hardware%20installation/apollo_1_0_hardware_system_installation_guide.md) Apollo 1.0, also referred to as the Automatic GPS Waypoint Following, works in an enclosed venue such as a test track or parking lot. This installation is necessary to ensure that Apollo works perfectly with your vehicle. The diagram below lists the various modules in Apollo 1.0. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_1.png) [**Apollo 1.5:**](docs/11_Hardware%20Integration%20and%20Calibration/%E8%BD%A6%E8%BE%86%E9%9B%86%E6%88%90/%E7%A1%AC%E4%BB%B6%E5%AE%89%E8%A3%85hardware%20installation/apollo_1_5_hardware_system_installation_guide.md) Apollo 1.5 is meant for fixed lane cruising. With the addition of LiDAR, vehicles with this version now have better perception of its surroundings and can better map its current position and plan its trajectory for safer maneuvering on its lane. Please note, the modules highlighted in Yellow are additions or upgrades for version 1.5. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_1_5.png) [**Apollo 2.0:**](docs/11_Hardware%20Integration%20and%20Calibration/%E8%BD%A6%E8%BE%86%E9%9B%86%E6%88%90/%E7%A1%AC%E4%BB%B6%E5%AE%89%E8%A3%85hardware%20installation/apollo_2_0_hardware_system_installation_guide_v1.md#key-hardware-components) Apollo 2.0 supports vehicles autonomously driving on simple urban roads. Vehicles are able to cruise on roads safely, avoid collisions with obstacles, stop at traffic lights, and change lanes if needed to reach their destination. Please note, the modules highlighted in Red are additions or upgrades for version 2.0. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_2.png) [**Apollo 2.5:**](docs/11_Hardware%20Integration%20and%20Calibration/%E8%BD%A6%E8%BE%86%E9%9B%86%E6%88%90/%E7%A1%AC%E4%BB%B6%E5%AE%89%E8%A3%85hardware%20installation/apollo_2_5_hardware_system_installation_guide_v1.md) Apollo 2.5 allows the vehicle to autonomously run on geo-fenced highways with a camera for obstacle detection. Vehicles are able to maintain lane control, cruise and avoid collisions with vehicles ahead of them. ``` Please note, if you need to test Apollo 2.5; for safety purposes, please seek the help of the Apollo Engineering team. Your safety is our #1 priority, and we want to ensure Apollo 2.5 was integrated correctly with your vehicle before you hit the road. ``` ![](docs/02_Quick%20Start/demo_guide/images/Apollo_2_5.png) [**Apollo 3.0:**](docs/02_Quick%20Start/apollo_3_0_quick_start.md) Apollo 3.0's primary focus is to provide a platform for developers to build upon in a closed venue low-speed environment. Vehicles are able to maintain lane control, cruise and avoid collisions with vehicles ahead of them. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_3.0_diagram.png) [**Apollo 3.5:**](docs/02_Quick%20Start/apollo_3_5_quick_start.md) Apollo 3.5 is capable of navigating through complex driving scenarios such as residential and downtown areas. The car now has 360-degree visibility, along with upgraded perception algorithms to handle the changing conditions of urban roads, making the car more secure and aware. Scenario-based planning can navigate through complex scenarios, including unprotected turns and narrow streets often found in residential areas and roads with stop signs. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_3_5_Architecture.png) [**Apollo 5.0:**](docs/02_Quick%20Start/apollo_3_5_quick_start.md) Apollo 5.0 is an effort to support volume production for Geo-Fenced Autonomous Driving. The car now has 360-degree visibility, along with upgraded perception deep learning model to handle the changing conditions of complex road scenarios, making the car more secure and aware. Scenario-based planning has been enhanced to support additional scenarios like pull over and crossing bare intersections. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_5_0_diagram1.png) [**Apollo 5.5:**](docs/02_Quick%20Start/apollo_5_5_quick_start.md) Apollo 5.5 enhances the complex urban road autonomous driving capabilities of previous Apollo releases, by introducing curb-to-curb driving support. With this new addition, Apollo is now a leap closer to fully autonomous urban road driving. The car has complete 360-degree visibility, along with upgraded perception deep learning model and a brand new prediction model to handle the changing conditions of complex road and junction scenarios, making the car more secure and aware. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_5_5_Architecture.png) [**Apollo 6.0:**](docs/02_Quick%20Start/apollo_6_0_quick_start.md) Apollo 6.0 incorporates new deep learning models to enhance the capabilities for certain Apollo modules. This version works seamlessly with new additions of data pipeline services to better serve Apollo developers. Apollo 6.0 is also the first version to integrate certain features as a demonstration of our continuous exploration and experimentation efforts towards driverless technology. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_6_0.png) **Apollo 7.0:** Apollo 7.0 incorporates 3 brand new deep learning models to enhance the capabilities for Apollo Perception and Prediction modules. Apollo Studio is introduced in this version, combining with Data Pipeline, to provide a one-stop online development platform to better serve Apollo developers. Apollo 7.0 also publishes the PnC reinforcement learning model training and simulation evaluation service based on previous simulation service. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_7_0.png) [**Apollo 8.0:**](docs/02_Quick%20Start/apollo_8_0_quick_start.md) Apollo 8.0 is an effort to provide an extensible software framework and complete development cycle for Autonomous Driving developer. Apollo 8.0 introduces easily-reused “Package” to organize software modules. Apollo 8.0 integrates the whole process of perception development ,by combining model training service, model deployment tool and end-to-end visual validation tool . And another 3 new deep learning models are incorporated in Apollo 8.0 for perception module. Simulation service is upgraded by integrating local simulator in Dreamview to provide powerful debug tool for PnC developer. ![](docs/02_Quick%20Start/demo_guide/images/Apollo_8_0.png) ## Architecture * **Hardware/ Vehicle Overview** ![](docs/02_Quick%20Start/demo_guide/images/Hardware_overview_3_5.png) * **Hardware Connection Overview** ![](docs/02_Quick%20Start/demo_guide/images/Hardware_connection_3_5_1.png) * **Software Overview** ![](docs/02_Quick%20Start/demo_guide/images/Apollo_3_5_software_architecture.png) ## Installation * [Hardware installation guide](docs/11_Hardware%20Integration%20and%20Calibration/%E8%BD%A6%E8%BE%86%E9%9B%86%E6%88%90/%E7%A1%AC%E4%BB%B6%E5%AE%89%E8%A3%85hardware%20installation/apollo_3_5_hardware_system_installation_guide.md) * [Software installation guide](docs/01_Installation%20Instructions/apollo_software_installation_guide_package_method.md) - **This step is required** * [Launch and run Apollo](docs/03_Package%20Management/launch_and_run_apollo_package_method.md) Congratulations! You have successfully built out Apollo without Hardware. If you do have a vehicle and hardware setup for a particular version, please pick the Quickstart guide most relevant to your setup: ## Quick Starts: * [Apollo 8.0 QuickStart Guide](docs/02_Quick%20Start/apollo_8_0_quick_start.md) * [Apollo 6.0 QuickStart Guide](docs/02_Quick%20Start/apollo_6_0_quick_start.md) * [Apollo 5.5 QuickStart Guide](docs/02_Quick%20Start/apollo_5_5_quick_start.md) * [Apollo 5.0 QuickStart Guide](docs/02_Quick%20Start/apollo_5_0_quick_start.md) * [Apollo 3.5 QuickStart Guide](docs/02_Quick%20Start/apollo_3_5_quick_start.md) * [Apollo 3.0 QuickStart Guide](docs/02_Quick%20Start/apollo_3_0_quick_start.md) * [Apollo 2.5 QuickStart Guide](docs/02_Quick%20Start/apollo_2_5_quick_start.md) * [Apollo 2.0 QuickStart Guide](docs/02_Quick%20Start/apollo_2_0_quick_start.md) * [Apollo 1.5 QuickStart Guide](docs/02_Quick%20Start/apollo_1_5_quick_start.md) * [Apollo 1.0 QuickStart Guide](docs/02_Quick%20Start/apollo_1_0_quick_start.md) ## Documents * [Installation Instructions](docs/01_Installation%20Instructions/) * [Quick Start](docs/02_Quick%20Start/) * [Package Management](docs/03_Package%20Management/) * [CyberRT](docs/04_CyberRT/) * [Localization](docs/05_Localization/) * [Perception](docs/06_Perception/) * [Prediction](docs/07_Prediction/) * [Planning](docs/08_Planning/) * [Decider](docs/09_Decider/) * [Control](docs/10_Control/) * [Hardware Integration and Calibration](docs/11_Hardware%20Integration%20and%20Calibration/) * [Map acquisition](docs/12_Map%20acquisition/) * [Apollo Tool](docs/13_Apollo%20Tool/) * [Others](docs/14_Others/) * [FAQs](docs/15_FAQS/README.md) ## Questions You are welcome to submit questions and bug reports as [GitHub Issues](https://github.com/ApolloAuto/apollo/issues). ## Copyright and License Apollo is provided under the [Apache-2.0 license](https://github.com/ApolloAuto/apollo/blob/master/LICENSE). ## Disclaimer Apollo open source platform only has the source code for models, algorithms and processes, which will be integrated with cybersecurity defense strategy in the deployment for commercialization and productization. Please refer to the Disclaimer of Apollo in [Apollo's official website](https://developer.apollo.auto/docs/disclaimer.html). ## Connect with us * [Have suggestions for our GitHub page?](https://github.com/ApolloAuto/apollo/issues) * [Twitter](https://twitter.com/apolloplatform) * [YouTube](https://www.youtube.com/channel/UC8wR_NX_NShUTSSqIaEUY9Q) * [Blog](https://www.medium.com/apollo-auto) * [Newsletter](http://eepurl.com/c-mLSz) * Interested in our turnKey solutions or partnering with us Mail us at: apollopartner@baidu.com
0
apollo_public_repos
apollo_public_repos/apollo/RELEASE.md
# Release 8.0 Apollo 8.0 is an effort to provide an extensible software framework and complete development cycle for Autonomous Driving developer. Apollo 8.0 introduces easily-reused Package to organize software modules. Apollo 8.0 integrates the whole process of perception development ,by combining model training service, model deployment tool and end-to-end visual validation tool . And another 3 new deep learning models are incorporated in Apollo 8.0 for perception module. Simulation service is upgraded by integrating local simulator in Dreamview to provide powerful debug tool for PnC developer. ## Major Features and Improvements * Reusable software Package * Reorganize the modules based on Package to provide the functionality in an easy-to-consume manner * Fast installation experience based on Package, refer to [Installation - Package Method](docs/01_Installation%20Instructions/apollo_software_installation_guide_package_method.md) * Support customizing , publishing and sharing Package * Brand New Deep Learning Models * CenterPoint, center-based two-stage 3D obstacle detection model * CaDDN, camera obstacle detection model * BEV PETR, camera obstacle detection model * Complete Perception Development Process * Support Paddle3D to provide Model Training service * Provide model deployment tool by normalizing the model meta. * Provide visual validation tool in Dreamview * Upgraded PnC Simulation Service * Provide PnC debug tool by integrating local simulator in Dreamview * Support scenario editing online and download in Dreamview **[Note]** All models and methodologies included in Apollo 8.0 are for research purposes only. Productized and commercial uses of these models are NOT encouraged, and it is at your own risk. Please be cautious to try Apollo 8.0 with enough safety protection mechanism. Your feedback is highly appreciated for us to continuously improve the models. # Release 7.0 Apollo 7.0 incorporates 3 brand new deep learning models to enhance the capabilities for Apollo Perception and Prediction modules. Apollo Studio is introduced in this version, combining with Data Pipeline, to provide a one-stop online development platform to better serve Apollo developers. Apollo 7.0 also publishes the PnC reinforcement learning model training and simulation evaluation service based on previous simulation service. ## Major Features and Improvements * Brand New Deep Learning Models * Mask-Pillars obstacle detection model based on PointPillars * Inter-TNT prediction model based on interactive prediction & planning evaluator * Camera obstacle detection model based on SMOKE * Apollo Studio Services * Practice environment service * Vehicle management service * PnC Reinforcement Learning Services * Smart training and evaluation close-loop service * Extension Interface * Upgraded Perception Module Code Structure **[Note]** All models and methodologies included in Apollo 7.0 are for research purposes only. Productized and commercial uses of these models are **NOT** encouraged, and it is at your own risk. Please be cautious to try Apollo 7.0 with enough safety protection mechanism. Your feedback is highly appreciated for us to continuously improve the models. # Release 6.0 Apollo 6.0 incorporates new deep learning models to enhance the capabilities for certain Apollo modules. This version works seamlessly with new additions of data pipeline services to better serve Apollo developers. Apollo 6.0 is also the first version to integrate certain features as a demonstration of our continuous exploration and experimentation efforts towards driverless technology. ## Major Features and Improvements * Upgraded Deep Learning Models * PointPillars based obstacle detection model * Semantic map based pedestrian prediction model * Learning based trajectory planning model * Brand New Data Pipeline Services * Low speed obstacle prediction model training service with semantic map support * PointPillars based obstacle detection model training service * Control profiling service * Vehicle dynamic model training service * Open space planner profiling service * Complete control parameter auto-tune service * Driverless Research * Remote control interface with DreamView integration * Audio based emergency vehicle detection system **[Note]** All models and methodologies included in Apollo 6.0 are for research purposes only. Productized and commercial uses of these models are **NOT** encouraged, and it is at your own risk. Please be cautious to try Apollo 6.0 with enough safety protection mechanism. Your feedback is highly appreciated for us to continuously improve the models. # Release 5.5 Apollo 5.5 enhances the complex urban road autonomous driving capabilities of previous Apollo releases, by introducing curb-to-curb driving support. With this new addition, Apollo is now a leap closer to fully autonomous urban road driving. The car has complete 360-degree visibility, along with upgraded perception deep learning model a brand new prediction model to handle the changing conditions of complex road and junction scenarios, making the car more secure and aware. New Planning scenarios have been introduced to support curb-side functionality. ## Major Features And Improvements * Brand new Data Pipeline Service * Sensor Calibration service * Brand new module - Storytelling * Scenario - Based Planning with a new planning scenarios to support curb-to-curb driving * Park-and-go * Emergency * Prediction Model - Caution Obstacle * Semantic LSTM evaluator * Extrapolation predictor * Control module * Model Reference Adaptive Control (MRAC) * Control profiling service * Simulation scenarios ## Autonomous Drive Capabilities Vehicles with this version can drive autonomously in complex urban road conditions including both residential and downtown areas. **BE CAUTIOUS WHEN DRIVING AUTONOMOUSLY, ESPECIALLY AT NIGHT OR IN POOR VISION ENVIRONMENT. URBAN DRIVING INVOLVES NAVIGATING HIGH RISK ZONES LIKE SCHOOLS, PLEASE TEST APOLLO 5.0 WITH THE SUPPORT FROM APOLLO ENGINEERING TEAM, PLEASE AVOID DRIVING THE VEHICLE ON THE HIGHWAY OR AT SPEEDS THAT ARE ABOVE OUR SUPPORTED THRESHOLD**. # Release 5.0 Apollo 5.0 is an effort to support volume production for Geo-Fenced Autonomous Driving. The car now has 360-degree visibility, along with upgraded perception deep learning model to handle the changing conditions of complex road scenarios, making the car more secure and aware. Scenario-based planning has been enhanced to support additional scenarios like pull over and crossing bare intersections. ## Major Features And Improvements * Brand new Data Pipeline Service * Vehicle Calibration * New Perception algorithms * Sensor Calibration Service * Scenario - Based Planning with a new planning algorithm, Open Space Planner and new scenarios supported * Intersection - STOP Sign, Traffic Light, Bare Intersection * Park - Valet, Pull Over * Map Data Verification tool * Prediction Evaluators * Simulation web platform - Dreamland * Scenario Editor * Control-in-loop Simulation * Apollo Synthetic Data Set ## Autonomous Drive Capabilities Vehicles with this version can drive autonomously in complex urban road conditions including both residential and downtown areas. **BE CAUTIOUS WHEN DRIVING AUTONOMOUSLY, ESPECIALLY AT NIGHT OR IN POOR VISION ENVIRONMENT. URBAN DRIVING INVOLVES NAVIGATING HIGH RISK ZONES LIKE SCHOOLS, PLEASE TEST APOLLO 5.0 WITH THE SUPPORT FROM APOLLO ENGINEERING TEAM, PLEASE AVOID DRIVING THE VEHICLE ON THE HIGHWAY OR AT SPEEDS THAT ARE ABOVE OUR SUPPORTED THRESHOLD**. # Release 3.5 Apollo 3.5 is capable of navigating through complex driving scenarios such as residential and downtown areas. With 360-degree visibility and upgraded perception algorithms to handle the changing conditions of urban roads, the car is more secure and aware. ## Major Features And Improvements * Upgraded Sensor Suite * VLS - 128 Line LiDAR * FPD-Link Cameras * Continental high-range function radars * Apollo Expansion Unit (AXU) * Additional IPC * Brand new Runtime Framework - **Apollo CyberRT** which is specifically targeted towards autonomous driving * New Perception algorithms * Scenario - Based Planning with a new planning algorithm, Open Space Planner * New Localization algorithm * V2X Capabilities * Open Vehicle Certification platform - 2 new vehicles added **GAC GE3** and **GWM WEY VV6** ## Autonomous Drive Capabilities Vehicles with this version can drive autonomously in complex urban road conditions including both residential and downtown areas. **BE CAUTIOUS WHEN DRIVING AUTONOMOUSLY, ESPECIALLY AT NIGHT OR IN POOR VISION ENVIRONMENT. URBAN DRIVING INVOLVES NAVIGATING HIGH RISK ZONES LIKE SCHOOLS, PLEASE TEST APOLLO 3.5 WITH THE SUPPORT FROM APOLLO ENGINEERING TEAM**. # Release 3.0 Apollo 3.0 enables L4 product level solution that allows vehicles to drive in a closed venue setting at a low speed. Automakers can now leverage this one stop solution for autonomous driving without having to customize on their own. ## Major Features And Improvements * New Safety module called Guardian * Enhanced Surveillance module - Monitor * Hardware service layer that will now act like a platform and not a product, giving developers the flexibility to integrate their own Hardware * Apollo Sensor Unit (ASU) * New Gatekeeper - Ultrasonic Sensor * Perception module changes: * **CIPV(Closest In-Path Vehicle) detection and Tailgating**: The vehicle in front of the ego-car is detected and its trajectory is estimated for more efficient tailgating and lane keeping when lane detection is unreliable. * **Asynchronous sensor fusion**: unlike the previous version, Perception in Apollo 3.0 is capable of consolidating all the information and data points by asynchronously fusing LiDAR, Radar and Camera data. Such conditions allow for more comprehensive data capture and reflect more practical sensor environments. * **Online pose estimation**: This new feature estimates the pose of an ego-vehicle for every single frame. This feature helps to drive through bumps or slopes on the road with more accurate 3D scene understanding. * **Ultrasonic sensors**: Perception in Apollo 3.0 now works with ultrasonic sensors. The output can be used for Automated Emergency Brake (AEB) and vertical/perpendicular parking. * **Whole lane line**: Unlike previous lane line segments, this whole lane line feature will provide more accurate and long range detection of lane lines. * **Visual localization**: Cameras are currently being tested to aid and enhance localization * **16 beam LiDAR support** ## Autonomous Driving Capabilities Vehicles with this version can drive autonomously in a Closed Venue setting. It is a production ready version for low-speed autonomous driving capabilities. # Release 2.5 This release allows the vehicle to autonomously run on geo-fenced highways. Vehicles are able to do lane keeping cruise and avoid collisions with the leading vehicles. ## Major Features And Improvements * Upgrade localization based on multiple sensor fusion (MSF) * Upgrade DreamView with more visualization features * Add HD map data collection tool * Add vision based perception with obstacle and lane mark detections * Add relative map to support ACC and lane keeping for planning and control * Make docker file available ## Autonomous Drive Capabilities Vehicles with this version can drive autonomously on highways at higher speed with limited HD map support. The highway needs to have clear white painted lane marks with minimum curvatures. The performance of vision based perception will degrade significantly at night or with strong light flares. **BE CAUTIOUS WHEN DRIVING AUTONOMOUSLY, ESPECIALLY AT NIGHT OR IN POOR VISION ENVIRONMENT. PLEASE TEST APOLLO 2.5 WITH THE SUPPORT FROM APOLLO ENGINEERING TEAM**. # Release 2.0 This release supports that vehicles autonomously drive on simple urban roads. Vehicles are able to cruise and avoid collisions with obstacles, stop at traffic lights and change lanes if needed to reach the destination. ## Major Features And Improvements * Add traffic light detection * Add obstacle classification and support obstacle categories: _vehicle_, _pedestrian_, _cyclist_ and _unknown_ * Upgrade planning capability to change lanes in order to reach the destination * Add point cloud based localization algorithm fusion with RTK * Add MPC based control algorithm * Add RNN model for traffic prediction * Integrate HMI and DreamView * Redesign DreamView and upgrade it with additional debugging visualization tools * Add additional debugging tools in `modules/tools` * Add release docker image upgrade through secure OTA * Add USB camera and radar driver support ## Autonomous Driving Capabilities Vehicles with this version can drive autonomously on simple urban roads with light to medium traffic at slow to medium speed. # Release 1.5 This release supports that vehicles autonomously cruise on fixed lanes. ## Major Features And Improvements * Add routing, perception, prediction, planning and end-to-end * **_Perception_**: 3D point cloud based obstacle detection and tracking with GPU support * **_Prediction_**: Deep neural network MLP prediction model and multiple predictors handling different categories of obstacles * **_Planning_**: traffic law modules, multiple iterations of DP and QP optimizations for path and speed * **_End-to-end_**: Mixed deep neural network models with convolutional LSTM in longitudinal and FCNN in lateral * Add HD Map engine APIs * Add Velodyne 64 LiDAR driver support * Add debugging tools in `modules/tools/` * Improve HMI and DreamView features to allow realtime traffic display and traffic scenario replay. ## Autonomous Driving Capabilities Vehicles with this version do **NOT** detect traffic lights. Vehicles will **NOT** stop at red traffic lights. Neither will they change lanes on the road. # Release 1.0 Initial release of Apollo implements autonomous GPS waypoint following. ## Major Features And Improvements * Include localization, control * **_Location_**: RTK * **_Control_**: calibration table in longitudinal and LQR in lateral * Add GPS/IMU gnss driver support * Use HMI to record and replay a trajectory, and DreamView to visualize vehicle trajectory * Include debugging tools in `modules/tools/` ## Autonomous Driving Capabilities Vehicles with this version do **NOT** perceive obstacles in close promixity. Neither can they drive on public roads or areas without GPS signals.
0
apollo_public_repos
apollo_public_repos/apollo/.prettierrc.json
{ "proseWrap": "always", "semi": true, "trailingComma": "all", "singleQuote": true, "tabWidth": 2, "useTabs": false, "printWidth": 80 }
0
apollo_public_repos
apollo_public_repos/apollo/MANIFESTO.md
## Apollo Governance Apollo is an open platform whose primary purpose is to become a vibrant autonomous driving ecosystem by providing a comprehensive, safe, secure, and reliable solution that supports all major features and functions of an autonomous vehicle. Apollo's ambition is no less than to revolutionize the auto and transportation industries, and there will be challenges of unprecedented scale and complexity along the way. Given Apollo's enormous potential to change the world, this historic opportunity requires a unique governance model that must support a highly effective leadership which is as inclusive and open as possible in order to swiftly achieve Apollo's vision. In order to safeguard the architectural integrity, system reliability, and rapid evolution of Apollo, Baidu is willing to step up and exercise its leadership in driving important decisions whenever needed while preserving active participation of the wider community. ## Apollo Manifesto In essence, Apollo is the freedom from wasting time and resources re-implementing fundamental components and allows each member of the ecosystem to focus on their specific areas of expertise, which will dramatically increase the speed of innovation. Apollo’s comprehensive, modular solution allows anyone to use as much or as little of the existing source code and data. Open source code portions can be modified and open capability components accessible through an API can be replaced with proprietary implementations. All this can then be contributed back to Apollo, redistributed, and commercialized. Critical considerations such as ensuring reliability, handling failover, and guaranteeing security that would pose a challenge to most development efforts will be readily available components. Everyone can benefit from Apollo's capabilities to improve individual competitive advantage. Apollo provides high quality code and data that allows anyone to bootstrap their autonomous driving development, but only with contributions from Apollo’s partners and the wider community can Apollo become increasingly more capable. The goal is to create a virtuous cycle where software and services are deployed onto the vehicle to obtain quality data, which is then used to create an even more capable autonomous system. Accelerating this iterative cycle is the engine of innovation that will give birth to a viable autonomous vehicle and compelling services leading to a breakthrough autonomous ecosystem. Apollo welcomes anyone to make technical and non-technical contributions, but the most valuable contribution is high quality data, it is the very fuel that drives innovation. Baidu will seed Apollo with its vast dataset that the community can experiment with. However, Baidu’s contribution alone is not enough to sustain Apollo’s evolution let alone realize Apollo’s grand ambition. Therefore, Apollo will create an innovative data collective that will pool high quality data from Apollo’s partners, each of whom can leverage a larger data set than it can gather individually. This innovative platform and data service creates a lasting, mutually beneficial business model that accelerates individual innovation as well as sustains the growth of a breakthrough ecosystem. On a broader level, Apollo will engage academia, government, and the general public in order to convince and educate society on the acceptance and adoption of autonomous technology. Only by growing the ecosystem together rather than through individual efforts can the full potential of autonomous vehicles and services be realized for the benefit of all. ## Attribution This Manifesto is available on our website [apollo.auto](http://apollo.auto/docs/manifesto.html).
0
apollo_public_repos
apollo_public_repos/apollo/CONTRIBUTING.md
## How to Contribute to Apollo ### Contributor License Agreements You are welcome to contribute to the Apollo project. To contribute, please agree with the [Apollo individual contributor license agreement] (https://gist.githubusercontent.com/startcode/f5ccf8887bfc7727a0ae05bf0d601e30/raw/029a11300e987e34a29a9d247ac30caa7f6741a7/Apollo_Individual_Contributor_License_Agreement) first. ### How do I start contributing - You can follow the standard [Github approach](https://help.github.com/articles/using-pull-requests/) to contribute code. There is also a detailed how-to guide on _How to Create Pull Request_ in both [English](docs/14_Others/%E4%BB%A3%E7%A0%81%E5%AE%9E%E8%B7%B5/how_to_create_pull_request.md) and [Chinese](docs/14_Others/%E4%BB%A3%E7%A0%81%E5%AE%9E%E8%B7%B5/how_to_create_pull_request_cn.md). - There are [issues with label "help wanted"](https://github.com/ApolloAuto/apollo/issues?utf8=%E2%9C%93&q=label%3A%22Type%3A+Help+wanted%22+) that are best to help you get started. - If you are currently working on an issue, leave a message to let people know that you are working on it. - Before sending in your pull request for [review](https://github.com/ApolloAuto/apollo/pulls), make sure your changes follow the guidelines mentioned below, namely: license, testing and coding style guidelines. #### License For each new file, please include a license at the top of the file. - C++ code License example [util.h](modules/common/util/util.h); - Python code License example [process.py](modules/tools/vehicle_calibration/process.py); - Bash code License example [apollo_base.sh](scripts/apollo_base.sh); #### Testing Please include unit tests for the contributed code to prove that your code works correctly, and make sure that your code does not break existing tests. Test files are always named to end with `_test.cc`, and the test target names in the BUILD file always end with `test`. Here is an example test file [file_test.cc](cyber/common/file_test.cc). You can use command `bash apollo.sh test` to run all unit tests. #### Coding style - **C/C++ coding style**: Apollo adopted the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). Make sure your code conforms to this style guide. You can use command `bash apollo.sh lint` to check if your code has any style issue. - **Python coding style**: Apollo adopted the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html). You can use the [yapf](https://github.com/google/yapf) command `yapf -i --style='{based_on_style: google}' foo.py` to format a file foo.py. - **Apollo best coding practice**: Please also refer to [Apollo Best Coding Practice](docs/technical_tutorial/apollo_best_coding_practice.md) for more coding practice disciplines. - **BUILD file coding style** : you can use command `bash apollo.sh format path/to/BUILD/files` to format your BUILD files before you submit. #### Documentation If your code is not straightforward for other contributors to understand, it is recommended to implement the code in a clear and efficient way, and provide sufficient comments and documentation. Apollo uses doxygen to help generate formatted API Document with command `bash apollo.sh doc generate`. To document your code, please follow the guide: [How to document code](docs/01_Installation%20Instructions/how_to_document_code.md). #### Commit Message The first line of commit message should be a one-line summary of the change. A paragraph can be added following the summary to clearly explain the details of the change. If your code fixed an issue, add the issue number to your commit message. An example of a good commit message is: > Control: Replaced algorithm A with algorithm B in modules/control. > > Algorithm B is faster than A because it uses binary search. The runtime is > reduced from O(N) to O(log(N)). > > Fixes #1234 ### Before Creating Pull Request After you finish your code and are ready to create a Pull Request, please make sure your change don't break build/test/lint by running `bash apollo.sh check`, which is equivalent to a combination of `bash apollo.sh build`, `bash apollo.sh test` and `bash apollo.sh lint`.
0
apollo_public_repos
apollo_public_repos/apollo/apollo.sh
#! /usr/bin/env bash set -e TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" source "${TOP_DIR}/scripts/apollo.bashrc" ARCH="$(uname -m)" SUPPORTED_ARCHS=" x86_64 aarch64 " APOLLO_VERSION="@non-git" APOLLO_ENV="" USE_ESD_CAN=false : ${STAGE:=dev} AVAILABLE_COMMANDS="config build build_dbg build_opt build_cpu build_gpu build_opt_gpu test coverage lint \ buildify check build_fe build_teleop build_prof doc clean format usage -h --help" function check_architecture_support() { if [[ "${SUPPORTED_ARCHS}" != *" ${ARCH} "* ]]; then error "Unsupported CPU arch: ${ARCH}. Currently, Apollo only" \ "supports running on the following CPU archs:" error "${TAB}${SUPPORTED_ARCHS}" exit 1 fi } function check_platform_support() { local platform="$(uname -s)" if [[ "${platform}" != "Linux" ]]; then error "Unsupported platform: ${platform}." error "${TAB}Apollo is expected to run on Linux systems (E.g., Debian/Ubuntu)." exit 1 fi } function check_minimal_memory_requirement() { local minimal_mem_gb="2.0" local actual_mem_gb="$(free -m | awk '/Mem:/ {printf("%0.2f", $2 / 1024.0)}')" if (($(echo "$actual_mem_gb < $minimal_mem_gb" | bc -l))); then warning "System memory [${actual_mem_gb}G] is lower than the minimum required" \ "[${minimal_mem_gb}G]. Apollo build could fail." fi } function determine_esdcan_use() { local esdcan_dir="${APOLLO_ROOT_DIR}/third_party/can_card_library/esd_can" local use_esd=false if [[ "${ARCH}" == "x86_64" ]] && [[ -f "${esdcan_dir}/include/ntcan.h" ]] && [[ -f "${esdcan_dir}/lib/libntcan.so.4" ]]; then use_esd=true fi USE_ESD_CAN="${use_esd}" } function check_apollo_version() { local branch="$(git_branch)" if [ "${branch}" == "${APOLLO_VERSION}" ]; then return fi local sha1="$(git_sha1)" local stamp="$(git_date)" APOLLO_VERSION="${branch}-${stamp}-${sha1}" } function apollo_env_setup() { check_apollo_version check_architecture_support check_platform_support check_minimal_memory_requirement setup_gpu_support determine_esdcan_use APOLLO_ENV="STAGE=${STAGE}" APOLLO_ENV="${APOLLO_ENV} USE_ESD_CAN=${USE_ESD_CAN}" # Add more here ... info "${BLUE}Apollo Environment Settings:${NO_COLOR}" info "${TAB}APOLLO_ROOT_DIR: ${GREEN}${APOLLO_ROOT_DIR}${NO_COLOR}" info "${TAB}APOLLO_CACHE_DIR: ${GREEN}${APOLLO_CACHE_DIR}${NO_COLOR}" info "${TAB}APOLLO_IN_DOCKER: ${GREEN}${APOLLO_IN_DOCKER}${NO_COLOR}" info "${TAB}APOLLO_VERSION: ${GREEN}${APOLLO_VERSION}${NO_COLOR}" if "${APOLLO_IN_DOCKER}"; then info "${TAB}DOCKER_IMG: ${GREEN}${DOCKER_IMG##*:}${NO_COLOR}" fi info "${TAB}APOLLO_ENV: ${GREEN}${APOLLO_ENV}${NO_COLOR}" info "${TAB}USE_GPU_HOST: ${GREEN}${USE_GPU_HOST}${NO_COLOR}" info "${TAB}USE_GPU_TARGET: ${GREEN}${USE_GPU_TARGET}${NO_COLOR}" info "${TAB}GPU_PLATFORM: ${GREEN}${GPU_PLATFORM}${NO_COLOR}" if [[ -z "${APOLLO_BAZEL_DIST_DIR}" ]]; then source "${TOP_DIR}/cyber/setup.bash" fi if [[ ! -d "${APOLLO_BAZEL_DIST_DIR}" ]]; then mkdir -p "${APOLLO_BAZEL_DIST_DIR}" fi env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_config.sh" --noninteractive } #TODO(all): Update node modules function build_dreamview_frontend() { pushd "${APOLLO_ROOT_DIR}/modules/dreamview/frontend" >/dev/null yarn build popd >/dev/null } function build_test_and_lint() { env ${APOLLO_ENV} bash "${build_sh}" env ${APOLLO_ENV} bash "${test_sh}" --config=unit_test env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_lint.sh" --cpp success "Build and Test and Lint finished." } function _usage() { echo -e "\n${RED}Usage${NO_COLOR}: .${BOLD}/apollo.sh${NO_COLOR} [OPTION]" echo -e "\n${RED}Options${NO_COLOR}: ${BLUE}config [options]${NO_COLOR}: config bazel build environment either non-interactively (default) or interactively. ${BLUE}build [module]${NO_COLOR}: run build for cyber (<module> = cyber) or modules/<module>. If <module> unspecified, build all. ${BLUE}build_dbg [module]${NO_COLOR}: run debug build. ${BLUE}build_opt [module]${NO_COLOR}: run optimized build. ${BLUE}build_cpu [module]${NO_COLOR}: build in CPU mode. Equivalent to 'bazel build --config=cpu' ${BLUE}build_gpu [module]${NO_COLOR}: run build in GPU mode. Equivalent to 'bazel build --config=gpu' ${BLUE}build_nvidia [module]${NO_COLOR}: run build in GPU mode for NVIDIA GPU target. Equivalent to 'bazel build --config=gpu --config=nvidia' ${BLUE}build_amd [module]${NO_COLOR}: run build in GPU mode for AMD GPU target. Equivalent to 'bazel build --config=gpu --config=amd' ${BLUE}build_opt_gpu [module]${NO_COLOR}: optimized build in GPU mode. Equivalent to 'bazel build --config=opt --config=gpu' ${BLUE}build_opt_nvidia [module]${NO_COLOR}: optimized build in GPU mode for NVIDIA GPU target. Equivalent to 'bazel build --config=opt --config=gpu --config=nvidia' ${BLUE}build_opt_amd [module]${NO_COLOR}: optimized build in GPU mode for AMD GPU target. Equivalent to 'bazel build --config=opt --config=gpu --config=amd' ${BLUE}test [module]${NO_COLOR}: run unittest for cyber (module='cyber') or modules/<module>. If unspecified, test all. ${BLUE}coverage [module]${NO_COLOR}: run coverage test for cyber (module='cyber') or modules/<module>. If unspecified, coverage all. ${BLUE}lint${NO_COLOR}: run code style check ${BLUE}buildify${NO_COLOR}: run 'buildifier' to fix style of bazel files. ${BLUE}check${NO_COLOR}: run build, test and lint on all modules. Recommmened before checking in new code. ${BLUE}build_fe${NO_COLOR}: compile frontend JS code for Dreamview. Requires all node_modules pre-installed. ${BLUE}build_teleop${NO_COLOR}: run build with teleop enabled. ${BLUE}build_prof [module]${NO_COLOR}: build with perf profiling support. Not implemented yet. ${BLUE}doc${NO_COLOR}: generate doxygen document ${BLUE}release${NO_COLOR}: build Apollo binary releases ${BLUE}clean${NO_COLOR}: cleanup bazel output and log/coredump files ${BLUE}format${NO_COLOR}: format C++/Python/Bazel/Shell files ${BLUE}usage${NO_COLOR}: show this message and exit " } function _check_command() { local name="${BASH_SOURCE[0]}" local commands="$(echo ${AVAILABLE_COMMANDS} | xargs)" local help_msg="Run './apollo.sh --help' for usage." local cmd="$@" python scripts/command_checker.py --name "${name}" --command "${cmd}" --available "${commands}" --helpmsg "${help_msg}" } function check_config_cpu() { if [[ $* == *--config?cpu* ]] ; then export USE_GPU_TARGET="0" fi } function main() { if [ "$#" -eq 0 ]; then _usage exit 0 fi check_config_cpu "$@" apollo_env_setup local build_sh="${APOLLO_ROOT_DIR}/scripts/apollo_build.sh" local test_sh="${APOLLO_ROOT_DIR}/scripts/apollo_test.sh" local coverage_sh="${APOLLO_ROOT_DIR}/scripts/apollo_coverage.sh" local ci_sh="${APOLLO_ROOT_DIR}/scripts/apollo_ci.sh" local cmd="$1" shift case "${cmd}" in config) env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_config.sh" "$@" ;; build) env ${APOLLO_ENV} bash "${build_sh}" "$@" ;; build_opt) env ${APOLLO_ENV} bash "${build_sh}" --config=opt "$@" ;; build_dbg) env ${APOLLO_ENV} bash "${build_sh}" --config=dbg "$@" ;; build_cpu) env ${APOLLO_ENV} bash "${build_sh}" --config=cpu "$@" ;; build_gpu) env ${APOLLO_ENV} bash "${build_sh}" --config=gpu "$@" ;; build_nvidia) env ${APOLLO_ENV} bash "${build_sh}" --config=gpu --config=nvidia "$@" ;; build_amd) env ${APOLLO_ENV} bash "${build_sh}" --config=gpu --config=amd "$@" ;; build_opt_gpu) env ${APOLLO_ENV} bash "${build_sh}" --config=opt --config=gpu "$@" ;; build_opt_nvidia) env ${APOLLO_ENV} bash "${build_sh}" --config=opt --config=gpu --config=nvidia "$@" ;; build_opt_amd) env ${APOLLO_ENV} bash "${build_sh}" --config=opt --config=gpu --config=amd "$@" ;; build_prof) env ${APOLLO_ENV} bash "${build_sh}" --config=prof "$@" ;; build_teleop) env ${APOLLO_ENV} bash "${build_sh}" --config=teleop "$@" ;; build_fe) build_dreamview_frontend ;; test) env ${APOLLO_ENV} bash "${test_sh}" --config=unit_test "$@" ;; coverage) env ${APOLLO_ENV} bash "${coverage_sh}" "$@" ;; cibuild) env ${APOLLO_ENV} bash "${ci_sh}" "build" ;; citest) env ${APOLLO_ENV} bash "${ci_sh}" "test" ;; cilint) env ${APOLLO_ENV} bash "${ci_sh}" "lint" ;; check) build_test_and_lint ;; buildify) env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_buildify.sh" ;; lint) env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_lint.sh" "$@" ;; clean) env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_clean.sh" "$@" ;; release) env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_release.sh" "$@" ;; doc) env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_docs.sh" "$@" ;; format) env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_format.sh" "$@" ;; usage) _usage ;; -h|--help) _usage ;; *) _check_command "${cmd}" ;; esac } main "$@"
0
apollo_public_repos
apollo_public_repos/apollo/.clang-format
--- BasedOnStyle: Google --- Language: Cpp Cpp11BracedListStyle: true Standard: Cpp11 CommentPragmas: '^ NOLINT' # Mimic cpplint style IncludeCategories: # Note that the "main" header is priority 0 # The priority is assigned to first match in the ordered list # Miscelaneous system libraries - Regex: '<(immintrin.h|malloc.h|wait.h|x86intrin.h|cuda.*)>' Priority: 3 # C standard libraries - Regex: '<(arpa/|netinet/|net/if|sys/)?[^\./]*\.h>' Priority: 1 # C++ standard libraries - Regex: '<[^/\./]*>' Priority: 2 # Experimental or other system libraries - Regex: '<' Priority: 3 # Test libs - Regex: '"(gtest|gmock)/' Priority: 4 # Protobuf Files - Regex: '\.pb\.h' Priority: 6 # Apollo libs - Regex: '^"(cyber|modules)' Priority: 7 # The rest - Regex: '.*' Priority: 5 ---
0
apollo_public_repos
apollo_public_repos/apollo/tox.ini
# Flake8 Configuration [flake8] # Ignore some flake8-docstrings errors # NOTE(sigmavirus24): While we're still using flake8 2.x, this ignore line # defaults to selecting all other errors so we do not need select=E,F,W,I,D # Once Flake8 3.0 is released and in a good state, we can use both and it will # work well \o/ ignore = D203, W503, E203 exclude = .tox, .git, __pycache__, docs/source/conf.py, build, dist, tests/fixtures/*, *.pyc, *.egg-info, .cache, .eggs max-complexity = 10 import-order-style = google application-import-names = flake8
0
apollo_public_repos
apollo_public_repos/apollo/BUILD
load("//tools/install:install.bzl", "install", "install_src_files") load("//third_party/gpus:common.bzl", "if_gpu") package( default_visibility = ["//visibility:public"], ) exports_files([ "CPPLINT.cfg", "tox.ini", ]) install( name = "install", deps = if_gpu([ "//modules/perception:install", "//modules/planning:install", "//modules/v2x:install", "//third_party/centerpoint_infer_op:install", "//third_party/paddleinference:install", "//third_party/caddn_infer_op:install", ], [ "//cyber:install", "//tools:install", "//modules/data:install", #"//cyber/examples:install", #"//docker/scripts:install", #"//docs:install", "//modules/audio:install", "//modules/bridge:install", "//modules/calibration:install", "//modules/canbus:install", "//modules/canbus_vehicle:install", "//modules/common:install", "//modules/common_msgs:install", "//modules/contrib/cyber_bridge:install", "//modules/control:install", "//modules/planning:install", "//modules/dreamview:install", "//modules/drivers:install", "//modules/guardian:install", "//modules/localization:install", "//modules/map:install", "//modules/monitor:install", "//modules/prediction:install", "//modules/routing:install", "//modules/storytelling:install", "//modules/task_manager:install", "//modules/third_party_perception:install", "//modules/tools:install", "//modules/transform:install", "//scripts:install", "//third_party/absl:install", "//third_party/ad_rss_lib:install", "//third_party/boost:install", "//third_party/civetweb:install", "//third_party/eigen3:install", "//third_party/gtest:install", "//third_party/ipopt:install", "//third_party/libtorch:install", "//third_party/fastrtps:install", "//third_party/gflags:install", "//third_party/glog:install", "//third_party/nlohmann_json:install", "//third_party/opencv:install", "//third_party/osqp:install", "//third_party/pcl:install", "//third_party/vtk:install", "//third_party/proj:install", "//third_party/protobuf:install", "//third_party/py:install", "//third_party/opengl:install", "//third_party/openh264:install", "//third_party/cpplint:install", "//third_party/centerpoint_infer_op:install", "//third_party/portaudio:install", "//third_party/fftw3:install", "//third_party/glew:install", "//third_party/adolc:install", "//third_party/atlas:install", "//third_party/benchmark:install", "//third_party/ncurses5:install", "//third_party/sqlite3:install", "//third_party/tensorrt:install", "//third_party/tinyxml2:install", "//third_party/uuid:install", "//third_party/yaml_cpp:install", "//third_party/qt5:install", "//third_party/npp:install", "//third_party/gpus:install", "//third_party/tf2:install", "//third_party/localization_msf:install", "//third_party/can_card_library:install", "//third_party/camera_library:install", "//third_party/rtklib:install", "//third_party/ffmpeg:install", "//third_party/adv_plat:install", ]), ) install_src_files( name = "install_src", deps = if_gpu([ "//modules/perception:install_src", "//modules/planning:install_src", "//modules/v2x:install_src", "//third_party/centerpoint_infer_op:install_src", "//third_party/paddleinference:install_src", "//third_party/caddn_infer_op:install_src", ], [ "//cyber:install_src", "//tools:install_src", "//modules/common:install_src", "//modules/data:install_src", "//modules/common_msgs:install_src", "//modules/control:install_src", "//modules/dreamview:install_src", "//modules/map:install_src", "//modules/monitor:install_src", "//modules/planning:install_src", "//modules/routing:install_src", "//modules/task_manager:install_src", "//modules/transform:install_src", "//modules/audio:install_src", "//modules/bridge:install_src", "//modules/calibration:install_src", "//modules/canbus:install_src", "//modules/canbus_vehicle:install_src", "//modules/contrib/cyber_bridge:install_src", "//modules/drivers:install_src", "//modules/guardian:install_src", "//modules/localization:install_src", "//modules/prediction:install_src", "//modules/storytelling:install_src", "//modules/third_party_perception:install_src", "//modules/tools:install_src", "//third_party/absl:install_src", "//third_party/boost:install_src", "//third_party/civetweb:install_src", "//third_party/eigen3:install_src", "//third_party/gtest:install_src", "//third_party/centerpoint_infer_op:install_src", "//third_party/ipopt:install_src", "//third_party/libtorch:install_src", "//third_party/fastrtps:install_src", "//third_party/gflags:install_src", "//third_party/glog:install_src", "//third_party/nlohmann_json:install_src", "//third_party/opencv:install_src", "//third_party/osqp:install_src", "//third_party/pcl:install_src", "//third_party/vtk:install_src", "//third_party/proj:install_src", "//third_party/protobuf:install_src", "//third_party/py:install_src", "//third_party/opengl:install_src", "//third_party/openh264:install_src", "//third_party/cpplint:install_src", "//third_party/portaudio:install_src", "//third_party/fftw3:install_src", "//third_party/glew:install_src", "//third_party/adolc:install_src", "//third_party/atlas:install_src", "//third_party/benchmark:install_src", "//third_party/ncurses5:install_src", "//third_party/sqlite3:install_src", "//third_party/tensorrt:install_src", "//third_party/tinyxml2:install_src", "//third_party/uuid:install_src", "//third_party/yaml_cpp:install_src", "//third_party/qt5:install_src", "//third_party/npp:install_src", "//third_party/gpus:install_src", "//third_party/tf2:install_src", "//third_party/localization_msf:install_src", "//third_party/can_card_library:install_src", "//third_party/camera_library:install_src", "//third_party/rtklib:install_src", "//third_party/ffmpeg:install_src", "//third_party/adv_plat:install_src", ]), )
0
apollo_public_repos
apollo_public_repos/apollo/CPPLINT.cfg
# Stop searching for additional config files. set noparent # Disable a warning about C++ features that were not in the original # C++11 specification (and so might not be well-supported). filter=-build/c++11 filter=-build/include_alpha,+build/include_order filter=+build/include_what_you_use # Disable header_guard warning # Consider using #pragma once instead filter=-build/header_guard filter=+runtime/printf,+runtime/printf_format linelength=80 includeorder=standardcfirst
0
apollo_public_repos
apollo_public_repos/apollo/.bazelrc
# load bazelrc from the legacy location # as recommended in https://github.com/bazelbuild/bazel/issues/6319 try-import %workspace%/tools/bazel.rc try-import %workspace%/.apollo.bazelrc
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/init.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/init.h" #include <libgen.h> #include <sys/types.h> #include <unistd.h> #include <csignal> #include <cstdio> #include <ctime> #include <memory> #include <string> #include "cyber/proto/clock.pb.h" #include "cyber/binary.h" #include "cyber/common/file.h" #include "cyber/common/global_data.h" #include "cyber/data/data_dispatcher.h" #include "cyber/logger/async_logger.h" #include "cyber/node/node.h" #include "cyber/scheduler/scheduler.h" #include "cyber/service_discovery/topology_manager.h" #include "cyber/sysmo/sysmo.h" #include "cyber/task/task.h" #include "cyber/time/clock.h" #include "cyber/timer/timing_wheel.h" #include "cyber/transport/transport.h" namespace apollo { namespace cyber { using apollo::cyber::scheduler::Scheduler; using apollo::cyber::service_discovery::TopologyManager; namespace { const std::string& kClockChannel = "/clock"; const std::string& kClockNode = "clock"; bool g_atexit_registered = false; std::mutex g_mutex; std::unique_ptr<Node> clock_node; logger::AsyncLogger* async_logger = nullptr; void InitLogger(const char* binary_name) { const char* slash = strrchr(binary_name, '/'); if (slash) { ::apollo::cyber::binary::SetName(slash + 1); } else { ::apollo::cyber::binary::SetName(binary_name); } // Init glog google::InitGoogleLogging(binary_name); google::SetLogDestination(google::ERROR, ""); google::SetLogDestination(google::WARNING, ""); google::SetLogDestination(google::FATAL, ""); // Init async logger async_logger = new ::apollo::cyber::logger::AsyncLogger( google::base::GetLogger(FLAGS_minloglevel)); google::base::SetLogger(FLAGS_minloglevel, async_logger); async_logger->Start(); } void StopLogger() { delete async_logger; } } // namespace void OnShutdown(int sig) { (void)sig; if (GetState() != STATE_SHUTDOWN) { SetState(STATE_SHUTTING_DOWN); } } void ExitHandle() { Clear(); } bool Init(const char* binary_name) { std::lock_guard<std::mutex> lg(g_mutex); if (GetState() != STATE_UNINITIALIZED) { return false; } InitLogger(binary_name); auto thread = const_cast<std::thread*>(async_logger->LogThread()); scheduler::Instance()->SetInnerThreadAttr("async_log", thread); SysMo::Instance(); std::signal(SIGINT, OnShutdown); // Register exit handlers if (!g_atexit_registered) { if (std::atexit(ExitHandle) != 0) { AERROR << "Register exit handle failed"; return false; } AINFO << "Register exit handle succ."; g_atexit_registered = true; } SetState(STATE_INITIALIZED); auto global_data = GlobalData::Instance(); if (global_data->IsMockTimeMode()) { auto node_name = kClockNode + std::to_string(getpid()); clock_node = std::unique_ptr<Node>(new Node(node_name)); auto cb = [](const std::shared_ptr<const apollo::cyber::proto::Clock>& msg) { if (msg->has_clock()) { Clock::Instance()->SetNow(Time(msg->clock())); } }; clock_node->CreateReader<apollo::cyber::proto::Clock>(kClockChannel, cb); } return true; } void Clear() { std::lock_guard<std::mutex> lg(g_mutex); if (GetState() == STATE_SHUTDOWN || GetState() == STATE_UNINITIALIZED) { return; } SysMo::CleanUp(); TaskManager::CleanUp(); TimingWheel::CleanUp(); scheduler::CleanUp(); service_discovery::TopologyManager::CleanUp(); transport::Transport::CleanUp(); StopLogger(); SetState(STATE_SHUTDOWN); } } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/state.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/state.h" #include <atomic> namespace apollo { namespace cyber { namespace { std::atomic<State> g_cyber_state; } State GetState() { return g_cyber_state.load(); } void SetState(const State& state) { g_cyber_state.store(state); } } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/cyber.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_CYBER_H_ #define CYBER_CYBER_H_ #include <memory> #include <string> #include <utility> #include "cyber/common/log.h" #include "cyber/component/component.h" #include "cyber/init.h" #include "cyber/node/node.h" #include "cyber/task/task.h" #include "cyber/time/time.h" #include "cyber/timer/timer.h" namespace apollo { namespace cyber { std::unique_ptr<Node> CreateNode(const std::string& node_name, const std::string& name_space = ""); } // namespace cyber } // namespace apollo #endif // CYBER_CYBER_H_
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/cyber.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/cyber.h" #include <memory> #include <string> #include <utility> #include "cyber/proto/run_mode_conf.pb.h" #include "cyber/common/global_data.h" namespace apollo { namespace cyber { using apollo::cyber::common::GlobalData; using apollo::cyber::proto::RunMode; std::unique_ptr<Node> CreateNode(const std::string& node_name, const std::string& name_space) { bool is_reality_mode = GlobalData::Instance()->IsRealityMode(); if (is_reality_mode && !OK()) { // add some hint log AERROR << "please initialize cyber firstly."; return nullptr; } return std::unique_ptr<Node>(new Node(node_name, name_space)); } } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/cyberfile.xml
<package format="2"> <name>cyber</name> <version>local</version> <description> Apollo Cyber RT is an open source, high performance runtime framework designed specifically for autonomous driving scenarios. Based on a centralized computing model, it is greatly optimized for high concurrency, low latency, and high throughput in autonomous driving. </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</type> <src_path url="https://github.com/ApolloAuto/apollo">//cyber</src_path> <depend so_names="ncurses" repo_name="ncurses5">libncurses5-dev</depend> <depend so_names="uuid" repo_name="uuid">libuuid1</depend> <depend expose="False">3rd-rules-python-dev</depend> <depend expose="False">3rd-grpc-dev</depend> <depend expose="False">3rd-rules-proto-dev</depend> <depend expose="False">3rd-py-dev</depend> <depend expose="False">3rd-gpus-dev</depend> <depend expose="False">3rd-bazel-skylib-dev</depend> <depend repo_name="com_google_protobuf" lib_names="protobuf">3rd-protobuf-dev</depend> <depend repo_name="fastrtps">3rd-fastrtps-dev</depend> <depend repo_name="com_github_google_glog" lib_names="glog">3rd-glog-dev</depend> <depend repo_name="com_github_gflags_gflags" lib_names="gflags">3rd-gflags-dev</depend> <depend repo_name="common-msgs" lib_names="common-msgs">common-msgs-dev</depend> <depend expose="False">3rd-cpplint-dev</depend> <depend repo_name="com_google_googletest" lib_names="gtest,gtest_main">3rd-gtest-dev</depend> <depend repo_name="com_github_nlohmann_json" lib_names="single_json,json">3rd-nlohmann-json-dev</depend> <depend>bazel-extend-tools-dev</depend> </package>
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/README.md
# Introduction Apollo Cyber RT is an open source, high performance runtime framework designed specifically for autonomous driving scenarios. Based on a centralized computing model, it is greatly optimized for high concurrency, low latency, and high throughput in autonomous driving. During the last few years of the development of autonomous driving technologies, we have learned a lot from our previous experience with Apollo. The industry is evolving and so is Apollo. Going forward, Apollo has already moved from development to productization, with volume deployments in the real world, we see the demands for the highest level of robustness and performance. That’s why we spent years building and perfecting Apollo Cyber RT, which addresses that requirements of autonomous driving solutions. Key benefits of using Apollo Cyber RT: - Accelerate development + Well defined task interface with data fusion + Array of development tools + Large set of sensor drivers - Simplify deployment + Efficient and adaptive message communication + Configurable user level scheduler with resource awareness + Portable with fewer dependencies - Empower your own autonomous vehicles + The default open source runtime framework + Building blocks specifically designed for autonomous driving + Plug and play your own AD system # Documents * ***New!!*** [How to Develop Cyber RT inside Docker Environment on Both x86 and ARM Platform](https://github.com/ApolloAuto/apollo/tree/master/docs/cyber/CyberRT_Docker.md): Official docker image for Cyber RT development, which is easiest way to build and play with Cyber RT. On top of that, we officially support development of Cyber RT on both x86 and ARM platform. * [Apollo Cyber RT Quick Start](https://github.com/ApolloAuto/apollo/tree/master/docs/cyber/CyberRT_Quick_Start.md): Everything you need to know about how to start developing your first application module on top of Apollo Cyber RT. * [Apollo Cyber RT Developer Tools](https://github.com/ApolloAuto/apollo/tree/master/docs/cyber/CyberRT_Developer_Tools.md): Detailed guidance on how to use the developer tools from Apollo Cyber RT. * [Apollo Cyber RT API for Developers](https://github.com/ApolloAuto/apollo/tree/master/docs/cyber/CyberRT_API_for_Developers.md): A comprehensive guide to explore all the APIs of Apollo Cyber RT, with many concrete examples in source code. * [Apollo Cyber RT FAQs](https://github.com/ApolloAuto/apollo/tree/master/docs/cyber/CyberRT_FAQs.md): Answers to the most frequently asked questions about Apollo Cyber RT. * [Apollo Cyber RT Terms](https://github.com/ApolloAuto/apollo/tree/master/docs/cyber/CyberRT_Terms.md): Commonly used terminologies in Cyber RT documentation and code. * [Apollo Cyber RT Python Wrapper](python/README.md): Develop projects in Python. More documents to come soon!
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/.release.bash
#! /usr/bin/env bash TOP_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd -P)" source ${TOP_DIR}/scripts/apollo.bashrc export CYBER_PATH="${APOLLO_ROOT_DIR}/cyber" pathprepend "${TOP_DIR}/bin" export CYBER_DOMAIN_ID=80 export CYBER_IP=127.0.0.1 export GLOG_log_dir="${APOLLO_ROOT_DIR}/data/log" export GLOG_alsologtostderr=0 export GLOG_colorlogtostderr=1 export GLOG_minloglevel=0 export sysmo_start=0 # for DEBUG log #export GLOG_v=4
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/binary.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/binary.h" #include <mutex> #include <string> namespace { std::mutex m; std::string binary_name; // NOLINT } // namespace namespace apollo { namespace cyber { namespace binary { std::string GetName() { std::lock_guard<std::mutex> lock(m); return binary_name; } void SetName(const std::string& name) { std::lock_guard<std::mutex> lock(m); binary_name = name; } } // namespace binary } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/setup.bash
#! /usr/bin/env bash TOP_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd -P)" source ${TOP_DIR}/scripts/apollo.bashrc export APOLLO_BAZEL_DIST_DIR="${APOLLO_CACHE_DIR}/distdir" export CYBER_PATH="${APOLLO_ROOT_DIR}/cyber" bazel_bin_path="${APOLLO_ROOT_DIR}/bazel-bin" mainboard_path="${bazel_bin_path}/cyber/mainboard" cyber_tool_path="${bazel_bin_path}/cyber/tools" recorder_path="${cyber_tool_path}/cyber_recorder" launch_path="${cyber_tool_path}/cyber_launch" channel_path="${cyber_tool_path}/cyber_channel" node_path="${cyber_tool_path}/cyber_node" service_path="${cyber_tool_path}/cyber_service" monitor_path="${cyber_tool_path}/cyber_monitor" visualizer_path="${bazel_bin_path}/modules/tools/visualizer" # TODO(all): place all these in one place and pathprepend for entry in "${mainboard_path}" \ "${recorder_path}" "${monitor_path}" \ "${channel_path}" "${node_path}" \ "${service_path}" \ "${launch_path}" \ "${visualizer_path}" ; do pathprepend "${entry}" done pathprepend ${bazel_bin_path}/cyber/python/internal PYTHONPATH export CYBER_DOMAIN_ID=80 export CYBER_IP=127.0.0.1 export GLOG_log_dir="${APOLLO_ROOT_DIR}/data/log" export GLOG_alsologtostderr=0 export GLOG_colorlogtostderr=1 export GLOG_minloglevel=0 export sysmo_start=0 # for DEBUG log #export GLOG_v=4 source ${CYBER_PATH}/tools/cyber_tools_auto_complete.bash
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/cyber.BUILD
load("@rules_cc//cc:defs.bzl", "cc_library") cc_library( name = "cyber", includes = ["include"], hdrs = glob(["include/**/*"]), srcs = glob(["lib/**/lib*.so*"]), include_prefix = "cyber", strip_include_prefix = "include", visibility = ["//visibility:public"], )
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/BUILD
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_binary") load("//tools/install:install.bzl", "install", "install_files", "install_src_files") load("//tools:cpplint.bzl", "cpplint") package(default_visibility = ["//visibility:public"]) cc_library( name = "cyber", linkstatic = False, deps = [ ":cyber_core", ], ) install( name = "install", data = [ ":.release.bash", ":cyber_conf", #"//cyber/python/cyber_py3:runtime_files", "//cyber/proto:runtime_files", ":cyberfile.xml", "cyber.BUILD" ], data_dest = "cyber", targets = [ ":libcyber_core.so", ], library_dest = "cyber/lib", rename = { "cyber/.release.bash": "setup.bash", #"cyber/python/cyber_py3/cyber_py3.BUILD": "BUILD", "cyber/proto/py_pb2.BUILD": "BUILD", }, deps = [ "//cyber/python/cyber_py3:cyber_python_library", "//cyber/proto:pb_cyber", "//cyber/proto:cyber_proto_hdrs", "//cyber/proto:cyber_proto_so", "//cyber/mainboard:install", "//cyber/python/internal:install", "//cyber/tools:install", ], ) install_src_files( name = "install_src", deps = [ ":install_cyber_src", ":install_cyber_hdrs" ], ) install_src_files( name = "install_cyber_src", src_dir = ["."], dest = "cyber/src", filter = "*", ) install_src_files( name = "install_cyber_hdrs", src_dir = ["."], dest = "cyber/include", filter = "*.h", ) cc_library( name = "binary", srcs = ["binary.cc"], hdrs = ["binary.h"], ) cc_library( name = "state", srcs = ["state.cc"], hdrs = ["state.h"], deps = [ "//cyber/common", ], ) cc_library( name = "init", srcs = ["init.cc"], hdrs = ["init.h"], alwayslink = True, deps = [ "//cyber:binary", "//cyber:state", "//cyber/common:file", "//cyber/logger:async_logger", "//cyber/node", "//cyber/proto:clock_cc_proto", "//cyber/sysmo", "//cyber/time:clock", "//cyber/timer:timing_wheel", ], ) cc_binary( name = "libcyber_core.so", srcs = glob([ "cyber.cc", "cyber.h", ]), linkshared = True, linkstatic = True, linkopts = ["-lrt"], deps = [ "//cyber:binary", "//cyber:init", "//cyber:state", "//cyber/base", "//cyber/blocker:blocker_manager", "//cyber/class_loader", "//cyber/class_loader:class_loader_manager", "//cyber/common", "//cyber/component", "//cyber/component:timer_component", "//cyber/croutine", "//cyber/data", "//cyber/event:perf_event_cache", "//cyber/io", "//cyber/logger", "//cyber/logger:async_logger", "//cyber/message:message_traits", "//cyber/message:protobuf_traits", "//cyber/message:py_message_traits", "//cyber/message:raw_message_traits", "//cyber/node", "//cyber/parameter:parameter_client", "//cyber/parameter:parameter_server", "//cyber/proto:run_mode_conf_cc_proto", "//cyber/record", "//cyber/scheduler", "//cyber/scheduler:scheduler_factory", "//cyber/service", "//cyber/service:client", "//cyber/service_discovery:topology_manager", "//cyber/sysmo", "//cyber/task", "//cyber/time", "//cyber/time:clock", "//cyber/time:duration", "//cyber/time:rate", "//cyber/timer", "//cyber/transport", "//cyber/transport/rtps:participant", "//cyber/transport/rtps:sub_listener", "@com_github_google_glog//:glog", "@com_google_protobuf//:protobuf", "@fastrtps", ], visibility = ["//visibility:public"], ) cc_library( name = "cyber_core", srcs = ["libcyber_core.so"], hdrs = ["cyber.h"], linkopts = ["-lrt"], visibility = ["//visibility:public"], deps = [ "@com_github_google_glog//:glog", "@com_google_protobuf//:protobuf", "@fastrtps", "@com_github_gflags_gflags//:gflags", "//cyber/proto:run_mode_conf_cc_proto", "//cyber/proto:cyber_conf_cc_proto", "//cyber/proto:scheduler_conf_cc_proto", "//cyber/proto:classic_conf_cc_proto", "//cyber/proto:choreography_conf_cc_proto", "//cyber/proto:transport_conf_cc_proto", "//cyber/proto:perf_conf_cc_proto", "//cyber/proto:topology_change_cc_proto", "//cyber/proto:role_attributes_cc_proto", "//cyber/proto:proto_desc_cc_proto", "//cyber/proto:component_conf_cc_proto", "//cyber/proto:record_cc_proto", "//cyber/proto:parameter_cc_proto", "//cyber/proto:clock_cc_proto", "//cyber/proto:qos_profile_cc_proto", "//cyber:binary", "//cyber:init", "//cyber:state", "//cyber/base", "//cyber/blocker:blocker_manager", "//cyber/class_loader", "//cyber/class_loader:class_loader_manager", "//cyber/common", "//cyber/component", "//cyber/component:timer_component", "//cyber/croutine", "//cyber/data", "//cyber/event:perf_event_cache", "//cyber/io", "//cyber/logger", "//cyber/logger:async_logger", "//cyber/message:message_traits", "//cyber/message:protobuf_traits", "//cyber/message:py_message_traits", "//cyber/message:raw_message_traits", "//cyber/node", "//cyber/parameter:parameter_client", "//cyber/parameter:parameter_server", "//cyber/record", "//cyber/scheduler", "//cyber/scheduler:scheduler_factory", "//cyber/service", "//cyber/service:client", "//cyber/service_discovery:topology_manager", "//cyber/sysmo", "//cyber/task", "//cyber/time", "//cyber/time:clock", "//cyber/time:duration", "//cyber/time:rate", "//cyber/timer", "//cyber/transport", "//cyber/transport/rtps:participant", "//cyber/transport/rtps:sub_listener", ], includes = ["."], ) filegroup( name = "cyber_conf", srcs = glob([ "conf/*.conf", ]), ) cpplint()
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/init.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_INIT_H_ #define CYBER_INIT_H_ #include "cyber/common/log.h" #include "cyber/state.h" namespace apollo { namespace cyber { bool Init(const char* binary_name); void Clear(); } // namespace cyber } // namespace apollo #endif // CYBER_INIT_H_
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/state.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_STATE_H_ #define CYBER_STATE_H_ #include <sys/types.h> #include <unistd.h> #include <cerrno> #include <csignal> #include <cstdint> #include <cstring> #include <thread> #include "cyber/common/log.h" namespace apollo { namespace cyber { enum State : std::uint8_t { STATE_UNINITIALIZED = 0, STATE_INITIALIZED, STATE_SHUTTING_DOWN, STATE_SHUTDOWN, }; State GetState(); void SetState(const State& state); inline bool OK() { return GetState() == STATE_INITIALIZED; } inline bool IsShutdown() { return GetState() == STATE_SHUTTING_DOWN || GetState() == STATE_SHUTDOWN; } inline void WaitForShutdown() { while (!IsShutdown()) { std::this_thread::sleep_for(std::chrono::milliseconds(200)); } } inline void AsyncShutdown() { pid_t pid = getpid(); if (kill(pid, SIGINT) != 0) { AERROR << strerror(errno); } } } // namespace cyber } // namespace apollo #endif // CYBER_STATE_H_
0
apollo_public_repos/apollo
apollo_public_repos/apollo/cyber/binary.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_BINARY_H_ #define CYBER_BINARY_H_ #include <string> namespace apollo { namespace cyber { namespace binary { std::string GetName(); void SetName(const std::string& name); } // namespace binary } // namespace cyber } // namespace apollo #endif // CYBER_BINARY_H_
0
apollo_public_repos/apollo/cyber
apollo_public_repos/apollo/cyber/tools/cyber_tools_auto_complete.bash
# usage: source cyber_tools_auto_complete.bash function _cyber_launch_complete() { COMPREPLY=() local word=${COMP_WORDS[COMP_CWORD]} local cmd=${COMP_WORDS[COMP_CWORD-1]} case $cmd in 'cyber_launch') COMPREPLY=( $(compgen -W "start stop" -- ${word}) ) ;; 'start') compopt -o nospace local files=`ls *.launch 2>/dev/null` COMPREPLY=( $(compgen -W "$files" -- ${word}) ) ;; 'stop') compopt -o nospace local files=`ls *.launch 2>/dev/null` COMPREPLY=( $(compgen -W "$files" -- ${word}) ) ;; *) ;; esac } function _cyber_recorder_complete() { COMPREPLY=() local word=${COMP_WORDS[COMP_CWORD]} local cmd=${COMP_WORDS[COMP_CWORD-1]} case $cmd in 'cyber_recorder') COMPREPLY=( $(compgen -W "play info record split recover" -- ${word}) ) ;; *) ;; esac } function _cyber_channel_complete() { COMPREPLY=() local word=${COMP_WORDS[COMP_CWORD]} local cmd=${COMP_WORDS[COMP_CWORD-1]} case $cmd in 'cyber_channel') COMPREPLY=( $(compgen -W "echo list info hz bw type" -- ${word}) ) ;; *) ;; esac } function _cyber_node_complete() { COMPREPLY=() local word=${COMP_WORDS[COMP_CWORD]} local cmd=${COMP_WORDS[COMP_CWORD-1]} case $cmd in 'cyber_node') COMPREPLY=( $(compgen -W "list info" -- ${word}) ) ;; *) ;; esac } function _cyber_service_complete() { COMPREPLY=() local word=${COMP_WORDS[COMP_CWORD]} local cmd=${COMP_WORDS[COMP_CWORD-1]} case $cmd in 'cyber_service') COMPREPLY=( $(compgen -W "list info" -- ${word}) ) ;; *) ;; esac } complete -F _cyber_launch_complete -o default cyber_launch complete -F _cyber_recorder_complete -o default cyber_recorder complete -F _cyber_channel_complete -o default cyber_channel complete -F _cyber_node_complete -o default cyber_node complete -F _cyber_service_complete -o default cyber_service
0
apollo_public_repos/apollo/cyber
apollo_public_repos/apollo/cyber/tools/BUILD
load("//tools/install:install.bzl", "install") package( default_visibility = ["//visibility:public"], ) install( name = "install", deps = [ "//cyber/tools/cyber_launch:install", "//cyber/tools/cyber_monitor:install", "//cyber/tools/cyber_recorder:install", "//cyber/tools/cyber_channel:install", "//cyber/tools/cyber_node:install", "//cyber/tools/cyber_service:install", ], )
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_service/cyber_service.py
#!/usr/bin/env python3 # **************************************************************************** # 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. # **************************************************************************** import os import sys from cyber.python.cyber_py3 import cyber def print_service_info(service_name, sleep_s=2): roleattr_rawdata = cyber.ServiceUtils.get_service_attr(service_name, sleep_s) from cyber.proto.role_attributes_pb2 import RoleAttributes try: msg = RoleAttributes() msg.ParseFromString(roleattr_rawdata) assert(service_name == msg.service_name) except: print("RoleAttributes ParseFromString failed. size is ", len(roleattr_rawdata), ", service name: ", service_name) return print(msg.service_name) print("\tprocessid\t", msg.process_id) print("\tnodename\t", msg.node_name) print("\thostname\t", msg.host_name) print("") def _service_cmd_info(argv): """ Command-line parsing for 'cyber_service info' command. """ args = argv[2:] from optparse import OptionParser parser = OptionParser( usage="usage: cyber_service info servicename ") parser.add_option("-a", "--all", dest="all_services", default=False, action="store_true", help="display all services info") (options, args) = parser.parse_args(args) if len(args) == 0 and not options.all_services: parser.error("servicename must be specified") elif len(args) > 1: parser.error("you may only specify one service name") elif len(args) == 1: print_service_info(args[0]) elif len(args) == 0 and options.all_services: services = cyber.ServiceUtils.get_services() for servicename in services: print_service_info(servicename, 0) def print_service_list(): services = sorted(cyber.ServiceUtils.get_services()) print("The number of services is: ", len(services)) for service_name in services: print(service_name) def _service_cmd_list(argv): """ Command-line parsing for 'cyber_service list' command. """ args = argv[2:] from optparse import OptionParser parser = OptionParser( usage="usage: cyber_service list") (options, args) = parser.parse_args(args) if len(args) > 0: parser.error("param is too much") print_service_list() def _printallusage(): print("""cyber_service is a command-line tool for printing information about CyberRT Services. Commands: \tcyber_service list\tlist active services \tcyber_service info\tprint information about active service Type cyber_service <command> -h for more detailed usage, e.g. 'cyber_service info -h' """) sys.exit(getattr(os, 'EX_USAGE', 1)) if __name__ == '__main__': if len(sys.argv) == 1: _printallusage() cyber.init() argv = sys.argv[0:] command = argv[1] if command == 'list': _service_cmd_list(argv) elif command == 'info': _service_cmd_info(argv) else: _printallusage() cyber.shutdown()
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_service/BUILD
load("@rules_python//python:defs.bzl", "py_binary") load("//tools/install:install.bzl", "install") package( default_visibility = ["//visibility:public"], ) py_binary( name = "cyber_service", srcs = ["cyber_service.py"], deps = [ "//cyber/python/cyber_py3:cyber", ], ) install( name = "install", py_dest = "cyber/bin", targets = [":cyber_service"] )
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_launch/cyber_launch.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. # **************************************************************************** import argparse import atexit import logging import os import os.path import signal import subprocess import sys import time import threading import traceback import xml.etree.ElementTree as ET g_binary_name = 'mainboard' g_pwd = os.getcwd() g_script_name = os.path.basename(sys.argv[0]).split(".")[0] g_process_pid = os.getpid() g_process_name = g_script_name + "_" + str(g_process_pid) cyber_path = os.getenv('CYBER_PATH') """ colorful logging """ BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = list(range(8)) RESET_SEQ = "\033[0m" COLOR_SEQ = "\033[1;%dm" BOLD_SEQ = "\033[1m" COLORS = { 'INFO': GREEN, 'WARNING': YELLOW, 'DEBUG': BLUE, 'ERROR': RED, 'CRITICAL': YELLOW } class ColoredFormatter(logging.Formatter): def __init__(self, msg): logging.Formatter.__init__(self, msg) def format(self, record): levelname = record.levelname if levelname in COLORS: if levelname == 'DEBUG': record.levelname = COLOR_SEQ % (30 + COLORS[levelname]) + \ record.msg.split('#')[0] + RESET_SEQ record.msg = COLOR_SEQ % (30 + COLORS[levelname]) + \ record.msg.split('#')[-1] + RESET_SEQ else: record.levelname = COLOR_SEQ % (30 + COLORS[levelname]) + \ g_process_name + RESET_SEQ record.msg = COLOR_SEQ % (30 + COLORS[levelname]) + levelname + \ " " + record.msg.split('#')[-1] + RESET_SEQ return logging.Formatter.format(self, record) color_formatter = ColoredFormatter("[%(levelname)-18s] %(message)s") console = logging.StreamHandler() console.setFormatter(color_formatter) logger = logging.Logger(__name__) logger.addHandler(console) def exit_handler(): stop() os.chdir(g_pwd) logger.info('cyber_launch exit.') atexit.register(exit_handler) def singleton(cls): instances = {} def getinstance(*args, **kwargs): if cls not in instances: instances[cls] = cls(*args, **kwargs) return instances[cls] return getinstance def module_monitor(mod): while True: line = mod.popen.stdout.readline() if line: logger.debug('%s# %s' % (mod.name, line.decode('utf8').strip('\n'))) continue time.sleep(0.01) class ProcessWrapper(object): def __init__(self, binary_path, dag_num, dag_list, process_name, process_type, sched_name, exception_handler=''): self.time_of_death = None self.started = False self.binary_path = binary_path self.dag_num = dag_num self.dag_list = dag_list self.name = process_name self.sched_name = sched_name self.process_type = process_type self.popen = None self.exit_code = None self.args = [] self.pid = -1 self.exception_handler = exception_handler def wait(self): if self.started: self.popen.wait() def start(self): """ Start a manager in process name """ if self.process_type == 'binary': args_list = self.name.split() else: args_list = [self.binary_path] for i in self.dag_list: args_list.append('-d') args_list.append(i) if len(self.name) != 0: args_list.append('-p') args_list.append(self.name) if len(self.sched_name) != 0: args_list.append('-s') args_list.append(self.sched_name) self.args = args_list try: self.popen = subprocess.Popen(args_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) except Exception as err: logger.error('Subprocess Popen exception: ' + str(err)) return 2 else: if self.popen.pid == 0 or self.popen.returncode is not None: logger.error('Start process [%s] failed.' % self.name) return 2 th = threading.Thread(target=module_monitor, args=(self, )) th.setDaemon(True) th.start() self.started = True self.pid = self.popen.pid logger.info('Start process [%s] successfully. pid: %d' % (self.name, self.popen.pid)) logger.info('-' * 120) return 0 def is_alive(self): """ Check the process if is still running @return: True if process is still running @rtype: bool """ if not self.started: return False if self.popen is None: if self.time_of_death is None: self.time_of_death = time.time() return False self.exit_code = self.popen.poll() if self.exit_code is not None: if self.time_of_death is None: self.time_of_death = time.time() return False return True def get_exit_state(self): """ @return: description of exit state @rtype: str """ if self.popen.returncode is None: pass elif self.popen.returncode != 0: output = 'Process [%s] has died [pid %s, exit code %s, cmd %s].' % \ (self.name, self.pid, self.exit_code, ' '.join(self.args)) logger.error(output) else: output = 'Process [%s] has finished. [pid %s, cmd %s].' % \ (self.name, self.pid, ' '.join(self.args)) logger.error(output) @singleton class ProcessMonitor(object): def __init__(self): self.procs = [] self.dead_cnt = 0 self.done = False self.is_shutdown = False def register(self, p): """ Register process with L{ProcessMonitor} @param p: Process @type p: L{Process} """ if self.has_process(p.name): logger.error( 'Cannot add process due to duplicate name "%s".' % p.name) elif self.is_shutdown: logger.error( 'Cannot add process [%s] due to monitor has been stopped.' % p.name) else: self.procs.append(p) def has_process(self, name): """ @return: True if process is still be monitored. If False, process has died or was never registered with process @rtype: bool """ return len([p for p in self.procs if p.name == name]) > 0 def check_cleanup(self): """ Check processes are alived, cleanup processes """ dead_cnt = 0 for pw in self.procs: if self.is_shutdown: break if pw.process_type == 'binary': continue try: if not pw.is_alive(): if pw.exception_handler == "respawn": logger.warning( 'child process [%s][%d] exit, respawn!' % (pw.name, pw.pid)) result = pw.start() if result != 0: logger.error( 'respawn process [%s] failed, stop all!' % (pw.name)) stop() elif pw.exception_handler == "exit": logger.warning( 'child process [%s][%d] exit, stop all' % (pw.name, pw.pid)) stop() dead_cnt += 1 except Exception: dead_cnt += 1 traceback.print_exc() if dead_cnt > 0: self.dead_cnt = dead_cnt if self.dead_cnt == len(self.procs): self.is_shutdown = True def run(self): """ Run processes monitor, until all processes are died. """ while not self.is_shutdown: self.check_cleanup() time.sleep(0.2) for p in self.procs: p.get_exit_state() if self.dead_cnt == len(self.procs): logger.info("All processes has died.") return True return False def stop(self, signal): """ Stop all processes in monitor """ for p in self.procs: if p.is_alive(): p.popen.send_signal(signal) for p in self.procs: if p.is_alive(): logger.warning('Waiting for [%s][%s] exit.' % (p.name, p.pid)) p.wait() logger.info( 'Process [%s] has been stopped. dag_file: %s' % (p.name, p.dag_list)) # Reset members self.procs = [] self.dead_cnt = 0 def start(launch_file=''): """ Start all modules in xml config """ pmon = ProcessMonitor() # Find launch file if launch_file[0] == '/': launch_file = launch_file elif launch_file == os.path.basename(launch_file): launch_file = os.path.join(cyber_path, 'launch', launch_file) else: if os.path.exists(os.path.join(g_pwd, launch_file)): launch_file = os.path.join(g_pwd, launch_file) else: logger.error('Cannot find launch file: %s ' % launch_file) sys.exit(1) logger.info('Launch file [%s]' % launch_file) logger.info('=' * 120) if not os.path.isfile(launch_file): logger.error('Launch xml file %s does not exist' % launch_file) sys.exit(1) try: tree = ET.parse(launch_file) except Exception: logger.error('Parse xml failed. illegal xml!') sys.exit(1) total_dag_num = 0 dictionary = {} dag_dict = {} root1 = tree.getroot() for module in root1.findall('module'): process_name = module.find('process_name').text process_type = module.find('type') if process_type is None: process_type = 'library' else: process_type = process_type.text if process_type is None: process_type = 'library' process_type = process_type.strip() if process_type != 'binary': dag_list = [] for dag_conf in module.findall('dag_conf'): if dag_conf.text is None: continue dag = dag_conf.text.strip() if len(dag) > 0: dag_list.append(dag) if len(dag_list) == 0: logger.error('Library dag conf is null') continue else: total_dag_num += len(dag_list) if process_name is None: process_name = 'mainboard_default_' + str(os.getpid()) process_name = process_name.strip() if str(process_name) in dictionary: dictionary[str(process_name)] += 1 else: dictionary[str(process_name)] = 1 if str(process_name) not in dag_dict: dag_dict[str(process_name)] = dag_list else: dag_dict[str(process_name)].extend(dag_list) process_list = [] root = tree.getroot() for env in root.findall('environment'): for var in env.getchildren(): os.environ[var.tag] = str(var.text) for module in root.findall('module'): module_name = module.find('name').text dag_conf = module.find('dag_conf').text process_name = module.find('process_name').text sched_name = module.find('sched_name') process_type = module.find('type') exception_handler = module.find('exception_handler') if process_type is None: process_type = 'library' else: process_type = process_type.text if process_type is None: process_type = 'library' process_type = process_type.strip() if sched_name is None: sched_name = "CYBER_DEFAULT" else: sched_name = sched_name.text if process_name is None: process_name = 'mainboard_default_' + str(os.getpid()) dag_list = [] for dag_conf in module.findall('dag_conf'): if dag_conf.text is None: continue dag = dag_conf.text.strip() if len(dag) > 0: dag_list.append(dag) if module_name is None: module_name = '' if exception_handler is None: exception_handler = '' else: exception_handler = exception_handler.text module_name = module_name.strip() process_name = process_name.strip() sched_name = sched_name.strip() exception_handler = exception_handler.strip() logger.info('Load module [%s] %s: [%s] [%s] conf: [%s] exception_handler: [%s]' % (module_name, process_type, process_name, sched_name, ', '.join(dag_list), exception_handler)) if process_name not in process_list: if process_type == 'binary': if len(process_name) == 0: logger.error( 'Start binary failed. Binary process_name is null.') continue pw = ProcessWrapper( process_name.split()[0], 0, [ ""], process_name, process_type, exception_handler) # Default is library else: pw = ProcessWrapper( g_binary_name, 0, dag_dict[ str(process_name)], process_name, process_type, sched_name, exception_handler) result = pw.start() if result != 0: logger.error( 'Start manager [%s] failed. Stop all!' % process_name) stop() pmon.register(pw) process_list.append(process_name) # No module in xml if not process_list: logger.error("No module was found in xml config.") return all_died = pmon.run() if not all_died: logger.info("Stop all processes...") stop() logger.info("Cyber exit.") def stop(sig=signal.SIGINT): """ stop all modules """ pmon = ProcessMonitor() if len(pmon.procs) == 0: return pmon.stop(sig) logger.info('All processes have been stopped.') sys.exit(0) def stop_launch(launch_file): """ Stop the launch file """ if not launch_file: cmd = 'pkill -INT cyber_launch' else: cmd = 'pkill -INT -f ' + launch_file os.system(cmd) time.sleep(3) logger.info('Stop cyber launch finished.') sys.exit(0) def signal_handler(sig, frame): logger.info('Keyboard interrupt received. Stop all processes.') stop(sig) def main(): """ Main function """ if cyber_path is None: logger.error( 'Error: environment variable CYBER_PATH not found, set environment first.') sys.exit(1) os.chdir(cyber_path) parser = argparse.ArgumentParser(description='cyber launcher') subparsers = parser.add_subparsers(help='sub-command help') start_parser = subparsers.add_parser( 'start', help='launch/benchmark.launch') start_parser.add_argument('file', nargs='?', action='store', help='launch file, default is cyber.launch') stop_parser = subparsers.add_parser( 'stop', help='stop all the module in launch file') stop_parser.add_argument('file', nargs='?', action='store', help='launch file, default stop all the launcher') # restart_parser = subparsers.add_parser('restart', help='restart the module') # restart_parser.add_argument('file', nargs='?', action='store', help='launch file, # default is cyber.launch') params = parser.parse_args(sys.argv[1:]) command = sys.argv[1] if command == 'start': start(params.file) elif command == 'stop': stop_launch(params.file) # elif command == 'restart': # restart(params.file) else: logger.error('Invalid command %s' % command) sys.exit(1) if __name__ == '__main__': signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) main()
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_launch/BUILD
load("@rules_python//python:defs.bzl", "py_binary") load("//tools/install:install.bzl", "install_files") package( default_visibility = ["//visibility:public"], ) # FIXME(all): python module deps py_binary( name = "cyber_launch", srcs = ["cyber_launch.py"], ) # Note(storypku): # Workaround for install support of Python not ready. install_files( name = "install", dest = "cyber/bin", files = [ ":cyber_launch.py", ], rename = { "cyber/bin/cyber_launch.py": "cyber_launch", }, )
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/main.cc
/****************************************************************************** * 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. *****************************************************************************/ #include <getopt.h> #include <cstddef> #include <memory> #include <stdexcept> #include <string> #include <vector> #include "cyber/common/file.h" #include "cyber/common/time_conversion.h" #include "cyber/init.h" #include "cyber/tools/cyber_recorder/info.h" #include "cyber/tools/cyber_recorder/player/player.h" #include "cyber/tools/cyber_recorder/recorder.h" #include "cyber/tools/cyber_recorder/recoverer.h" #include "cyber/tools/cyber_recorder/spliter.h" using apollo::cyber::common::GetFileName; using apollo::cyber::common::StringToUnixSeconds; using apollo::cyber::common::UnixSecondsToString; using apollo::cyber::record::HeaderBuilder; using apollo::cyber::record::Info; using apollo::cyber::record::Player; using apollo::cyber::record::PlayParam; using apollo::cyber::record::Recorder; using apollo::cyber::record::Recoverer; using apollo::cyber::record::Spliter; const char INFO_OPTIONS[] = "h"; const char RECORD_OPTIONS[] = "o:ac:k:i:m:h"; const char PLAY_OPTIONS[] = "f:ac:k:lr:b:e:s:d:p:h"; const char SPLIT_OPTIONS[] = "f:o:c:k:b:e:h"; const char RECOVER_OPTIONS[] = "f:o:h"; void DisplayUsage(const std::string& binary); void DisplayUsage(const std::string& binary, const std::string& command); void DisplayUsage(const std::string& binary, const std::string& command, const std::string& options); void DisplayUsage(const std::string& binary) { std::cout << "usage: " << binary << " <command> [<args>]\n" << "The " << binary << " commands are:\n" << "\tinfo\tShow information of an exist record.\n" << "\tplay\tPlay an exist record.\n" << "\trecord\tRecord same topic.\n" << "\tsplit\tSplit an exist record.\n" << "\trecover\tRecover an exist record.\n" << std::endl; } void DisplayUsage(const std::string& binary, const std::string& command) { if (command == "info") { std::cout << "usage: cyber_recorder info file" << std::endl; std::cout << "usage: " << binary << " " << command << " [options]" << std::endl; DisplayUsage(binary, command, INFO_OPTIONS); return; } std::cout << "usage: " << binary << " " << command << " [options]" << std::endl; if (command == "record") { DisplayUsage(binary, command, RECORD_OPTIONS); } else if (command == "play") { DisplayUsage(binary, command, PLAY_OPTIONS); } else if (command == "split") { DisplayUsage(binary, command, SPLIT_OPTIONS); } else if (command == "recover") { DisplayUsage(binary, command, RECOVER_OPTIONS); } else { std::cout << "Unknown command: " << command << std::endl; DisplayUsage(binary); } } void DisplayUsage(const std::string& binary, const std::string& command, const std::string& options) { for (char option : options) { switch (option) { case 'f': std::cout << "\t-f, --file <file>\t\t\tinput record file" << std::endl; break; case 'o': std::cout << "\t-o, --output <file>\t\t\toutput record file" << std::endl; break; case 'a': std::cout << "\t-a, --all\t\t\t\t" << command << " all" << std::endl; break; case 'c': std::cout << "\t-c, --white-channel <name>\t\tonly " << command << " the specified channel" << std::endl; break; case 'k': std::cout << "\t-k, --black-channel <name>\t\tnot " << command << " the specified channel" << std::endl; break; case 'l': std::cout << "\t-l, --loop\t\t\t\tloop " << command << std::endl; break; case 'r': std::cout << "\t-r, --rate <1.0>\t\t\tmultiply the " << command << " rate by FACTOR" << std::endl; break; case 'b': std::cout << "\t-b, --begin 2018-07-01-00:00:00\t" << command << " the record begin at" << std::endl; break; case 'e': std::cout << "\t-e, --end 2018-07-01-00:01:00\t\t" << command << " the record end at" << std::endl; break; case 's': std::cout << "\t-s, --start <seconds>\t\t\t" << command << " started at n seconds" << std::endl; break; case 'd': std::cout << "\t-d, --delay <seconds>\t\t\t" << command << " delayed n seconds" << std::endl; break; case 'p': std::cout << "\t-p, --preload <seconds>\t\t\t" << command << " after trying to preload n second(s)" << std::endl; break; case 'i': std::cout << "\t-i, --segment-interval <seconds>\t" << command << " segmented every n second(s)" << std::endl; break; case 'm': std::cout << "\t-m, --segment-size <MB>\t\t\t" << command << " segmented every n megabyte(s)" << std::endl; break; case 'h': std::cout << "\t-h, --help\t\t\t\tshow help message" << std::endl; break; case ':': break; default: std::cout << "unknown option: -" << option; break; } } } int main(int argc, char** argv) { std::string binary = GetFileName(std::string(argv[0])); if (argc < 2) { DisplayUsage(binary); return -1; } const std::string command(argv[1]); std::string file_path; if (argc >= 3) { file_path = std::string(argv[2]); } int long_index = 0; const std::string short_opts = "f:c:k:o:alr:b:e:s:d:p:i:m:h"; static const struct option long_opts[] = { {"files", required_argument, nullptr, 'f'}, {"white-channel", required_argument, nullptr, 'c'}, {"black-channel", required_argument, nullptr, 'k'}, {"output", required_argument, nullptr, 'o'}, {"all", no_argument, nullptr, 'a'}, {"loop", no_argument, nullptr, 'l'}, {"rate", required_argument, nullptr, 'r'}, {"begin", required_argument, nullptr, 'b'}, {"end", required_argument, nullptr, 'e'}, {"start", required_argument, nullptr, 's'}, {"delay", required_argument, nullptr, 'd'}, {"preload", required_argument, nullptr, 'p'}, {"segment-interval", required_argument, nullptr, 'i'}, {"segment-size", required_argument, nullptr, 'm'}, {"help", no_argument, nullptr, 'h'}}; std::vector<std::string> opt_file_vec; std::vector<std::string> opt_output_vec; std::vector<std::string> opt_white_channels; std::vector<std::string> opt_black_channels; bool opt_all = false; bool opt_loop = false; float opt_rate = 1.0f; uint64_t opt_begin = 0; uint64_t opt_end = std::numeric_limits<uint64_t>::max(); uint64_t opt_start = 0; uint64_t opt_delay = 0; uint32_t opt_preload = 3; auto opt_header = HeaderBuilder::GetHeader(); do { int opt = getopt_long(argc, argv, short_opts.c_str(), long_opts, &long_index); if (opt == -1) { break; } switch (opt) { case 'f': opt_file_vec.emplace_back(std::string(optarg)); for (int i = optind; i < argc; i++) { if (*argv[i] != '-') { opt_file_vec.emplace_back(std::string(argv[i])); } else { break; } } break; case 'c': opt_white_channels.emplace_back(std::string(optarg)); for (int i = optind; i < argc; i++) { if (*argv[i] != '-') { opt_white_channels.emplace_back(std::string(argv[i])); } else { break; } } break; case 'k': opt_black_channels.emplace_back(std::string(optarg)); for (int i = optind; i < argc; i++) { if (*argv[i] != '-') { opt_black_channels.emplace_back(std::string(argv[i])); } else { break; } } break; case 'o': opt_output_vec.push_back(std::string(optarg)); break; case 'a': opt_all = true; break; case 'l': opt_loop = true; break; case 'r': try { opt_rate = std::stof(optarg); } catch (const std::invalid_argument& ia) { std::cout << "Invalid argument: -r/--rate " << std::string(optarg) << std::endl; return -1; } catch (const std::out_of_range& e) { std::cout << "Argument is out of range: -r/--rate " << std::string(optarg) << std::endl; return -1; } break; case 'b': opt_begin = StringToUnixSeconds(std::string(optarg)) * 1000 * 1000 * 1000ULL; break; case 'e': opt_end = StringToUnixSeconds(std::string(optarg)) * 1000 * 1000 * 1000ULL; break; case 's': try { opt_start = std::stoi(optarg); } catch (const std::invalid_argument& ia) { std::cout << "Invalid argument: -s/--start " << std::string(optarg) << std::endl; return -1; } catch (const std::out_of_range& e) { std::cout << "Argument is out of range: -s/--start " << std::string(optarg) << std::endl; return -1; } break; case 'd': try { opt_delay = std::stoi(optarg); } catch (std::invalid_argument& ia) { std::cout << "Invalid argument: -d/--delay " << std::string(optarg) << std::endl; return -1; } catch (const std::out_of_range& e) { std::cout << "Argument is out of range: -d/--delay " << std::string(optarg) << std::endl; return -1; } break; case 'p': try { opt_preload = std::stoi(optarg); } catch (std::invalid_argument& ia) { std::cout << "Invalid argument: -p/--preload " << std::string(optarg) << std::endl; return -1; } catch (const std::out_of_range& e) { std::cout << "Argument is out of range: -p/--preload " << std::string(optarg) << std::endl; return -1; } break; case 'i': try { int interval_s = std::stoi(optarg); if (interval_s < 0) { std::cout << "Argument is less than zero: -i/--segment-interval " << std::string(optarg) << std::endl; return -1; } opt_header.set_segment_interval(interval_s * 1000000000ULL); } catch (std::invalid_argument& ia) { std::cout << "Invalid argument: -i/--segment-interval " << std::string(optarg) << std::endl; return -1; } catch (const std::out_of_range& e) { std::cout << "Argument is out of range: -i/--segment-interval " << std::string(optarg) << std::endl; return -1; } break; case 'm': try { int size_mb = std::stoi(optarg); if (size_mb < 0) { std::cout << "Argument is less than zero: -m/--segment-size " << std::string(optarg) << std::endl; return -1; } opt_header.set_segment_raw_size(size_mb * 1024 * 1024ULL); } catch (std::invalid_argument& ia) { std::cout << "Invalid argument: -m/--segment-size " << std::string(optarg) << std::endl; return -1; } catch (const std::out_of_range& e) { std::cout << "Argument is out of range: -m/--segment-size " << std::string(optarg) << std::endl; return -1; } break; case 'h': DisplayUsage(binary, command); return 0; default: break; } } while (true); // cyber_recorder info if (command == "info") { if (file_path.empty()) { std::cout << "usage: cyber_recorder info file" << std::endl; return -1; } ::apollo::cyber::Init(argv[0]); Info info; bool info_result = info.Display(file_path); return info_result ? 0 : -1; } else if (command == "recover") { if (opt_file_vec.empty()) { std::cout << "MUST specify file option (-f)." << std::endl; return -1; } if (opt_file_vec.size() > 1 || opt_output_vec.size() > 1) { std::cout << "TOO many input/output file option (-f/-o)." << std::endl; return -1; } if (opt_output_vec.empty()) { std::string default_output_file = opt_file_vec[0] + ".recover"; opt_output_vec.push_back(default_output_file); } ::apollo::cyber::Init(argv[0]); Recoverer recoverer(opt_file_vec[0], opt_output_vec[0]); bool recover_result = recoverer.Proc(); return recover_result ? 0 : -1; } if (command == "play") { if (opt_file_vec.empty()) { std::cout << "MUST specify file option (-f)." << std::endl; return -1; } ::apollo::cyber::Init(argv[0]); PlayParam play_param; play_param.is_play_all_channels = opt_all || opt_white_channels.empty(); play_param.is_loop_playback = opt_loop; play_param.play_rate = opt_rate; play_param.begin_time_ns = opt_begin; play_param.end_time_ns = opt_end; play_param.start_time_s = opt_start; play_param.delay_time_s = opt_delay; play_param.preload_time_s = opt_preload; play_param.files_to_play.insert(opt_file_vec.begin(), opt_file_vec.end()); play_param.black_channels.insert(opt_black_channels.begin(), opt_black_channels.end()); play_param.channels_to_play.insert(opt_white_channels.begin(), opt_white_channels.end()); Player player(play_param); const bool play_result = player.Init() && player.Start(); return play_result ? 0 : -1; } else if (command == "record") { if (opt_white_channels.empty() && !opt_all) { std::cout << "MUST specify channels option (-c) or all channels option (-a)." << std::endl; return -1; } if (opt_output_vec.size() > 1) { std::cout << "TOO many output file option (-o)." << std::endl; return -1; } if (opt_output_vec.empty()) { std::string default_output_file = UnixSecondsToString(time(nullptr), "%Y%m%d%H%M%S") + ".record"; opt_output_vec.push_back(default_output_file); } ::apollo::cyber::Init(argv[0]); auto recorder = std::make_shared<Recorder>(opt_output_vec[0], opt_all, opt_white_channels, opt_black_channels, opt_header); bool record_result = recorder->Start(); if (record_result) { while (!::apollo::cyber::IsShutdown()) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } record_result = recorder->Stop(); } return record_result ? 0 : -1; } else if (command == "split") { if (opt_file_vec.empty()) { std::cout << "Must specify file option (-f)." << std::endl; return -1; } if (opt_file_vec.size() > 1 || opt_output_vec.size() > 1) { std::cout << "Too many input/output file option (-f/-o)." << std::endl; return -1; } if (opt_output_vec.empty()) { std::string default_output_file = opt_file_vec[0] + ".split"; opt_output_vec.push_back(default_output_file); } ::apollo::cyber::Init(argv[0]); Spliter spliter(opt_file_vec[0], opt_output_vec[0], opt_white_channels, opt_black_channels, opt_begin, opt_end); bool split_result = spliter.Proc(); return split_result ? 0 : -1; } // unknown command DisplayUsage(binary, command); return -1; }
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/info.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_recorder/info.h" #include "cyber/record/record_message.h" namespace apollo { namespace cyber { namespace record { using apollo::cyber::proto::ChannelCache; using apollo::cyber::record::kGB; using apollo::cyber::record::kKB; using apollo::cyber::record::kMB; Info::Info() {} Info::~Info() {} bool Info::Display(const std::string& file) { RecordFileReader file_reader; if (!file_reader.Open(file)) { AERROR << "open record file error. file: " << file; return false; } proto::Header hdr = file_reader.GetHeader(); std::cout << setiosflags(std::ios::left); std::cout << setiosflags(std::ios::fixed); int w = 16; // file name std::cout << std::setw(w) << "record_file: " << file << std::endl; // version std::cout << std::setw(w) << "version: " << hdr.major_version() << "." << hdr.minor_version() << std::endl; // time and duration auto begin_time_s = static_cast<double>(hdr.begin_time()) / 1e9; auto end_time_s = static_cast<double>(hdr.end_time()) / 1e9; auto duration_s = end_time_s - begin_time_s; auto begin_time_str = UnixSecondsToString(static_cast<int>(begin_time_s)); auto end_time_str = UnixSecondsToString(static_cast<int>(end_time_s)); std::cout << std::setw(w) << "duration: " << duration_s << " Seconds" << std::endl; std::cout << std::setw(w) << "begin_time: " << begin_time_str << std::endl; std::cout << std::setw(w) << "end_time: " << end_time_str << std::endl; // size std::cout << std::setw(w) << "size: " << hdr.size() << " Bytes"; if (hdr.size() >= kGB) { std::cout << " (" << static_cast<float>(hdr.size()) / kGB << " GB)"; } else if (hdr.size() >= kMB) { std::cout << " (" << static_cast<float>(hdr.size()) / kMB << " MB)"; } else if (hdr.size() >= kKB) { std::cout << " (" << static_cast<float>(hdr.size()) / kKB << " KB)"; } std::cout << std::endl; // is_complete std::cout << std::setw(w) << "is_complete:"; if (hdr.is_complete()) { std::cout << "true"; } else { std::cout << "false"; } std::cout << std::endl; // message_number std::cout << std::setw(w) << "message_number: " << hdr.message_number() << std::endl; // channel_number std::cout << std::setw(w) << "channel_number: " << hdr.channel_number() << std::endl; // read index section if (!file_reader.ReadIndex()) { AERROR << "read index section of the file fail. file: " << file; return false; } // channel info std::cout << std::setw(w) << "channel_info: " << std::endl; proto::Index idx = file_reader.GetIndex(); for (int i = 0; i < idx.indexes_size(); ++i) { ChannelCache* cache = idx.mutable_indexes(i)->mutable_channel_cache(); if (idx.mutable_indexes(i)->type() == proto::SectionType::SECTION_CHANNEL) { std::cout << std::setw(w) << ""; std::cout << resetiosflags(std::ios::right); std::cout << std::setw(50) << cache->name(); std::cout << setiosflags(std::ios::right); std::cout << std::setw(8) << cache->message_number(); std::cout << std::setw(0) << " messages: "; std::cout << cache->message_type(); std::cout << std::endl; } } file_reader.Close(); return true; } } // namespace record } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/spliter.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_recorder/spliter.h" namespace apollo { namespace cyber { namespace record { using apollo::cyber::proto::Channel; using apollo::cyber::proto::SectionType; Spliter::Spliter(const std::string& input_file, const std::string& output_file, const std::vector<std::string>& white_channels, const std::vector<std::string>& black_channels, uint64_t begin_time, uint64_t end_time) : input_file_(input_file), output_file_(output_file), white_channels_(white_channels), black_channels_(black_channels), begin_time_(begin_time), end_time_(end_time) {} Spliter::~Spliter() {} bool Spliter::Proc() { // check params if (begin_time_ >= end_time_) { AERROR << "begin time larger or equal than end time, begin_time_: " << begin_time_ << "end_time_: " << end_time_; return false; } for (const auto& channel_name : white_channels_) { if (std::find(black_channels_.begin(), black_channels_.end(), channel_name) != black_channels_.end()) { AERROR << "find channel in both of white list and black list, channel: " << channel_name; return false; } } AINFO << "split record file started."; // open input file if (!reader_.Open(input_file_)) { AERROR << "open input file failed, file: " << input_file_; return false; } Header header = reader_.GetHeader(); if (begin_time_ > header.end_time() || end_time_ < header.begin_time()) { AERROR << "time range " << begin_time_ << " to " << end_time_ << " is not include in this record file."; return false; } // open output file Header new_hdr = HeaderBuilder::GetHeader(); if (!writer_.Open(output_file_)) { AERROR << "open output file failed. file: " << output_file_; return false; } if (!writer_.WriteHeader(new_hdr)) { AERROR << "write header to output file failed. file: " << output_file_; return false; } // read through record file bool skip_next_chunk_body(false); reader_.Reset(); while (!reader_.EndOfFile()) { Section section; if (!reader_.ReadSection(&section)) { AERROR << "read section failed."; return false; } if (section.type == SectionType::SECTION_INDEX) { break; } switch (section.type) { case SectionType::SECTION_CHANNEL: { Channel chan; if (!reader_.ReadSection<Channel>(section.size, &chan)) { AERROR << "read channel section fail."; return false; } if (white_channels_.empty() || std::find(white_channels_.begin(), white_channels_.end(), chan.name()) != white_channels_.end()) { if (std::find(black_channels_.begin(), black_channels_.end(), chan.name()) == black_channels_.end()) { writer_.WriteChannel(chan); } } break; } case SectionType::SECTION_CHUNK_HEADER: { ChunkHeader chdr; if (!reader_.ReadSection<ChunkHeader>(section.size, &chdr)) { AERROR << "read chunk header section fail."; return false; } if (begin_time_ > chdr.end_time() || end_time_ < chdr.begin_time()) { skip_next_chunk_body = true; } break; } case SectionType::SECTION_CHUNK_BODY: { if (skip_next_chunk_body) { reader_.SkipSection(section.size); skip_next_chunk_body = false; break; } ChunkBody cbd; if (!reader_.ReadSection<ChunkBody>(section.size, &cbd)) { AERROR << "read chunk body section fail."; return false; } for (int idx = 0; idx < cbd.messages_size(); ++idx) { if (!white_channels_.empty() && std::find(white_channels_.begin(), white_channels_.end(), cbd.messages(idx).channel_name()) == white_channels_.end()) { continue; } if (std::find(black_channels_.begin(), black_channels_.end(), cbd.messages(idx).channel_name()) != black_channels_.end()) { continue; } if (cbd.messages(idx).time() < begin_time_ || cbd.messages(idx).time() > end_time_) { continue; } if (!writer_.WriteMessage(cbd.messages(idx))) { AERROR << "add new message failed."; return false; } } break; } default: { AERROR << "this section should not be here, section type: " << section.type; break; } } // end for switch } // end for while AINFO << "split record file done."; return true; } // end for Proc() } // namespace record } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/recoverer.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_recorder/recoverer.h" #include "cyber/base/for_each.h" #include "cyber/record/header_builder.h" namespace apollo { namespace cyber { namespace record { using apollo::cyber::proto::Channel; using apollo::cyber::proto::ChunkHeader; using apollo::cyber::proto::SectionType; Recoverer::Recoverer(const std::string& input_file, const std::string& output_file) : input_file_(input_file), output_file_(output_file) {} Recoverer::~Recoverer() {} bool Recoverer::Proc() { if (!reader_.Open(input_file_)) { AERROR << "open input file failed, file: " << input_file_; return false; } // open output file proto::Header new_hdr = HeaderBuilder::GetHeader(); if (!writer_.Open(output_file_)) { AERROR << "open output file failed. file: " << output_file_; return false; } if (!writer_.WriteHeader(new_hdr)) { AERROR << "write header to output file failed. file: " << output_file_; return false; } // write channel sections if (reader_.ReadIndex()) { proto::Index index = reader_.GetIndex(); FOR_EACH(i, 0, index.indexes_size()) { proto::SingleIndex* single_index = index.mutable_indexes(i); if (single_index->type() != SectionType::SECTION_CHANNEL) { continue; } ChannelCache* chan_cache = single_index->mutable_channel_cache(); if (std::find(channel_vec_.begin(), channel_vec_.end(), chan_cache->name()) == channel_vec_.end()) { channel_vec_.push_back(chan_cache->name()); Channel chan; chan.set_name(chan_cache->name()); chan.set_message_type(chan_cache->message_type()); chan.set_proto_desc(chan_cache->proto_desc()); writer_.WriteChannel(chan); } } } // read through record file reader_.Reset(); while (!reader_.EndOfFile()) { Section section; if (!reader_.ReadSection(&section)) { AINFO << "read section failed, try next."; continue; } if (section.type == SectionType::SECTION_INDEX) { break; } switch (section.type) { case SectionType::SECTION_CHANNEL: { Channel chan; if (!reader_.ReadSection<Channel>(section.size, &chan)) { AINFO << "one channel section broken, skip it."; break; } if (std::find(channel_vec_.begin(), channel_vec_.end(), chan.name()) == channel_vec_.end()) { channel_vec_.push_back(chan.name()); writer_.WriteChannel(chan); } break; } case SectionType::SECTION_CHUNK_HEADER: { ChunkHeader chdr; if (!reader_.ReadSection<ChunkHeader>(section.size, &chdr)) { AINFO << "one chunk header section broken, skip it."; } break; } case SectionType::SECTION_CHUNK_BODY: { ChunkBody cbd; if (!reader_.ReadSection<ChunkBody>(section.size, &cbd)) { AINFO << "one chunk body section broken, skip it"; break; } for (int idx = 0; idx < cbd.messages_size(); ++idx) { if (!writer_.WriteMessage(cbd.messages(idx))) { AERROR << "add new message failed."; return false; } } break; } default: { AERROR << "this section should not be here, section type: " << section.type; return false; } } // end for switch } // end for while AINFO << "recover record file done."; return true; } // end for Proc() } // namespace record } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/spliter.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_SPLITER_H_ #define CYBER_TOOLS_CYBER_RECORDER_SPLITER_H_ #include <algorithm> #include <limits> #include <memory> #include <string> #include <vector> #include "cyber/common/log.h" #include "cyber/proto/record.pb.h" #include "cyber/record/file/record_file_reader.h" #include "cyber/record/file/record_file_writer.h" #include "cyber/record/header_builder.h" using ::apollo::cyber::proto::ChannelCache; using ::apollo::cyber::proto::ChunkBody; using ::apollo::cyber::proto::ChunkHeader; using ::apollo::cyber::proto::Header; namespace apollo { namespace cyber { namespace record { class Spliter { public: Spliter(const std::string& input_file, const std::string& output_file, const std::vector<std::string>& white_channels, const std::vector<std::string>& black_channels, uint64_t begin_time = 0, uint64_t end_time = std::numeric_limits<uint64_t>::max()); virtual ~Spliter(); bool Proc(); private: RecordFileReader reader_; RecordFileWriter writer_; std::string input_file_; std::string output_file_; std::vector<std::string> white_channels_; std::vector<std::string> black_channels_; bool all_channels_; uint64_t begin_time_; uint64_t end_time_; }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_SPLITER_H_
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/recorder.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_RECORDER_H_ #define CYBER_TOOLS_CYBER_RECORDER_RECORDER_H_ #include <memory> #include <mutex> #include <string> #include <unordered_map> #include <vector> #include "cyber/base/signal.h" #include "cyber/cyber.h" #include "cyber/message/raw_message.h" #include "cyber/proto/record.pb.h" #include "cyber/proto/topology_change.pb.h" #include "cyber/record/record_writer.h" using apollo::cyber::Node; using apollo::cyber::ReaderBase; using apollo::cyber::base::Connection; using apollo::cyber::message::RawMessage; using apollo::cyber::proto::ChangeMsg; using apollo::cyber::proto::RoleAttributes; using apollo::cyber::proto::RoleType; using apollo::cyber::service_discovery::ChannelManager; using apollo::cyber::service_discovery::TopologyManager; namespace apollo { namespace cyber { namespace record { class Recorder : public std::enable_shared_from_this<Recorder> { public: Recorder(const std::string& output, bool all_channels, const std::vector<std::string>& white_channels, const std::vector<std::string>& black_channels); Recorder(const std::string& output, bool all_channels, const std::vector<std::string>& white_channels, const std::vector<std::string>& black_channels, const proto::Header& header); ~Recorder(); bool Start(); bool Stop(); private: bool is_started_ = false; bool is_stopping_ = false; std::shared_ptr<Node> node_ = nullptr; std::shared_ptr<RecordWriter> writer_ = nullptr; std::shared_ptr<std::thread> display_thread_ = nullptr; Connection<const ChangeMsg&> change_conn_; std::string output_; bool all_channels_ = true; std::vector<std::string> white_channels_; std::vector<std::string> black_channels_; proto::Header header_; std::unordered_map<std::string, std::shared_ptr<ReaderBase>> channel_reader_map_; uint64_t message_count_; uint64_t message_time_; bool InitReadersImpl(); bool FreeReadersImpl(); bool InitReaderImpl(const std::string& channel_name, const std::string& message_type); void TopologyCallback(const ChangeMsg& msg); void ReaderCallback(const std::shared_ptr<RawMessage>& message, const std::string& channel_name); void FindNewChannel(const RoleAttributes& role_attr); void ShowProgress(); }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_RECORDER_H_
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/recorder.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_recorder/recorder.h" #include "cyber/record/header_builder.h" namespace apollo { namespace cyber { namespace record { Recorder::Recorder(const std::string& output, bool all_channels, const std::vector<std::string>& white_channels, const std::vector<std::string>& black_channels) : output_(output), all_channels_(all_channels), white_channels_(white_channels), black_channels_(black_channels) { header_ = HeaderBuilder::GetHeader(); } Recorder::Recorder(const std::string& output, bool all_channels, const std::vector<std::string>& white_channels, const std::vector<std::string>& black_channels, const proto::Header& header) : output_(output), all_channels_(all_channels), white_channels_(white_channels), black_channels_(black_channels), header_(header) {} Recorder::~Recorder() { Stop(); } bool Recorder::Start() { for (const auto& channel_name : white_channels_) { if (std::find(black_channels_.begin(), black_channels_.end(), channel_name) != black_channels_.end()) { AERROR << "find channel in both of white list and black list, channel: " << channel_name; return false; } } writer_.reset(new RecordWriter(header_)); if (!writer_->Open(output_)) { AERROR << "Datafile open file error."; return false; } std::string node_name = "cyber_recorder_record_" + std::to_string(getpid()); node_ = ::apollo::cyber::CreateNode(node_name); if (node_ == nullptr) { AERROR << "create node failed, node: " << node_name; return false; } if (!InitReadersImpl()) { AERROR << " _init_readers error."; return false; } message_count_ = 0; message_time_ = 0; is_started_ = true; display_thread_ = std::make_shared<std::thread>([this]() { this->ShowProgress(); }); if (display_thread_ == nullptr) { AERROR << "init display thread error."; return false; } return true; } bool Recorder::Stop() { if (!is_started_ || is_stopping_) { return false; } is_stopping_ = true; if (!FreeReadersImpl()) { AERROR << " _free_readers error."; return false; } writer_->Close(); node_.reset(); if (display_thread_ && display_thread_->joinable()) { display_thread_->join(); display_thread_ = nullptr; } is_started_ = false; is_stopping_ = false; return true; } void Recorder::TopologyCallback(const ChangeMsg& change_message) { ADEBUG << "ChangeMsg in Topology Callback:" << std::endl << change_message.ShortDebugString(); if (change_message.role_type() != apollo::cyber::proto::ROLE_WRITER) { ADEBUG << "Change message role type is not ROLE_WRITER."; return; } FindNewChannel(change_message.role_attr()); } void Recorder::FindNewChannel(const RoleAttributes& role_attr) { if (!role_attr.has_channel_name() || role_attr.channel_name().empty()) { AWARN << "change message not has a channel name or has an empty one."; return; } if (!role_attr.has_message_type() || role_attr.message_type().empty()) { AWARN << "Change message not has a message type or has an empty one."; return; } if (!role_attr.has_proto_desc() || role_attr.proto_desc().empty()) { AWARN << "Change message not has a proto desc or has an empty one."; return; } if (!all_channels_ && std::find(white_channels_.begin(), white_channels_.end(), role_attr.channel_name()) == white_channels_.end()) { ADEBUG << "New channel '" << role_attr.channel_name() << "' was found, but not in record list."; return; } if (std::find(black_channels_.begin(), black_channels_.end(), role_attr.channel_name()) != black_channels_.end()) { ADEBUG << "New channel '" << role_attr.channel_name() << "' was found, but it appears in the blacklist."; return; } if (channel_reader_map_.find(role_attr.channel_name()) == channel_reader_map_.end()) { if (!writer_->WriteChannel(role_attr.channel_name(), role_attr.message_type(), role_attr.proto_desc())) { AERROR << "write channel fail, channel:" << role_attr.channel_name(); } InitReaderImpl(role_attr.channel_name(), role_attr.message_type()); } } bool Recorder::InitReadersImpl() { std::shared_ptr<ChannelManager> channel_manager = TopologyManager::Instance()->channel_manager(); // get historical writers std::vector<proto::RoleAttributes> role_attr_vec; channel_manager->GetWriters(&role_attr_vec); for (auto role_attr : role_attr_vec) { FindNewChannel(role_attr); } // listen new writers in future change_conn_ = channel_manager->AddChangeListener( std::bind(&Recorder::TopologyCallback, this, std::placeholders::_1)); if (!change_conn_.IsConnected()) { AERROR << "change connection is not connected"; return false; } return true; } bool Recorder::FreeReadersImpl() { std::shared_ptr<ChannelManager> channel_manager = TopologyManager::Instance()->channel_manager(); channel_manager->RemoveChangeListener(change_conn_); return true; } bool Recorder::InitReaderImpl(const std::string& channel_name, const std::string& message_type) { try { std::weak_ptr<Recorder> weak_this = shared_from_this(); std::shared_ptr<ReaderBase> reader = nullptr; auto callback = [weak_this, channel_name]( const std::shared_ptr<RawMessage>& raw_message) { auto share_this = weak_this.lock(); if (!share_this) { return; } share_this->ReaderCallback(raw_message, channel_name); }; ReaderConfig config; config.channel_name = channel_name; config.pending_queue_size = gflags::Int32FromEnv("CYBER_PENDING_QUEUE_SIZE", 50); reader = node_->CreateReader<RawMessage>(config, callback); if (reader == nullptr) { AERROR << "Create reader failed."; return false; } channel_reader_map_[channel_name] = reader; return true; } catch (const std::bad_weak_ptr& e) { AERROR << e.what(); return false; } } void Recorder::ReaderCallback(const std::shared_ptr<RawMessage>& message, const std::string& channel_name) { if (!is_started_ || is_stopping_) { AERROR << "record procedure is not started or stopping."; return; } if (message == nullptr) { AERROR << "message is nullptr, channel: " << channel_name; return; } message_time_ = Time::Now().ToNanosecond(); if (!writer_->WriteMessage(channel_name, message, message_time_)) { AERROR << "write data fail, channel: " << channel_name; return; } message_count_++; } void Recorder::ShowProgress() { while (is_started_ && !is_stopping_) { std::cout << "\r[RUNNING] Record Time: " << std::setprecision(3) << message_time_ / 1000000000 << " Progress: " << channel_reader_map_.size() << " channels, " << message_count_ << " messages"; std::cout.flush(); std::this_thread::sleep_for(std::chrono::milliseconds(100)); } std::cout << std::endl; } } // namespace record } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/recoverer.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_RECOVERER_H_ #define CYBER_TOOLS_CYBER_RECORDER_RECOVERER_H_ #include <algorithm> #include <memory> #include <string> #include <vector> #include "cyber/common/log.h" #include "cyber/proto/record.pb.h" #include "cyber/record/file/record_file_reader.h" #include "cyber/record/file/record_file_writer.h" using ::apollo::cyber::proto::ChannelCache; using ::apollo::cyber::proto::ChunkBody; using ::apollo::cyber::proto::ChunkHeader; using ::apollo::cyber::proto::Header; namespace apollo { namespace cyber { namespace record { class Recoverer { public: Recoverer(const std::string& input_file, const std::string& output_file); virtual ~Recoverer(); bool Proc(); private: RecordFileReader reader_; RecordFileWriter writer_; std::string input_file_; std::string output_file_; std::vector<std::string> channel_vec_; }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_RECOVERER_H_
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/BUILD
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") load("//tools/install:install.bzl", "install") load("//tools:cpplint.bzl", "cpplint") package(default_visibility = ["//visibility:public"]) install( name = "install", runtime_dest = "cyber/bin", targets = [ ":cyber_recorder", ], ) cc_binary( name = "cyber_recorder", srcs = ["main.cc"], linkopts = ["-pthread"], deps = [ ":info", ":recorder", ":recoverer", ":spliter", "//cyber:init", "//cyber/common:file", "//cyber/common:time_conversion", "//cyber/tools/cyber_recorder/player", ], ) cc_library( name = "info", srcs = ["info.cc"], hdrs = ["info.h"], deps = [ "//cyber/common:time_conversion", "//cyber/proto:record_cc_proto", "//cyber/record:record_file_reader", "//cyber/record:record_message", ], ) cc_library( name = "recorder", srcs = ["recorder.cc"], hdrs = ["recorder.h"], deps = [ "//cyber", "//cyber/common:log", "//cyber/proto:record_cc_proto", "@fastrtps", ], ) cc_library( name = "recoverer", srcs = ["recoverer.cc"], hdrs = ["recoverer.h"], deps = [ "//cyber/base:for_each", "//cyber/common:log", "//cyber/proto:record_cc_proto", "//cyber/record:header_builder", "//cyber/record:record_file_reader", "//cyber/record:record_writer", ], ) cc_library( name = "spliter", srcs = ["spliter.cc"], hdrs = ["spliter.h"], deps = [ "//cyber/common:log", "//cyber/proto:record_cc_proto", "//cyber/record:header_builder", "//cyber/record:record_file_reader", "//cyber/record:record_writer", ], ) cpplint()
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_recorder/info.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_INFO_H_ #define CYBER_TOOLS_CYBER_RECORDER_INFO_H_ #include <chrono> #include <iomanip> #include <string> #include "cyber/common/time_conversion.h" #include "cyber/proto/record.pb.h" #include "cyber/record/file/record_file_reader.h" using ::apollo::cyber::common::UnixSecondsToString; namespace apollo { namespace cyber { namespace record { class Info { public: Info(); ~Info(); bool Display(const std::string& file); }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_INFO_H_
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/play_task_producer.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_recorder/player/play_task_producer.h" #include <iostream> #include <limits> #include "cyber/common/log.h" #include "cyber/common/time_conversion.h" #include "cyber/cyber.h" #include "cyber/message/protobuf_factory.h" #include "cyber/record/record_viewer.h" namespace apollo { namespace cyber { namespace record { const uint32_t PlayTaskProducer::kMinTaskBufferSize = 500; const uint32_t PlayTaskProducer::kPreloadTimeSec = 3; const uint64_t PlayTaskProducer::kSleepIntervalNanoSec = 1000000; PlayTaskProducer::PlayTaskProducer(const TaskBufferPtr& task_buffer, const PlayParam& play_param) : play_param_(play_param), task_buffer_(task_buffer), produce_th_(nullptr), is_initialized_(false), is_stopped_(true), node_(nullptr), earliest_begin_time_(std::numeric_limits<uint64_t>::max()), latest_end_time_(0), total_msg_num_(0) {} PlayTaskProducer::~PlayTaskProducer() { Stop(); } bool PlayTaskProducer::Init() { if (is_initialized_.exchange(true)) { AERROR << "producer has been initialized."; return false; } if (!ReadRecordInfo() || !UpdatePlayParam() || !CreateWriters()) { is_initialized_.store(false); return false; } return true; } void PlayTaskProducer::Start() { if (!is_initialized_.load()) { AERROR << "please call Init firstly."; return; } if (!is_stopped_.exchange(false)) { AERROR << "producer has been started."; return; } produce_th_.reset(new std::thread(&PlayTaskProducer::ThreadFunc, this)); } void PlayTaskProducer::Stop() { if (!is_stopped_.exchange(true)) { return; } if (produce_th_ != nullptr && produce_th_->joinable()) { produce_th_->join(); produce_th_ = nullptr; } } bool PlayTaskProducer::ReadRecordInfo() { if (play_param_.files_to_play.empty()) { AINFO << "no file to play."; return false; } auto pb_factory = message::ProtobufFactory::Instance(); // loop each file for (auto& file : play_param_.files_to_play) { auto record_reader = std::make_shared<RecordReader>(file); if (!record_reader->IsValid()) { continue; } if (!record_reader->GetHeader().is_complete()) { std::cout << "file: " << file << " is not complete." << std::endl; continue; } record_readers_.emplace_back(record_reader); auto channel_list = record_reader->GetChannelList(); // loop each channel info for (auto& channel_name : channel_list) { if (play_param_.black_channels.find(channel_name) != play_param_.black_channels.end()) { // minus the black message number from record file header total_msg_num_ -= record_reader->GetMessageNumber(channel_name); continue; } auto& msg_type = record_reader->GetMessageType(channel_name); msg_types_[channel_name] = msg_type; if (!play_param_.is_play_all_channels && play_param_.channels_to_play.count(channel_name) > 0) { total_msg_num_ += record_reader->GetMessageNumber(channel_name); } auto& proto_desc = record_reader->GetProtoDesc(channel_name); pb_factory->RegisterMessage(proto_desc); } auto& header = record_reader->GetHeader(); if (play_param_.is_play_all_channels) { total_msg_num_ += header.message_number(); } if (header.begin_time() < earliest_begin_time_) { earliest_begin_time_ = header.begin_time(); } if (header.end_time() > latest_end_time_) { latest_end_time_ = header.end_time(); } auto begin_time_s = static_cast<double>(header.begin_time()) / 1e9; auto end_time_s = static_cast<double>(header.end_time()) / 1e9; auto begin_time_str = common::UnixSecondsToString(static_cast<int>(begin_time_s)); auto end_time_str = common::UnixSecondsToString(static_cast<int>(end_time_s)); std::cout << "file: " << file << ", chunk_number: " << header.chunk_number() << ", begin_time: " << header.begin_time() << " (" << begin_time_str << ")" << ", end_time: " << header.end_time() << " (" << end_time_str << ")" << ", message_number: " << header.message_number() << std::endl; } std::cout << "earliest_begin_time: " << earliest_begin_time_ << ", latest_end_time: " << latest_end_time_ << ", total_msg_num: " << total_msg_num_ << std::endl; return true; } bool PlayTaskProducer::UpdatePlayParam() { if (play_param_.begin_time_ns < earliest_begin_time_) { play_param_.begin_time_ns = earliest_begin_time_; } if (play_param_.start_time_s > 0) { play_param_.begin_time_ns += static_cast<uint64_t>( static_cast<double>(play_param_.start_time_s) * 1e9); } if (play_param_.end_time_ns > latest_end_time_) { play_param_.end_time_ns = latest_end_time_; } if (play_param_.begin_time_ns >= play_param_.end_time_ns) { AERROR << "begin time are equal or larger than end time" << ", begin_time_ns=" << play_param_.begin_time_ns << ", end_time_ns=" << play_param_.end_time_ns; return false; } if (play_param_.preload_time_s == 0) { AINFO << "preload time is zero, we will use defalut value: " << kPreloadTimeSec << " seconds."; play_param_.preload_time_s = kPreloadTimeSec; } return true; } bool PlayTaskProducer::CreateWriters() { std::string node_name = "cyber_recorder_play_" + std::to_string(getpid()); node_ = apollo::cyber::CreateNode(node_name); if (node_ == nullptr) { AERROR << "create node failed."; return false; } for (auto& item : msg_types_) { auto& channel_name = item.first; auto& msg_type = item.second; if (play_param_.is_play_all_channels || play_param_.channels_to_play.count(channel_name) > 0) { if (play_param_.black_channels.find(channel_name) != play_param_.black_channels.end()) { continue; } proto::RoleAttributes attr; attr.set_channel_name(channel_name); attr.set_message_type(msg_type); auto writer = node_->CreateWriter<message::RawMessage>(attr); if (writer == nullptr) { AERROR << "create writer failed. channel name: " << channel_name << ", message type: " << msg_type; return false; } writers_[channel_name] = writer; } } return true; } void PlayTaskProducer::ThreadFunc() { const uint64_t loop_time_ns = play_param_.end_time_ns - play_param_.begin_time_ns; uint64_t avg_interval_time_ns = kSleepIntervalNanoSec; if (total_msg_num_ > 0) { avg_interval_time_ns = loop_time_ns / total_msg_num_; } double avg_freq_hz = static_cast<double>(total_msg_num_) / (static_cast<double>(loop_time_ns) * 1e-9); uint32_t preload_size = (uint32_t)avg_freq_hz * play_param_.preload_time_s; AINFO << "preload_size: " << preload_size; if (preload_size < kMinTaskBufferSize) { preload_size = kMinTaskBufferSize; } auto record_viewer = std::make_shared<RecordViewer>( record_readers_, play_param_.begin_time_ns, play_param_.end_time_ns, play_param_.channels_to_play); uint32_t loop_num = 0; while (!is_stopped_.load()) { uint64_t plus_time_ns = loop_num * loop_time_ns; auto itr = record_viewer->begin(); auto itr_end = record_viewer->end(); while (itr != itr_end && !is_stopped_.load()) { while (!is_stopped_.load() && task_buffer_->Size() > preload_size) { std::this_thread::sleep_for( std::chrono::nanoseconds(avg_interval_time_ns)); } for (; itr != itr_end && !is_stopped_.load(); ++itr) { if (task_buffer_->Size() > preload_size) { break; } auto search = writers_.find(itr->channel_name); if (search == writers_.end()) { continue; } auto raw_msg = std::make_shared<message::RawMessage>(itr->content); auto task = std::make_shared<PlayTask>( raw_msg, search->second, itr->time, itr->time + plus_time_ns); task_buffer_->Push(task); } } if (!play_param_.is_loop_playback) { is_stopped_.store(true); break; } ++loop_num; } } } // namespace record } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/play_param.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_PARAM_H_ #define CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_PARAM_H_ #include <cstdint> #include <limits> #include <set> #include <string> namespace apollo { namespace cyber { namespace record { struct PlayParam { bool is_play_all_channels = false; bool is_loop_playback = false; double play_rate = 1.0; uint64_t begin_time_ns = 0; uint64_t end_time_ns = std::numeric_limits<uint64_t>::max(); uint64_t start_time_s = 0; uint64_t delay_time_s = 0; uint32_t preload_time_s = 3; std::set<std::string> files_to_play; std::set<std::string> channels_to_play; std::set<std::string> black_channels; }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_PARAM_H_
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/play_task_producer.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_PRODUCER_H_ #define CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_PRODUCER_H_ #include <atomic> #include <cstdint> #include <map> #include <memory> #include <mutex> #include <string> #include <thread> #include <unordered_map> #include <vector> #include "cyber/message/raw_message.h" #include "cyber/node/node.h" #include "cyber/node/writer.h" #include "cyber/record/record_reader.h" #include "cyber/tools/cyber_recorder/player/play_param.h" #include "cyber/tools/cyber_recorder/player/play_task_buffer.h" namespace apollo { namespace cyber { namespace record { class PlayTaskProducer { public: using NodePtr = std::shared_ptr<Node>; using ThreadPtr = std::unique_ptr<std::thread>; using TaskBufferPtr = std::shared_ptr<PlayTaskBuffer>; using RecordReaderPtr = std::shared_ptr<RecordReader>; using WriterPtr = std::shared_ptr<Writer<message::RawMessage>>; using WriterMap = std::unordered_map<std::string, WriterPtr>; using MessageTypeMap = std::unordered_map<std::string, std::string>; PlayTaskProducer(const TaskBufferPtr& task_buffer, const PlayParam& play_param); virtual ~PlayTaskProducer(); bool Init(); void Start(); void Stop(); const PlayParam& play_param() const { return play_param_; } bool is_stopped() const { return is_stopped_.load(); } private: bool ReadRecordInfo(); bool UpdatePlayParam(); bool CreateWriters(); void ThreadFunc(); PlayParam play_param_; TaskBufferPtr task_buffer_; ThreadPtr produce_th_; std::atomic<bool> is_initialized_; std::atomic<bool> is_stopped_; NodePtr node_; WriterMap writers_; MessageTypeMap msg_types_; std::vector<RecordReaderPtr> record_readers_; uint64_t earliest_begin_time_; uint64_t latest_end_time_; uint64_t total_msg_num_; static const uint32_t kMinTaskBufferSize; static const uint32_t kPreloadTimeSec; static const uint64_t kSleepIntervalNanoSec; }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_PRODUCER_H_
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/play_task.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_recorder/player/play_task.h" #include "cyber/common/log.h" namespace apollo { namespace cyber { namespace record { std::atomic<uint64_t> PlayTask::played_msg_num_ = {0}; PlayTask::PlayTask(const MessagePtr& msg, const WriterPtr& writer, uint64_t msg_real_time_ns, uint64_t msg_play_time_ns) : msg_(msg), writer_(writer), msg_real_time_ns_(msg_real_time_ns), msg_play_time_ns_(msg_play_time_ns) {} void PlayTask::Play() { if (writer_ == nullptr) { AERROR << "writer is nullptr, can't write message."; return; } if (!writer_->Write(msg_)) { AERROR << "write message failed, played num: " << played_msg_num_.load() << ", real time: " << msg_real_time_ns_ << ", play time: " << msg_play_time_ns_; return; } played_msg_num_.fetch_add(1); ADEBUG << "write message succ, played num: " << played_msg_num_.load() << ", real time: " << msg_real_time_ns_ << ", play time: " << msg_play_time_ns_; } } // namespace record } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/player.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_recorder/player/player.h" #include <termios.h> #include "cyber/init.h" namespace apollo { namespace cyber { namespace record { const uint64_t Player::kSleepIntervalMiliSec = 100; Player::Player(const PlayParam& play_param) : is_initialized_(false), is_stopped_(true), consumer_(nullptr), producer_(nullptr), task_buffer_(nullptr) { task_buffer_ = std::make_shared<PlayTaskBuffer>(); consumer_.reset(new PlayTaskConsumer(task_buffer_, play_param.play_rate)); producer_.reset(new PlayTaskProducer(task_buffer_, play_param)); } Player::~Player() { Stop(); } bool Player::Init() { if (is_initialized_.exchange(true)) { AERROR << "player has been initialized."; return false; } if (producer_->Init()) { return true; } is_initialized_.store(false); return false; } static char Getch() { char buf = 0; struct termios old = {0}; fflush(stdout); if (tcgetattr(0, &old) < 0) { perror("tcsetattr()"); } old.c_lflag &= ~ICANON; old.c_lflag &= ~ECHO; old.c_cc[VMIN] = 0; old.c_cc[VTIME] = 1; if (tcsetattr(0, TCSANOW, &old) < 0) { perror("tcsetattr ICANON"); } if (read(0, &buf, 1) < 0) { perror("read()"); } old.c_lflag |= ICANON; old.c_lflag |= ECHO; if (tcsetattr(0, TCSADRAIN, &old) < 0) { perror("tcsetattr ~ICANON"); } return buf; } void Player::ThreadFunc_Term() { while (!is_stopped_.load()) { char ch = Getch(); switch (ch) { case 's': is_playonce_ = true; break; case ' ': is_paused_ = !is_paused_; break; default: break; } } } bool Player::Start() { if (!is_initialized_.load()) { AERROR << "please call Init firstly."; return false; } if (!is_stopped_.exchange(false)) { AERROR << "player has been stopped."; return false; } auto& play_param = producer_->play_param(); std::cout << "\nPlease wait " << play_param.preload_time_s << " second(s) for loading...\n" << "Hit Ctrl+C to stop, Space to pause, or 's' to step.\n" << std::endl; producer_->Start(); auto preload_sec = play_param.preload_time_s; while (preload_sec > 0 && !is_stopped_.load() && apollo::cyber::OK()) { std::this_thread::sleep_for(std::chrono::seconds(1)); --preload_sec; } auto delay_sec = play_param.delay_time_s; while (delay_sec > 0 && !is_stopped_.load() && apollo::cyber::OK()) { std::this_thread::sleep_for(std::chrono::seconds(1)); --delay_sec; } consumer_->Start(play_param.begin_time_ns); std::ios::fmtflags before(std::cout.flags()); std::cout << std::fixed; const double total_progress_time_s = static_cast<double>(play_param.end_time_ns - play_param.begin_time_ns) / 1e9 + static_cast<double>(play_param.start_time_s); term_thread_.reset(new std::thread(&Player::ThreadFunc_Term, this)); while (!is_stopped_.load() && apollo::cyber::OK()) { if (is_playonce_) { consumer_->PlayOnce(); is_playonce_ = false; } if (is_paused_) { consumer_->Pause(); std::cout << "\r[PAUSED ] Record Time: "; } else { consumer_->Continue(); std::cout << "\r[RUNNING] Record Time: "; } double last_played_msg_real_time_s = static_cast<double>(consumer_->last_played_msg_real_time_ns()) / 1e9; double progress_time_s = static_cast<double>(producer_->play_param().start_time_s); if (consumer_->last_played_msg_real_time_ns() > 0) { progress_time_s += static_cast<double>(consumer_->last_played_msg_real_time_ns() - consumer_->base_msg_play_time_ns() + consumer_->base_msg_real_time_ns() - producer_->play_param().begin_time_ns) / 1e9; } std::cout << std::setprecision(3) << last_played_msg_real_time_s << " Progress: " << progress_time_s << " / " << total_progress_time_s; std::cout.flush(); if (producer_->is_stopped() && task_buffer_->Empty()) { consumer_->Stop(); break; } std::this_thread::sleep_for( std::chrono::milliseconds(kSleepIntervalMiliSec)); } std::cout << "\nplay finished." << std::endl; std::cout.flags(before); return true; } bool Player::Stop() { if (is_stopped_.exchange(true)) { return false; } producer_->Stop(); consumer_->Stop(); if (term_thread_ != nullptr && term_thread_->joinable()) { term_thread_->join(); term_thread_ = nullptr; } return true; } } // namespace record } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/play_task.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_H_ #define CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_H_ #include <atomic> #include <cstdint> #include <memory> #include "cyber/message/raw_message.h" #include "cyber/node/writer.h" namespace apollo { namespace cyber { namespace record { class PlayTask { public: using MessagePtr = std::shared_ptr<message::RawMessage>; using WriterPtr = std::shared_ptr<Writer<message::RawMessage>>; PlayTask(const MessagePtr& msg, const WriterPtr& writer, uint64_t msg_real_time_ns, uint64_t msg_play_time_ns); virtual ~PlayTask() {} void Play(); uint64_t msg_real_time_ns() const { return msg_real_time_ns_; } uint64_t msg_play_time_ns() const { return msg_play_time_ns_; } static uint64_t played_msg_num() { return played_msg_num_.load(); } private: MessagePtr msg_; WriterPtr writer_; uint64_t msg_real_time_ns_; uint64_t msg_play_time_ns_; static std::atomic<uint64_t> played_msg_num_; }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_H_
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/player.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAYER_H_ #define CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAYER_H_ #include <atomic> #include <memory> #include <thread> #include "cyber/tools/cyber_recorder/player/play_param.h" #include "cyber/tools/cyber_recorder/player/play_task_buffer.h" #include "cyber/tools/cyber_recorder/player/play_task_consumer.h" #include "cyber/tools/cyber_recorder/player/play_task_producer.h" namespace apollo { namespace cyber { namespace record { class Player { public: using ConsumerPtr = std::unique_ptr<PlayTaskConsumer>; using ProducerPtr = std::unique_ptr<PlayTaskProducer>; using TaskBufferPtr = std::shared_ptr<PlayTaskBuffer>; explicit Player(const PlayParam& play_param); virtual ~Player(); bool Init(); bool Start(); bool Stop(); private: void ThreadFunc_Term(); private: std::atomic<bool> is_initialized_ = {false}; std::atomic<bool> is_stopped_ = {false}; std::atomic<bool> is_paused_ = {false}; std::atomic<bool> is_playonce_ = {false}; ConsumerPtr consumer_; ProducerPtr producer_; TaskBufferPtr task_buffer_; std::shared_ptr<std::thread> term_thread_ = nullptr; static const uint64_t kSleepIntervalMiliSec; }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAYER_H_
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/play_task_buffer.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_BUFFER_H_ #define CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_BUFFER_H_ #include <cstdint> #include <map> #include <memory> #include <mutex> #include "cyber/tools/cyber_recorder/player/play_task.h" namespace apollo { namespace cyber { namespace record { class PlayTaskBuffer { public: using TaskPtr = std::shared_ptr<PlayTask>; // if all tasks are in order, we can use other container to replace this using TaskMap = std::multimap<uint64_t, TaskPtr>; PlayTaskBuffer(); virtual ~PlayTaskBuffer(); size_t Size() const; bool Empty() const; void Push(const TaskPtr& task); TaskPtr Front(); void PopFront(); private: TaskMap tasks_; mutable std::mutex mutex_; }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_BUFFER_H_
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/play_task_buffer.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_recorder/player/play_task_buffer.h" #include <utility> namespace apollo { namespace cyber { namespace record { PlayTaskBuffer::PlayTaskBuffer() {} PlayTaskBuffer::~PlayTaskBuffer() { tasks_.clear(); } size_t PlayTaskBuffer::Size() const { std::lock_guard<std::mutex> lck(mutex_); return tasks_.size(); } bool PlayTaskBuffer::Empty() const { std::lock_guard<std::mutex> lck(mutex_); return tasks_.empty(); } void PlayTaskBuffer::Push(const TaskPtr& task) { if (task == nullptr) { return; } std::lock_guard<std::mutex> lck(mutex_); tasks_.insert(std::make_pair(task->msg_play_time_ns(), task)); } PlayTaskBuffer::TaskPtr PlayTaskBuffer::Front() { std::lock_guard<std::mutex> lck(mutex_); if (tasks_.empty()) { return nullptr; } auto res = tasks_.begin()->second; return res; } void PlayTaskBuffer::PopFront() { std::lock_guard<std::mutex> lck(mutex_); if (!tasks_.empty()) { tasks_.erase(tasks_.begin()); } } } // namespace record } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/play_task_consumer.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_CONSUMER_H_ #define CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_CONSUMER_H_ #include <atomic> #include <cstdint> #include <memory> #include <thread> #include "cyber/tools/cyber_recorder/player/play_task_buffer.h" namespace apollo { namespace cyber { namespace record { class PlayTaskConsumer { public: using ThreadPtr = std::unique_ptr<std::thread>; using TaskBufferPtr = std::shared_ptr<PlayTaskBuffer>; explicit PlayTaskConsumer(const TaskBufferPtr& task_buffer, double play_rate = 1.0); virtual ~PlayTaskConsumer(); void Start(uint64_t begin_time_ns); void Stop(); void Pause() { is_paused_.exchange(true); } void PlayOnce() { is_playonce_.exchange(true); } void Continue() { is_paused_.exchange(false); } uint64_t base_msg_play_time_ns() const { return base_msg_play_time_ns_; } uint64_t base_msg_real_time_ns() const { return base_msg_real_time_ns_; } uint64_t last_played_msg_real_time_ns() const { return last_played_msg_real_time_ns_; } private: void ThreadFunc(); double play_rate_; ThreadPtr consume_th_; TaskBufferPtr task_buffer_; std::atomic<bool> is_stopped_; std::atomic<bool> is_paused_; std::atomic<bool> is_playonce_; uint64_t begin_time_ns_; uint64_t base_msg_play_time_ns_; uint64_t base_msg_real_time_ns_; uint64_t last_played_msg_real_time_ns_; static const uint64_t kPauseSleepNanoSec; static const uint64_t kWaitProduceSleepNanoSec; static const uint64_t MIN_SLEEP_DURATION_NS; }; } // namespace record } // namespace cyber } // namespace apollo #endif // CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_CONSUMER_H_
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/BUILD
load("@rules_cc//cc:defs.bzl", "cc_library") load("//tools:cpplint.bzl", "cpplint") package(default_visibility = ["//visibility:public"]) cc_library( name = "play_param", hdrs = ["play_param.h"], ) cc_library( name = "play_task", srcs = ["play_task.cc"], hdrs = ["play_task.h"], deps = [ "//cyber/common:log", "//cyber/message:raw_message", "//cyber/node:writer", ], ) cc_library( name = "play_task_buffer", srcs = ["play_task_buffer.cc"], hdrs = ["play_task_buffer.h"], deps = [ ":play_task", ], ) cc_library( name = "play_task_consumer", srcs = ["play_task_consumer.cc"], hdrs = ["play_task_consumer.h"], deps = [ ":play_task_buffer", "//cyber/common:log", "//cyber/time", ], ) cc_library( name = "play_task_producer", srcs = ["play_task_producer.cc"], hdrs = ["play_task_producer.h"], deps = [ ":play_param", ":play_task_buffer", "//cyber", "//cyber/common:log", "//cyber/message:protobuf_factory", "//cyber/message:raw_message", "//cyber/node", "//cyber/node:writer", "//cyber/record:record_reader", "//cyber/record:record_viewer", ], ) cc_library( name = "player", srcs = ["player.cc"], hdrs = ["player.h"], deps = [ ":play_param", ":play_task_buffer", ":play_task_consumer", ":play_task_producer", "//cyber:init", ], ) cpplint()
0
apollo_public_repos/apollo/cyber/tools/cyber_recorder
apollo_public_repos/apollo/cyber/tools/cyber_recorder/player/play_task_consumer.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_recorder/player/play_task_consumer.h" #include "cyber/common/log.h" #include "cyber/time/time.h" namespace apollo { namespace cyber { namespace record { const uint64_t PlayTaskConsumer::kPauseSleepNanoSec = 100000000UL; const uint64_t PlayTaskConsumer::kWaitProduceSleepNanoSec = 5000000UL; const uint64_t PlayTaskConsumer::MIN_SLEEP_DURATION_NS = 200000000UL; PlayTaskConsumer::PlayTaskConsumer(const TaskBufferPtr& task_buffer, double play_rate) : play_rate_(play_rate), consume_th_(nullptr), task_buffer_(task_buffer), is_stopped_(true), is_paused_(false), is_playonce_(false), base_msg_play_time_ns_(0), base_msg_real_time_ns_(0), last_played_msg_real_time_ns_(0) { if (play_rate_ <= 0) { AERROR << "invalid play rate: " << play_rate_ << " , we will use default value(1.0)."; play_rate_ = 1.0; } } PlayTaskConsumer::~PlayTaskConsumer() { Stop(); } void PlayTaskConsumer::Start(uint64_t begin_time_ns) { if (!is_stopped_.exchange(false)) { return; } begin_time_ns_ = begin_time_ns; consume_th_.reset(new std::thread(&PlayTaskConsumer::ThreadFunc, this)); } void PlayTaskConsumer::Stop() { if (is_stopped_.exchange(true)) { return; } if (consume_th_ != nullptr && consume_th_->joinable()) { consume_th_->join(); consume_th_ = nullptr; } } void PlayTaskConsumer::ThreadFunc() { uint64_t base_real_time_ns = 0; uint64_t accumulated_pause_time_ns = 0; while (!is_stopped_.load()) { auto task = task_buffer_->Front(); if (task == nullptr) { std::this_thread::sleep_for( std::chrono::nanoseconds(kWaitProduceSleepNanoSec)); continue; } uint64_t sleep_ns = 0; if (base_msg_play_time_ns_ == 0) { base_msg_play_time_ns_ = task->msg_play_time_ns(); base_msg_real_time_ns_ = task->msg_real_time_ns(); if (base_msg_play_time_ns_ > begin_time_ns_) { sleep_ns = static_cast<uint64_t>( static_cast<double>(base_msg_play_time_ns_ - begin_time_ns_) / play_rate_); while (sleep_ns > MIN_SLEEP_DURATION_NS && !is_stopped_.load()) { std::this_thread::sleep_for( std::chrono::nanoseconds(MIN_SLEEP_DURATION_NS)); sleep_ns -= MIN_SLEEP_DURATION_NS; } if (is_stopped_.load()) { break; } std::this_thread::sleep_for(std::chrono::nanoseconds(sleep_ns)); } base_real_time_ns = Time::Now().ToNanosecond(); ADEBUG << "base_msg_play_time_ns: " << base_msg_play_time_ns_ << "base_real_time_ns: " << base_real_time_ns; } uint64_t task_interval_ns = static_cast<uint64_t>( static_cast<double>(task->msg_play_time_ns() - base_msg_play_time_ns_) / play_rate_); uint64_t real_time_interval_ns = Time::Now().ToNanosecond() - base_real_time_ns - accumulated_pause_time_ns; if (task_interval_ns > real_time_interval_ns) { sleep_ns = task_interval_ns - real_time_interval_ns; std::this_thread::sleep_for(std::chrono::nanoseconds(sleep_ns)); } task->Play(); is_playonce_.store(false); last_played_msg_real_time_ns_ = task->msg_real_time_ns(); while (is_paused_.load() && !is_stopped_.load()) { if (is_playonce_.load()) { break; } std::this_thread::sleep_for(std::chrono::nanoseconds(kPauseSleepNanoSec)); accumulated_pause_time_ns += kPauseSleepNanoSec; } task_buffer_->PopFront(); } } } // namespace record } // namespace cyber } // namespace apollo
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_channel/BUILD
load("@rules_python//python:defs.bzl", "py_binary") load("//tools/install:install.bzl", "install") package( default_visibility = ["//visibility:public"], ) py_binary( name = "cyber_channel", srcs = ["cyber_channel.py"], deps = [ "//cyber/proto:role_attributes_py_pb2", "//cyber/python/cyber_py3:cyber", "//cyber/python/cyber_py3:cyber_time", ], ) install( name = "install", py_dest = "cyber/bin", targets = [":cyber_channel"] )
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_channel/cyber_channel.py
#!/usr/bin/env python3 # **************************************************************************** # 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. # **************************************************************************** import math import os import sys import time from cyber.python.cyber_py3 import cyber_time from cyber.python.cyber_py3 import cyber def print_channel_type(channel_name): msgtype = cyber.ChannelUtils.get_msgtype(channel_name) print(channel_name, " type is [", msgtype, "]") def _channel_cmd_type(argv): """ Command-line parsing for 'cyber_channel type channelname' command. """ args = argv[2:] from optparse import OptionParser parser = OptionParser( usage="usage: cyber_channel type channelname") (options, args) = parser.parse_args(args) if len(args) > 1: parser.error("you may only specify one input channel") elif len(args) == 0: parser.error("channelname must be specified") print_channel_type(args[0]) class CyberChannelBw(object): def __init__(self, window_size=100): import threading self.lock = threading.Lock() self.sizes = [] self.times = [] self.window_size = window_size if window_size <= 0 or window_size > 50000: self.window_size = 100 print("bw window_size: ", self.window_size) def callback_bw(self, rawdata): with self.lock: t = time.time() self.times.append(t) self.sizes.append(len(rawdata)) assert(len(self.times) == len(self.sizes)) if len(self.times) > self.window_size: self.times.pop(0) self.sizes.pop(0) def print_bw(self): if len(self.times) < 2: return with self.lock: n = len(self.times) tn = time.time() t0 = self.times[0] total = sum(self.sizes) bytes_per_s = total / (tn - t0) mean = total / n max_s = max(self.sizes) min_s = min(self.sizes) if bytes_per_s < 1000: bw, mean, min_s, max_s = [ "%.2fB" % v for v in [bytes_per_s, mean, min_s, max_s]] elif bytes_per_s < 1000000: bw, mean, min_s, max_s = ["%.2fKB" % (v / 1000) for v in [bytes_per_s, mean, min_s, max_s]] else: bw, mean, min_s, max_s = ["%.2fMB" % (v / 1000000) for v in [bytes_per_s, mean, min_s, max_s]] print("average: %s/s\n\tmean: %s min: %s max: %s window: %s" % (bw, mean, min_s, max_s, n)) def channel_bw(channel_name, window_size): rt = CyberChannelBw(window_size) node_bw = cyber.Node("listener_node_bw") node_bw.create_rawdata_reader(channel_name, rt.callback_bw) print("reader to [%s]" % channel_name) while not cyber.is_shutdown(): time.sleep(1.0) rt.print_bw() def _channel_cmd_bw(argv): """ Command-line parsing for 'cyber_channel bw' command. """ args = argv[2:] from optparse import OptionParser parser = OptionParser( usage="usage: cyber_channel bw channelname") parser.add_option("-w", "--window", dest="window_size", default=-1, help="window size for calculating rate, max size is 50000") channel_name = "" (options, args) = parser.parse_args(args) if len(args) == 0: parser.error("channelname must be specified") if len(args) == 1: channel_name = args[0] if len(args) > 1: parser.error("param is too much") try: if options.window_size != -1: import string window_size = string.atoi(options.window_size) else: window_size = options.window_size except: parser.error("window size must be an integer") channel_bw(channel_name, window_size) class CyberChannelHz(object): """ CyberChannelHz receives messages for a topic and computes frequency stats """ def __init__(self, window_size): import threading self.lock = threading.Lock() self.last_printed_tn = 0 self.msg_t0 = -1. self.msg_tn = 0 self.times = [] if window_size <= 0 or window_size > 50000: window_size = 50000 self.window_size = window_size print("hz window_size: ", window_size) def callback_hz(self, m): with self.lock: curr_time = cyber_time.Time.now().to_sec() if curr_time == 0: if len(self.times) > 0: print("reset times.") self.times = [] return if self.msg_t0 < 0 or self.msg_t0 > curr_time: self.msg_t0 = curr_time self.msg_tn = curr_time self.times = [] else: self.times.append(curr_time - self.msg_tn) self.msg_tn = curr_time if len(self.times) > self.window_size - 1: self.times.pop(0) def print_hz(self): """ print the average publishing rate to screen """ if not self.times: return elif self.msg_tn == self.last_printed_tn: print("no new messages") return with self.lock: n = len(self.times) mean = sum(self.times) / n rate = 1. / mean if mean > 0. else 0 std_dev = math.sqrt(sum((x - mean) ** 2 for x in self.times) / n) max_delta = max(self.times) min_delta = min(self.times) self.last_printed_tn = self.msg_tn print("average rate: %.3f\n\tmin: %.3fs max: %.3fs std dev: %.5fs window: %s" % (rate, min_delta, max_delta, std_dev, n + 1)) def channel_hz(channel_name, window_size): rt = CyberChannelHz(window_size) node_hz = cyber.Node("listener_node_hz") node_hz.create_rawdata_reader(channel_name, rt.callback_hz) print("reader to [%s]" % channel_name) while not cyber.is_shutdown(): time.sleep(1.0) rt.print_hz() def _channel_cmd_hz(argv): """ Command-line parsing for 'cyber_channel hz' command. """ args = argv[2:] from optparse import OptionParser parser = OptionParser( usage="usage: cyber_channel hz channelname") parser.add_option("-w", "--window", dest="window_size", default=-1, help="window size for calculating rate, max size is 50000") channel_name = "" (options, args) = parser.parse_args(args) if len(args) == 0: parser.error("channelname must be specified") if len(args) == 1: channel_name = args[0] if len(args) > 1: parser.error("param is too much") # check string try: if options.window_size != -1: import string window_size = string.atoi(options.window_size) else: window_size = options.window_size except: parser.error("window size must be an integer") channel_hz(channel_name, window_size) def print_role(rolsattr_rawdata): from google.protobuf.message import DecodeError from cyber.proto.role_attributes_pb2 import RoleAttributes try: msg = RoleAttributes() msg.ParseFromString(rolsattr_rawdata) except DecodeError: print("RoleAttributes ParseFromString failed. size is ", len(rolsattr_rawdata)) return print("\troleid\t\t", msg.id) print("\thostname\t", msg.host_name) print("\tprocessid\t", msg.process_id) print("\tnodename\t", msg.node_name) print("\tmsgtype\t\t", msg.message_type) def channel_info(channel_name): channlesinfo_dict = cyber.ChannelUtils.get_channels_info() time.sleep(1) if len(channlesinfo_dict) == 0: print("channelsinfo dict is null") return # for key in channlesinfo_dict.keys(): # print key if channel_name != "": print(channel_name) for role_data in channlesinfo_dict[channel_name]: print_role(role_data) else: channels = sorted(channlesinfo_dict.keys()) print("The number of channels is: ", len(channels)) for channel in channels: print(channel) for role_data in channlesinfo_dict[channel]: print_role(role_data) def _channel_cmd_info(argv): """ Command-line parsing for 'cyber_channel info' command. """ args = argv[2:] from optparse import OptionParser parser = OptionParser( usage="usage: cyber_channel info channelname ") parser.add_option("-a", "--all", dest="all_channels", default=False, action="store_true", help="display all channels info") (options, args) = parser.parse_args(args) if len(args) == 0 and not options.all_channels: parser.error("channelname must be specified") elif len(args) > 1: parser.error("you may only specify one topic name") elif len(args) == 1: channel_info(args[0]) elif len(args) == 0 and options.all_channels: channel_info("") def print_channel_list(): channels = sorted(cyber.ChannelUtils.get_channels()) print("The number of channels is: ", len(channels)) for channel in channels: print(channel) def _channel_cmd_list(argv): """ Command-line parsing for 'cyber_channel list' command. """ args = argv[2:] from optparse import OptionParser parser = OptionParser( usage="usage: cyber_channel list") (options, args) = parser.parse_args(args) if len(args) > 0: parser.error("param is too much") print_channel_list() class CyberChannelecho(object): def __init__(self, channel_name): self.channel_name = channel_name def callback(self, raw_data): """ Channel echo callback. """ # pass # print "py:reader callback raw_data->:" # print type(raw_data) # str # print raw_data # str msgtype = cyber.ChannelUtils.get_msgtype(self.channel_name, 0).decode('utf-8') print(cyber.ChannelUtils.get_debugstring_rawmsgdata(msgtype, raw_data).decode('utf-8')) def channel_echo(channel_name): """ Reader message. """ node_echo = cyber.Node("listener_node_echo") echo_cb = CyberChannelecho(channel_name) node_echo.create_rawdata_reader(channel_name, echo_cb.callback) while not cyber.is_shutdown(): pass def _channel_cmd_echo(argv): """ Command-line parsing for 'cyber_channel echo' command. """ args = argv[2:] from optparse import OptionParser parser = OptionParser( usage="usage: cyber_channel echo channelname") (options, args) = parser.parse_args(args) if len(args) > 1: parser.error("you may only specify one input channel") elif len(args) == 0: parser.error("channelname must be specified") channel_echo(args[0]) def _printallusage(): print("""cyber_channel is a command-line tool for printing information about CyberRT Channels. Commands: \tcyber_channel list\tlist active channels \tcyber_channel info\tprint information about active channel \tcyber_channel echo\tprint messages to screen \tcyber_channel hz\tdisplay publishing rate of channel \tcyber_channel bw\tdisplay bandwidth used by channel \tcyber_channel type\tprint channel type Type cyber_channel <command> -h for more detailed usage, e.g. 'cyber_channel echo -h' """) sys.exit(getattr(os, 'EX_USAGE', 1)) if __name__ == '__main__': if len(sys.argv) == 1: _printallusage() cyber.init() argv = sys.argv[0:] command = argv[1] if command == 'list': _channel_cmd_list(argv) elif command == 'info': _channel_cmd_info(argv) elif command == 'echo': _channel_cmd_echo(argv) elif command == 'hz': _channel_cmd_hz(argv) elif command == 'bw': _channel_cmd_bw(argv) elif command == 'type': _channel_cmd_type(argv) else: _printallusage() cyber.shutdown()
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_node/cyber_node.py
#!/usr/bin/env python3 # **************************************************************************** # 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. # **************************************************************************** import os import sys from optparse import OptionParser from cyber.python.cyber_py3 import cyber from cyber.proto.role_attributes_pb2 import RoleAttributes def print_node_info(node_name, sleep_s=2): raw_data = cyber.NodeUtils.get_node_attr(node_name, sleep_s) try: msg = RoleAttributes() msg.ParseFromString(raw_data) assert(node_name == msg.node_name) except: print("RoleAttributes ParseFromString failed. size is ", len(raw_data)) return print("Node: \t%s" % msg.node_name) print("ProcessId: \t%d" % msg.process_id) print("Hostname:\t%s" % msg.host_name) print("[Reading Channels]:") reading_channels = sorted(cyber.NodeUtils.get_readersofnode(node_name, 0)) for channel in reading_channels: print(channel) print("") print("[Writing Channels]:") writing_channels = sorted(cyber.NodeUtils.get_writersofnode(node_name, 0)) for channel in writing_channels: print(channel) print("") def _node_cmd_info(argv): """ Command-line parsing for 'cyber_node info' command. """ args = argv[2:] parser = OptionParser( usage="usage: cyber_node info [OPTION...] [NODE...]") parser.add_option("-a", "--all", dest="all_nodes", default=False, action="store_true", help="display all nodes' info") (options, args) = parser.parse_args(args) if options.all_nodes: if len(args) != 0: parser.error( """"-a/--all" option is expected to run w/o node name(s)""") else: nodes = cyber.NodeUtils.get_nodes() for nodename in nodes: print_node_info(nodename, 0) elif len(args) == 0: parser.error("No node name provided.") else: for arg in args: print_node_info(arg) def print_node_list(): nodes = cyber.NodeUtils.get_nodes() print("Number of active nodes: {}".format(len(nodes))) for node_name in sorted(nodes): print(node_name) def _node_cmd_list(argv): """ Command-line parsing for 'cyber_node list' """ args = argv[2:] parser = OptionParser(usage="usage: cyber_node list") (options, args) = parser.parse_args(args) if len(args) > 0: parser.error("too many arguments") print_node_list() def _usage(): print("""cyber_node is a command-line tool to show information about CyberRT Nodes. Commands: \tcyber_node list \tList active nodes. \tcyber_node info \tPrint node info. Type cyber_node <command> -h for more detailed usage, e.g. 'cyber_node info -h' """) sys.exit(getattr(os, "EX_USAGE", 1)) if __name__ == '__main__': if len(sys.argv) == 1: _usage() cyber.init() argv = sys.argv[0:] command = argv[1] if command == "list": _node_cmd_list(argv) elif command == "info": _node_cmd_info(argv) else: _usage() cyber.shutdown()
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_node/BUILD
load("@rules_python//python:defs.bzl", "py_binary") load("//tools/install:install.bzl", "install") package( default_visibility = ["//visibility:public"], ) py_binary( name = "cyber_node", srcs = ["cyber_node.py"], deps = [ "//cyber/python/cyber_py3:cyber", "//cyber/proto:role_attributes_py_pb2" ], ) install( name = "install", py_dest = "cyber/bin", targets = [":cyber_node"] )
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/main.cc
/****************************************************************************** * 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. *****************************************************************************/ #include <csignal> #include <iostream> #include "cyber/init.h" #include "cyber/service_discovery/topology_manager.h" #include "cyber/tools/cyber_monitor/cyber_topology_message.h" #include "cyber/tools/cyber_monitor/general_channel_message.h" #include "cyber/tools/cyber_monitor/screen.h" namespace { void SigResizeHandle(int) { Screen::Instance()->Resize(); } void SigCtrlCHandle(int) { Screen::Instance()->Stop(); } void printHelp(const char *cmd_name) { std::cout << "Usage:\n" << cmd_name << " [option]\nOption:\n" << " -h print help info\n" << " -c specify one channel\n" << "Interactive Command:\n" << Screen::InteractiveCmdStr << std::endl; } enum COMMAND { TOO_MANY_PARAMETER, HELP, // 2 NO_OPTION, // 1 CHANNEL // 3 -> 4 }; COMMAND ParseOption(int argc, char *const argv[], std::string *command_val) { if (argc > 4) { return TOO_MANY_PARAMETER; } int index = 1; while (true) { const char *opt = argv[index]; if (opt == nullptr) { break; } if (strcmp(opt, "-h") == 0) { return HELP; } if (strcmp(opt, "-c") == 0) { if (argv[index + 1]) { *command_val = argv[index + 1]; return CHANNEL; } } ++index; } return NO_OPTION; } } // namespace int main(int argc, char *argv[]) { std::string val; COMMAND com = ParseOption(argc, argv, &val); switch (com) { case TOO_MANY_PARAMETER: std::cout << "Too many paramtes\n"; case HELP: printHelp(argv[0]); return 0; default: { } } apollo::cyber::Init(argv[0]); FLAGS_minloglevel = 3; FLAGS_alsologtostderr = 0; FLAGS_colorlogtostderr = 0; CyberTopologyMessage topology_msg(val); auto topology_callback = [&topology_msg](const apollo::cyber::proto::ChangeMsg &change_msg) { topology_msg.TopologyChanged(change_msg); }; auto channel_manager = apollo::cyber::service_discovery::TopologyManager::Instance() ->channel_manager(); channel_manager->AddChangeListener(topology_callback); std::vector<apollo::cyber::proto::RoleAttributes> role_vec; channel_manager->GetWriters(&role_vec); for (auto &role : role_vec) { topology_msg.AddReaderWriter(role, true); } role_vec.clear(); channel_manager->GetReaders(&role_vec); for (auto &role : role_vec) { topology_msg.AddReaderWriter(role, false); } Screen *s = Screen::Instance(); signal(SIGWINCH, SigResizeHandle); signal(SIGINT, SigCtrlCHandle); s->SetCurrentRenderMessage(&topology_msg); s->Init(); s->Run(); return 0; }
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/cyber_topology_message.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_monitor/cyber_topology_message.h" #include <iomanip> #include <iostream> #include "cyber/proto/role_attributes.pb.h" #include "cyber/proto/topology_change.pb.h" #include "cyber/message/message_traits.h" #include "cyber/tools/cyber_monitor/general_channel_message.h" #include "cyber/tools/cyber_monitor/screen.h" constexpr int SecondColumnOffset = 4; CyberTopologyMessage::CyberTopologyMessage(const std::string& channel) : RenderableMessage(nullptr, 1), second_column_(SecondColumnType::MessageFrameRatio), pid_(getpid()), col1_width_(8), specified_channel_(channel), all_channels_map_() {} CyberTopologyMessage::~CyberTopologyMessage(void) { for (auto item : all_channels_map_) { if (!GeneralChannelMessage::IsErrorCode(item.second)) { delete item.second; } } } bool CyberTopologyMessage::IsFromHere(const std::string& node_name) { std::ostringstream out_str; out_str << "MonitorReader" << pid_; std::string templateName = out_str.str(); const std::string baseName = node_name.substr(0, templateName.size()); return (templateName.compare(baseName) == 0); } RenderableMessage* CyberTopologyMessage::Child(int line_no) const { RenderableMessage* ret = nullptr; auto iter = FindChild(line_no); if (iter != all_channels_map_.cend() && !GeneralChannelMessage::IsErrorCode(iter->second) && iter->second->is_enabled()) { ret = iter->second; } return ret; } std::map<std::string, GeneralChannelMessage*>::const_iterator CyberTopologyMessage::FindChild(int line_no) const { --line_no; std::map<std::string, GeneralChannelMessage*>::const_iterator ret = all_channels_map_.cend(); if (line_no > -1 && line_no < page_item_count_) { int i = 0; auto iter = all_channels_map_.cbegin(); while (i < page_index_ * page_item_count_) { ++iter; ++i; } for (i = 0; iter != all_channels_map_.cend(); ++iter) { if (i == line_no) { ret = iter; break; } ++i; } } return ret; } void CyberTopologyMessage::TopologyChanged( const apollo::cyber::proto::ChangeMsg& changeMsg) { if (::apollo::cyber::proto::OperateType::OPT_JOIN == changeMsg.operate_type()) { bool isWriter = true; if (::apollo::cyber::proto::RoleType::ROLE_READER == changeMsg.role_type()) isWriter = false; AddReaderWriter(changeMsg.role_attr(), isWriter); } else { auto iter = all_channels_map_.find(changeMsg.role_attr().channel_name()); if (iter != all_channels_map_.cend() && !GeneralChannelMessage::IsErrorCode(iter->second)) { const std::string& node_name = changeMsg.role_attr().node_name(); if (::apollo::cyber::proto::RoleType::ROLE_WRITER == changeMsg.role_type()) { iter->second->del_writer(node_name); } else { iter->second->del_reader(node_name); } } } } void CyberTopologyMessage::AddReaderWriter( const apollo::cyber::proto::RoleAttributes& role, bool isWriter) { const std::string& channel_name = role.channel_name(); if (!specified_channel_.empty() && specified_channel_ != channel_name) { return; } if (static_cast<int>(channel_name.length()) > col1_width_) { col1_width_ = static_cast<int>(channel_name.length()); } const std::string& node_name = role.node_name(); if (IsFromHere(node_name)) { return; } GeneralChannelMessage* channel_msg = nullptr; const std::string& msgTypeName = role.message_type(); auto iter = all_channels_map_.find(channel_name); if (iter == all_channels_map_.cend()) { static int index = 0; std::ostringstream out_str; out_str << "MonitorReader" << pid_ << '-' << index++; channel_msg = new GeneralChannelMessage(out_str.str(), this); if (channel_msg != nullptr) { if (!GeneralChannelMessage::IsErrorCode( channel_msg->OpenChannel(channel_name))) { channel_msg->set_message_type(msgTypeName); channel_msg->add_reader(channel_msg->NodeName()); } } else { channel_msg = GeneralChannelMessage::CastErrorCode2Ptr( GeneralChannelMessage::ErrorCode::NewSubClassFailed); } all_channels_map_[channel_name] = channel_msg; } else { channel_msg = iter->second; } if (!GeneralChannelMessage::IsErrorCode(channel_msg)) { if (isWriter) { if (msgTypeName != apollo::cyber::message::MessageType< apollo::cyber::message::RawMessage>()) { channel_msg->set_message_type(msgTypeName); } channel_msg->add_writer(node_name); } else { channel_msg->add_reader(node_name); } } } void CyberTopologyMessage::ChangeState(const Screen* s, int key) { switch (key) { case 'f': case 'F': second_column_ = SecondColumnType::MessageFrameRatio; break; case 't': case 'T': second_column_ = SecondColumnType::MessageType; break; case ' ': { auto iter = FindChild(*line_no()); if (!GeneralChannelMessage::IsErrorCode(iter->second)) { GeneralChannelMessage* child = iter->second; if (child->is_enabled()) { child->CloseChannel(); } else { GeneralChannelMessage* ret = child->OpenChannel(iter->first); if (GeneralChannelMessage::IsErrorCode(ret)) { delete child; all_channels_map_[iter->first] = ret; } else { child->add_reader(child->NodeName()); } } } } default: { } } } int CyberTopologyMessage::Render(const Screen* s, int key) { page_item_count_ = s->Height() - 1; pages_ = static_cast<int>(all_channels_map_.size()) / page_item_count_ + 1; ChangeState(s, key); SplitPages(key); s->AddStr(0, 0, Screen::WHITE_BLACK, "Channels"); switch (second_column_) { case SecondColumnType::MessageType: s->AddStr(col1_width_ + SecondColumnOffset, 0, Screen::WHITE_BLACK, "TypeName"); break; case SecondColumnType::MessageFrameRatio: s->AddStr(col1_width_ + SecondColumnOffset, 0, Screen::WHITE_BLACK, "FrameRatio"); break; } auto iter = all_channels_map_.cbegin(); register int tmp = page_index_ * page_item_count_; register int line = 0; while (line < tmp) { ++iter; ++line; } Screen::ColorPair color; std::ostringstream out_str; tmp = page_item_count_ + 1; for (line = 1; iter != all_channels_map_.cend() && line < tmp; ++iter, ++line) { color = Screen::RED_BLACK; if (!GeneralChannelMessage::IsErrorCode(iter->second)) { if (iter->second->has_message_come()) { if (iter->second->is_enabled()) { color = Screen::GREEN_BLACK; } else { color = Screen::YELLOW_BLACK; } } } s->SetCurrentColor(color); s->AddStr(0, line, iter->first.c_str()); if (!GeneralChannelMessage::IsErrorCode(iter->second)) { switch (second_column_) { case SecondColumnType::MessageType: s->AddStr(col1_width_ + SecondColumnOffset, line, iter->second->message_type().c_str()); break; case SecondColumnType::MessageFrameRatio: { out_str.str(""); out_str << std::fixed << std::setprecision(FrameRatio_Precision) << iter->second->frame_ratio(); s->AddStr(col1_width_ + SecondColumnOffset, line, out_str.str().c_str()); } break; } } else { GeneralChannelMessage::ErrorCode errcode = GeneralChannelMessage::CastPtr2ErrorCode(iter->second); s->AddStr(col1_width_ + SecondColumnOffset, line, GeneralChannelMessage::ErrCode2Str(errcode)); } s->ClearCurrentColor(); } return line; }
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/general_message_base.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef TOOLS_CVT_MONITOR_GENERAL_MESSAGE_BASE_H_ #define TOOLS_CVT_MONITOR_GENERAL_MESSAGE_BASE_H_ #include <map> #include <utility> #include "cyber/cyber.h" #include "cyber/tools/cyber_monitor/renderable_message.h" class Screen; class GeneralMessageBase : public RenderableMessage { protected: static void PrintMessage(GeneralMessageBase* baseMsg, const google::protobuf::Message& msg, int* jump_lines, const Screen* s, int* line_no, int indent); static void PrintField(GeneralMessageBase* baseMsg, const google::protobuf::Message& msg, int* jump_lines, const Screen* s, int* line_no, int indent, const google::protobuf::Reflection* ref, const google::protobuf::FieldDescriptor* field, int index); static int LineCount(const google::protobuf::Message& msg, int screen_width); static int LineCountOfField(const google::protobuf::Message& msg, int screen_width, const google::protobuf::FieldDescriptor* field, const google::protobuf::Reflection* reflection, bool is_folded = true); void InsertRepeatedMessage(int line_no, GeneralMessageBase* item) { children_map_.emplace(line_no, item); } RenderableMessage* Child(int line_no) const override; explicit GeneralMessageBase(RenderableMessage* parent = nullptr) : RenderableMessage(parent), children_map_() {} ~GeneralMessageBase(void) { clear(); } void clear(void) { for (auto& iter : children_map_) { delete iter.second; } children_map_.clear(); } GeneralMessageBase(const GeneralMessageBase&) = delete; GeneralMessageBase& operator=(const GeneralMessageBase&) = delete; std::map<const int, GeneralMessageBase*> children_map_; }; #endif // TOOLS_CVT_MONITOR_GENERAL_MESSAGE_BASE_H_
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/renderable_message.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_monitor/renderable_message.h" #include <ncurses.h> #include "cyber/tools/cyber_monitor/screen.h" void RenderableMessage::SplitPages(int key) { switch (key) { case CTRL('d'): case KEY_NPAGE: ++page_index_; if (page_index_ >= pages_) { page_index_ = pages_ - 1; } break; case CTRL('u'): case KEY_PPAGE: --page_index_; if (page_index_ < 1) { page_index_ = 0; } break; default: { } } }
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/general_message_base.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_monitor/general_message_base.h" #include <iomanip> #include <string> #include <vector> #include "cyber/tools/cyber_monitor/general_message.h" #include "cyber/tools/cyber_monitor/screen.h" namespace { constexpr int INT_FLOAT_PRECISION = 6; constexpr int DOULBE_PRECISION = 9; int CalculateStringLines(const std::string& str, int screen_width) { int line_width = 0; int line_count = 0; for (std::size_t i = 0; i < str.size(); ++i) { if (str[i] == '\n' || str[i] == '\r') { ++line_count; line_width = 0; } else { ++line_width; if (line_width == screen_width) { ++line_count; line_width = 0; } } } if (line_width) { ++line_count; } return line_count; } } // namespace int GeneralMessageBase::LineCount(const google::protobuf::Message& msg, int screen_width) { const google::protobuf::Reflection* reflection = msg.GetReflection(); const google::protobuf::Descriptor* descriptor = msg.GetDescriptor(); std::vector<const google::protobuf::FieldDescriptor*> fields; if (descriptor->options().map_entry()) { fields.push_back(descriptor->field(0)); fields.push_back(descriptor->field(1)); } else { reflection->ListFields(msg, &fields); } auto fsize = fields.size(); int ret = 0; for (decltype(fsize) i = 0; i < fsize; ++i) { ret += LineCountOfField(msg, screen_width, fields[i], reflection); } return ret; } int GeneralMessageBase::LineCountOfField( const google::protobuf::Message& msg, int screen_width, const google::protobuf::FieldDescriptor* field, const google::protobuf::Reflection* reflection, bool is_folded) { int ret = 0; if (!is_folded && field->is_repeated()) { int size = reflection->FieldSize(msg, field); for (int i = 0; i < size; ++i) { switch (field->cpp_type()) { case google::protobuf::FieldDescriptor::CPPTYPE_STRING: { std::string scratch; const std::string& value = reflection->GetRepeatedStringReference(msg, field, i, &scratch); ret += CalculateStringLines(value, screen_width); break; } case google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE: { const google::protobuf::Message& child_msg = reflection->GetRepeatedMessage(msg, field, i); ret += LineCount(child_msg, screen_width); break; } default: ret += 1; } } } else { ret = 1; if (!field->is_repeated()) { switch (field->cpp_type()) { case google::protobuf::FieldDescriptor::CPPTYPE_STRING: { std::string scratch; const std::string& value = reflection->GetStringReference(msg, field, &scratch); ret += CalculateStringLines(value, screen_width); break; } case google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE: { const google::protobuf::Message& child_msg = reflection->GetMessage(msg, field); ret += LineCount(child_msg, screen_width); break; } default: { } } } } return ret; } void GeneralMessageBase::PrintMessage(GeneralMessageBase* baseMsg, const google::protobuf::Message& msg, int* jump_lines, const Screen* s, int* line_no, int indent) { const google::protobuf::Reflection* reflection = msg.GetReflection(); const google::protobuf::Descriptor* descriptor = msg.GetDescriptor(); std::vector<const google::protobuf::FieldDescriptor*> fields; if (descriptor->options().map_entry()) { fields.push_back(descriptor->field(0)); fields.push_back(descriptor->field(1)); } else { reflection->ListFields(msg, &fields); } for (std::size_t i = 0; i < fields.size(); ++i) { if (*line_no > s->Height()) { break; } const google::protobuf::FieldDescriptor* field = fields[i]; if (field->is_repeated()) { if (*jump_lines) { --(*jump_lines); } else { std::ostringstream out_str; const std::string& fieldName = field->name(); out_str << fieldName << ": "; out_str << "+[" << reflection->FieldSize(msg, field) << " items]"; GeneralMessage* item = new GeneralMessage(baseMsg, &msg, reflection, field); if (item) { baseMsg->InsertRepeatedMessage(*line_no, item); } s->AddStr(indent, (*line_no)++, out_str.str().c_str()); } } else { PrintField(baseMsg, msg, jump_lines, s, line_no, indent, reflection, field, -1); } } const google::protobuf::UnknownFieldSet& unknown_fields = reflection->GetUnknownFields(msg); if (!unknown_fields.empty()) { Screen::ColorPair c = s->Color(); s->ClearCurrentColor(); s->SetCurrentColor(Screen::RED_BLACK); s->AddStr(indent, (*line_no)++, "Have Unknown Fields"); s->ClearCurrentColor(); s->SetCurrentColor(c); } } void GeneralMessageBase::PrintField( GeneralMessageBase* baseMsg, const google::protobuf::Message& msg, int* jump_lines, const Screen* s, int* line_no, int indent, const google::protobuf::Reflection* ref, const google::protobuf::FieldDescriptor* field, int index) { std::ostringstream out_str; std::ios_base::fmtflags old_flags; switch (field->cpp_type()) { #define OUTPUT_FIELD(CPPTYPE, METHOD, PRECISION) \ case google::protobuf::FieldDescriptor::CPPTYPE_##CPPTYPE: \ if (*jump_lines) { \ --(*jump_lines); \ } else { \ const std::string& fieldName = field->name(); \ out_str << fieldName << ": "; \ if (field->is_repeated()) { \ out_str << "[" << index << "] "; \ } \ old_flags = out_str.flags(); \ out_str << std::fixed << std::setprecision(PRECISION) \ << (field->is_repeated() \ ? ref->GetRepeated##METHOD(msg, field, index) \ : ref->Get##METHOD(msg, field)); \ out_str.flags(old_flags); \ s->AddStr(indent, (*line_no)++, out_str.str().c_str()); \ } \ break OUTPUT_FIELD(INT32, Int32, INT_FLOAT_PRECISION); OUTPUT_FIELD(INT64, Int64, INT_FLOAT_PRECISION); OUTPUT_FIELD(UINT32, UInt32, INT_FLOAT_PRECISION); OUTPUT_FIELD(UINT64, UInt64, INT_FLOAT_PRECISION); OUTPUT_FIELD(FLOAT, Float, INT_FLOAT_PRECISION); OUTPUT_FIELD(DOUBLE, Double, DOULBE_PRECISION); OUTPUT_FIELD(BOOL, Bool, INT_FLOAT_PRECISION); #undef OUTPUT_FIELD case google::protobuf::FieldDescriptor::CPPTYPE_STRING: { std::string scratch; const std::string& str = field->is_repeated() ? ref->GetRepeatedStringReference(msg, field, index, &scratch) : ref->GetStringReference(msg, field, &scratch); { int line_width = 0; std::size_t i = 0; for (; i < str.size() && *jump_lines > 0; ++i) { if (str[i] == '\n' || str[i] == '\r') { --(*jump_lines); line_width = 0; } else { ++line_width; if (line_width == s->Width()) { --(*jump_lines); line_width = 0; } } } if (*jump_lines == 0) { line_width = 0; unsigned line_count = 1; const std::string& fieldName = field->name(); out_str << fieldName << ": "; if (field->is_repeated()) { out_str << "[" << index << "] "; } for (; i < str.size(); ++i) { char ch = str[i]; if (str[i] == '\n' || str[i] == '\r') { ++line_count; line_width = 0; ch = '\n'; } else { ++line_width; if (line_width == s->Width()) { ++line_count; line_width = 0; } } out_str << ch; } s->AddStr(indent, *line_no, out_str.str().c_str()); (*line_no) += line_count; } } break; } case google::protobuf::FieldDescriptor::CPPTYPE_ENUM: { if (*jump_lines) { --(*jump_lines); } else { const std::string& fieldName = field->name(); out_str << fieldName << ": "; if (field->is_repeated()) { out_str << "[" << index << "] "; } int enum_value = field->is_repeated() ? ref->GetRepeatedEnumValue(msg, field, index) : ref->GetEnumValue(msg, field); const google::protobuf::EnumValueDescriptor* enum_desc = field->enum_type()->FindValueByNumber(enum_value); if (enum_desc != nullptr) { out_str << enum_desc->name(); } else { out_str << enum_value; } s->AddStr(indent, (*line_no)++, out_str.str().c_str()); } break; } case google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE: if (!*jump_lines) { const std::string& fieldName = field->name(); out_str << fieldName; if (!field->is_map()) { out_str << ": "; if (field->is_repeated()) { out_str << "[" << index << "] "; } } s->AddStr(indent, (*line_no)++, out_str.str().c_str()); } else { --(*jump_lines); } GeneralMessageBase::PrintMessage( baseMsg, field->is_repeated() ? ref->GetRepeatedMessage(msg, field, index) : ref->GetMessage(msg, field), jump_lines, s, line_no, indent + 2); break; } } RenderableMessage* GeneralMessageBase::Child(int line_no) const { if (line_no < 0) { return nullptr; } auto iter = children_map_.find(line_no); if (iter == children_map_.cend()) { return nullptr; } return iter->second; }
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/general_channel_message.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef TOOLS_CVT_MONITOR_GENERAL_CHANNEL_MESSAGE_H_ #define TOOLS_CVT_MONITOR_GENERAL_CHANNEL_MESSAGE_H_ #include <atomic> #include <memory> #include <string> #include <vector> #include "cyber/cyber.h" #include "cyber/message/raw_message.h" #include "cyber/tools/cyber_monitor/general_message_base.h" class CyberTopologyMessage; class GeneralMessage; class GeneralChannelMessage : public GeneralMessageBase { public: enum class ErrorCode { NewSubClassFailed = -1, CreateNodeFailed = -2, CreateReaderFailed = -3, MessageTypeIsEmpty = -4, ChannelNameOrNodeNameIsEmpty = -5, NoCloseChannel = -6 }; static const char* ErrCode2Str(ErrorCode errCode); static bool IsErrorCode(void* ptr); static ErrorCode CastPtr2ErrorCode(void* ptr) { assert(IsErrorCode(ptr)); return static_cast<ErrorCode>(reinterpret_cast<intptr_t>(ptr)); } static GeneralChannelMessage* CastErrorCode2Ptr(ErrorCode errCode) { return reinterpret_cast<GeneralChannelMessage*>( static_cast<intptr_t>(errCode)); } ~GeneralChannelMessage() { channel_node_.reset(); channel_reader_.reset(); channel_message_.reset(); if (raw_msg_class_) { delete raw_msg_class_; raw_msg_class_ = nullptr; } } std::string GetChannelName(void) const { return channel_reader_->GetChannelName(); } void set_message_type(const std::string& msgTypeName) { message_type_ = msgTypeName; } const std::string& message_type(void) const { return message_type_; } bool is_enabled(void) const { return channel_reader_ != nullptr; } bool has_message_come(void) const { return has_message_come_; } double frame_ratio(void) override; const std::string& NodeName(void) const { return node_name_; } void add_reader(const std::string& reader) { DoAdd(&readers_, reader); } void del_reader(const std::string& reader) { DoDelete(&readers_, reader); } void add_writer(const std::string& writer) { DoAdd(&writers_, writer); } void del_writer(const std::string& writer) { DoDelete(&writers_, writer); if (!writers_.size()) { set_has_message_come(false); } } int Render(const Screen* s, int key) override; void CloseChannel(void) { if (channel_reader_ != nullptr) { channel_reader_.reset(); } if (channel_node_ != nullptr) { channel_node_.reset(); } } private: explicit GeneralChannelMessage(const std::string& node_name, RenderableMessage* parent = nullptr) : GeneralMessageBase(parent), current_state_(State::ShowDebugString), has_message_come_(false), message_type_(), frame_counter_(0), last_time_(apollo::cyber::Time::MonoTime()), msg_time_(last_time_.ToNanosecond() + 1), channel_node_(nullptr), node_name_(node_name), readers_(), writers_(), channel_message_(nullptr), channel_reader_(nullptr), inner_lock_(), raw_msg_class_(nullptr) {} GeneralChannelMessage(const GeneralChannelMessage&) = delete; GeneralChannelMessage& operator=(const GeneralChannelMessage&) = delete; static void DoDelete(std::vector<std::string>* vec, const std::string& str) { for (auto iter = vec->begin(); iter != vec->end(); ++iter) { if (*iter == str) { vec->erase(iter); break; } } } static void DoAdd(std::vector<std::string>* vec, const std::string& str) { for (const auto& item : *vec) { if (item == str) { return; } } vec->emplace_back(str); } void UpdateRawMessage( const std::shared_ptr<apollo::cyber::message::RawMessage>& raw_msg) { set_has_message_come(true); msg_time_ = apollo::cyber::Time::MonoTime(); ++frame_counter_; std::lock_guard<std::mutex> _g(inner_lock_); channel_message_.reset(); channel_message_ = raw_msg; } std::shared_ptr<apollo::cyber::message::RawMessage> CopyMsgPtr(void) const { decltype(channel_message_) channel_msg; { std::lock_guard<std::mutex> g(inner_lock_); channel_msg = channel_message_; } return channel_msg; } GeneralChannelMessage* OpenChannel(const std::string& channel_name); void RenderDebugString(const Screen* s, int key, int* line_no); void RenderInfo(const Screen* s, int key, int* line_no); void set_has_message_come(bool b) { has_message_come_ = b; } enum class State { ShowDebugString, ShowInfo } current_state_; bool has_message_come_; std::string message_type_; std::atomic<int> frame_counter_; apollo::cyber::Time last_time_; apollo::cyber::Time msg_time_; apollo::cyber::Time time_last_calc_ = apollo::cyber::Time::MonoTime(); std::unique_ptr<apollo::cyber::Node> channel_node_; std::string node_name_; std::vector<std::string> readers_; std::vector<std::string> writers_; std::shared_ptr<apollo::cyber::message::RawMessage> channel_message_; std::shared_ptr<apollo::cyber::Reader<apollo::cyber::message::RawMessage>> channel_reader_; mutable std::mutex inner_lock_; google::protobuf::Message* raw_msg_class_; friend class CyberTopologyMessage; friend class GeneralMessage; }; // GeneralChannelMessage #endif // TOOLS_CVT_MONITOR_GENERAL_CHANNEL_MESSAGE_H_
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/renderable_message.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef TOOLS_CVT_MONITOR_RENDERABLE_MESSAGE_H_ #define TOOLS_CVT_MONITOR_RENDERABLE_MESSAGE_H_ #include <string> class Screen; class RenderableMessage { public: static constexpr int FrameRatio_Precision = 2; explicit RenderableMessage(RenderableMessage* parent = nullptr, int line_no = 0) : line_no_(line_no), pages_(1), page_index_(0), page_item_count_(24), parent_(parent), frame_ratio_(0.0) {} virtual ~RenderableMessage() { parent_ = nullptr; } virtual int Render(const Screen* s, int key) = 0; virtual RenderableMessage* Child(int /* line_no */) const = 0; virtual double frame_ratio(void) { return frame_ratio_; } RenderableMessage* parent(void) const { return parent_; } void set_parent(RenderableMessage* parent) { if (parent == parent_) { return; } parent_ = parent; } int page_item_count(void) const { return page_item_count_; } protected: int* line_no(void) { return &line_no_; } void set_line_no(int line_no) { line_no_ = line_no; } void reset_line_page(void) { line_no_ = 0; page_index_ = 0; } void SplitPages(int key); int line_no_; int pages_; int page_index_; int page_item_count_; RenderableMessage* parent_; double frame_ratio_; friend class Screen; }; // RenderableMessage #endif // TOOLS_CVT_MONITOR_RENDERABLE_MESSAGE_H_
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/general_channel_message.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_monitor/general_channel_message.h" #include <iomanip> #include <sstream> #include <string> #include <vector> #include "cyber/record/record_message.h" #include "cyber/tools/cyber_monitor/general_message.h" #include "cyber/tools/cyber_monitor/screen.h" namespace { constexpr int ReaderWriterOffset = 4; using apollo::cyber::record::kGB; using apollo::cyber::record::kKB; using apollo::cyber::record::kMB; } // namespace const char* GeneralChannelMessage::ErrCode2Str( GeneralChannelMessage::ErrorCode errCode) { const char* ret; switch (errCode) { case GeneralChannelMessage::ErrorCode::NewSubClassFailed: ret = "Cannot Create Parser Object"; break; case GeneralChannelMessage::ErrorCode::CreateNodeFailed: ret = "Cannot Create Cyber Node"; break; case GeneralChannelMessage::ErrorCode::CreateReaderFailed: ret = "Cannot Create Cyber Reader"; break; case GeneralChannelMessage::ErrorCode::MessageTypeIsEmpty: ret = "Message Type is Empty"; break; case GeneralChannelMessage::ErrorCode::ChannelNameOrNodeNameIsEmpty: ret = "Channel Name or Node Name is Empty"; break; case GeneralChannelMessage::ErrorCode::NoCloseChannel: ret = "No Close Channel"; break; default: ret = "Unknown Error Code"; } return ret; } bool GeneralChannelMessage::IsErrorCode(void* ptr) { GeneralChannelMessage::ErrorCode err = (GeneralChannelMessage::ErrorCode)(reinterpret_cast<intptr_t>(ptr)); switch (err) { case ErrorCode::NewSubClassFailed: case ErrorCode::CreateNodeFailed: case ErrorCode::CreateReaderFailed: case ErrorCode::MessageTypeIsEmpty: case ErrorCode::ChannelNameOrNodeNameIsEmpty: case ErrorCode::NoCloseChannel: return true; default: { } } return false; } double GeneralChannelMessage::frame_ratio(void) { if (!is_enabled() || !has_message_come()) { return 0.0; } auto time_now = apollo::cyber::Time::MonoTime(); auto interval = time_now - time_last_calc_; if (interval.ToNanosecond() > 1000000000) { int old = frame_counter_; while (!frame_counter_.compare_exchange_strong(old, 0)) { } if (old == 0) { return 0.0; } auto curMsgTime = msg_time_; auto deltaTime = curMsgTime - last_time_; frame_ratio_ = old / deltaTime.ToSecond(); last_time_ = curMsgTime; time_last_calc_ = time_now; } return frame_ratio_; } GeneralChannelMessage* GeneralChannelMessage::OpenChannel( const std::string& channel_name) { if (channel_name.empty() || node_name_.empty()) { return CastErrorCode2Ptr(ErrorCode::ChannelNameOrNodeNameIsEmpty); } if (channel_node_ != nullptr || channel_reader_ != nullptr) { return CastErrorCode2Ptr(ErrorCode::NoCloseChannel); } channel_node_ = apollo::cyber::CreateNode(node_name_); if (channel_node_ == nullptr) { return CastErrorCode2Ptr(ErrorCode::CreateNodeFailed); } auto callback = [this]( const std::shared_ptr<apollo::cyber::message::RawMessage>& raw_msg) { UpdateRawMessage(raw_msg); }; channel_reader_ = channel_node_->CreateReader<apollo::cyber::message::RawMessage>( channel_name, callback); if (channel_reader_ == nullptr) { channel_node_.reset(); return CastErrorCode2Ptr(ErrorCode::CreateReaderFailed); } return this; } int GeneralChannelMessage::Render(const Screen* s, int key) { switch (key) { case 'b': case 'B': current_state_ = State::ShowDebugString; break; case 'i': case 'I': current_state_ = State::ShowInfo; break; default: { } } clear(); int line_no = 0; s->SetCurrentColor(Screen::WHITE_BLACK); s->AddStr(0, line_no++, "ChannelName: "); s->AddStr(channel_reader_->GetChannelName().c_str()); s->AddStr(0, line_no++, "MessageType: "); s->AddStr(message_type().c_str()); if (is_enabled()) { switch (current_state_) { case State::ShowDebugString: RenderDebugString(s, key, &line_no); break; case State::ShowInfo: RenderInfo(s, key, &line_no); break; } } else { s->AddStr(0, line_no++, "Channel has been closed"); } s->ClearCurrentColor(); return line_no; } void GeneralChannelMessage::RenderInfo(const Screen* s, int key, int* line_no) { page_item_count_ = s->Height() - *line_no; pages_ = static_cast<int>(readers_.size() + writers_.size() + *line_no) / page_item_count_ + 1; SplitPages(key); bool has_reader = true; std::vector<std::string>* vec = &readers_; auto iter = vec->cbegin(); unsigned int y = page_index_ * page_item_count_; if (y < vec->size()) { for (unsigned i = 0; i < y; ++i) { ++iter; } } else { y -= static_cast<unsigned int>(vec->size()); vec = &writers_; iter = vec->cbegin(); while (y) { ++iter; --y; } has_reader = false; } if (has_reader) { s->AddStr(0, (*line_no)++, "Readers:"); for (; iter != vec->cend(); ++iter) { s->AddStr(ReaderWriterOffset, (*line_no)++, iter->c_str()); } ++(*line_no); vec = &writers_; iter = vec->cbegin(); } s->AddStr(0, (*line_no)++, "Writers:"); for (; iter != vec->cend(); ++iter) { s->AddStr(ReaderWriterOffset, (*line_no)++, iter->c_str()); } } void GeneralChannelMessage::RenderDebugString(const Screen* s, int key, int* line_no) { if (has_message_come()) { if (raw_msg_class_ == nullptr) { auto rawFactory = apollo::cyber::message::ProtobufFactory::Instance(); raw_msg_class_ = rawFactory->GenerateMessageByType(message_type()); } if (raw_msg_class_ == nullptr) { s->AddStr(0, (*line_no)++, "Cannot Generate Message by Message Type"); } else { s->AddStr(0, (*line_no)++, "FrameRatio: "); std::ostringstream out_str; out_str << std::fixed << std::setprecision(FrameRatio_Precision) << frame_ratio(); s->AddStr(out_str.str().c_str()); decltype(channel_message_) channel_msg = CopyMsgPtr(); if (channel_msg->message.size()) { s->AddStr(0, (*line_no)++, "RawMessage Size: "); out_str.str(""); out_str << channel_msg->message.size() << " Bytes"; if (channel_msg->message.size() >= kGB) { out_str << " (" << static_cast<float>(channel_msg->message.size()) / kGB << " GB)"; } else if (channel_msg->message.size() >= kMB) { out_str << " (" << static_cast<float>(channel_msg->message.size()) / kMB << " MB)"; } else if (channel_msg->message.size() >= kKB) { out_str << " (" << static_cast<float>(channel_msg->message.size()) / kKB << " KB)"; } s->AddStr(out_str.str().c_str()); if (raw_msg_class_->ParseFromString(channel_msg->message)) { int lcount = LineCount(*raw_msg_class_, s->Width()); page_item_count_ = s->Height() - *line_no; pages_ = lcount / page_item_count_ + 1; SplitPages(key); int jump_lines = page_index_ * page_item_count_; jump_lines <<= 2; jump_lines /= 5; GeneralMessageBase::PrintMessage(this, *raw_msg_class_, &jump_lines, s, line_no, 0); } else { s->AddStr(0, (*line_no)++, "Cannot parse the raw message"); } } else { s->AddStr(0, (*line_no)++, "The size of this raw Message is Zero"); } } } else { s->AddStr(0, (*line_no)++, "No Message Came"); } }
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/general_message.cc
/****************************************************************************** * 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. *****************************************************************************/ #include "cyber/tools/cyber_monitor/general_message.h" #include <iomanip> #include <numeric> #include <sstream> #include <vector> #include "cyber/tools/cyber_monitor/general_channel_message.h" #include "cyber/tools/cyber_monitor/screen.h" namespace { /** * if map has string keys, lexically sort them */ std::vector<int> SortProtobufMapByKeys( const google::protobuf::Message& message, const google::protobuf::FieldDescriptor* field, const google::protobuf::Reflection& reflection, const int size) { std::vector<int> output; if (0 == size) { return output; } if (field->cpp_type() == google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { const ::google::protobuf::Message& item = reflection.GetRepeatedMessage(message, field, 0); const ::google::protobuf::FieldDescriptor* item_fd = item.GetDescriptor()->FindFieldByName("key"); if (item_fd && field->is_map() && ::google::protobuf::FieldDescriptor::Type::TYPE_STRING == item_fd->type()) { std::vector<std::pair<std::string, int>> key_indices; key_indices.reserve(size); for (int i = 0; i < size; ++i) { const ::google::protobuf::Message& item = reflection.GetRepeatedMessage(message, field, i); const ::google::protobuf::FieldDescriptor* item_fd = item.GetDescriptor()->FindFieldByName("key"); const std::string key(item.GetReflection()->GetString(item, item_fd)); key_indices.emplace_back(key, i); } std::sort(key_indices.begin(), key_indices.end()); output.reserve(size); for (const std::pair<std::string, int>& key_index : key_indices) { output.push_back(key_index.second); } } } if (output.empty()) { output.resize(size); std::iota(output.begin(), output.end(), 0); } return output; } } // namespace GeneralMessage::GeneralMessage(GeneralMessageBase* parent, const google::protobuf::Message* msg, const google::protobuf::Reflection* reflection, const google::protobuf::FieldDescriptor* field) : GeneralMessageBase(parent), item_index_(0), is_folded_(true), field_(field), message_ptr_(msg), reflection_ptr_(reflection) {} int GeneralMessage::Render(const Screen* s, int key) { s->SetCurrentColor(Screen::WHITE_BLACK); int line_no = 0; { RenderableMessage* p = this; while (p->parent()->parent()->parent()) { p = p->parent(); } GeneralChannelMessage* channel_msg_ptr = static_cast<GeneralChannelMessage*>(p->parent()); s->AddStr(0, line_no++, "ChannelName: "); s->AddStr(channel_msg_ptr->GetChannelName().c_str()); s->AddStr(0, line_no++, "MessageType: "); s->AddStr(channel_msg_ptr->message_type().c_str()); std::ostringstream out_str; out_str << std::fixed << std::setprecision(FrameRatio_Precision) << channel_msg_ptr->frame_ratio(); s->AddStr(0, line_no++, "FrameRatio: "); s->AddStr(out_str.str().c_str()); clear(); auto channel_msg = channel_msg_ptr->CopyMsgPtr(); if (!channel_msg_ptr->raw_msg_class_->ParseFromString( channel_msg->message)) { s->AddStr(0, line_no++, "Cannot Parse the message for Real-Time Updating"); return line_no; } if (message_ptr_ && reflection_ptr_) { int size = 0; if (field_->is_repeated()) { size = reflection_ptr_->FieldSize(*message_ptr_, field_); } else { if (reflection_ptr_->HasField(*message_ptr_, field_) || field_->containing_type()->options().map_entry()) { size = 1; } } if (size <= item_index_) { out_str.str(""); out_str << "The item [" << item_index_ << "] has been empty !!!"; s->AddStr(0, line_no++, out_str.str().c_str()); return line_no; } if (key == ',') { is_folded_ = !is_folded_; } else if (is_folded_) { switch (key) { case 'n': case 'N': ++item_index_; if (item_index_ >= size) { item_index_ = 0; } break; case 'm': case 'M': --item_index_; if (item_index_ < 0) { item_index_ = size - 1; } break; default: { } } } int lcount = LineCountOfField(*message_ptr_, s->Width(), field_, reflection_ptr_, is_folded_); page_item_count_ = s->Height() - line_no - 8; if (page_item_count_ < 1) { page_item_count_ = 1; } pages_ = lcount / page_item_count_ + 1; SplitPages(key); int jump_lines = page_index_ * page_item_count_; const std::vector<int> indices( SortProtobufMapByKeys(*message_ptr_, field_, *reflection_ptr_, size)); if (is_folded_) { GeneralMessageBase::PrintField(this, *message_ptr_, &jump_lines, s, &line_no, 0, reflection_ptr_, field_, indices[item_index_]); } else { for (const int index : indices) { GeneralMessageBase::PrintField(this, *message_ptr_, &jump_lines, s, &line_no, 0, reflection_ptr_, field_, index); } } } } s->ClearCurrentColor(); return line_no; }
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/cyber_topology_message.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef TOOLS_CVT_MONITOR_CYBER_TOPOLOGY_MESSAGE_H_ #define TOOLS_CVT_MONITOR_CYBER_TOPOLOGY_MESSAGE_H_ #include <map> #include <string> #include "cyber/tools/cyber_monitor/renderable_message.h" namespace apollo { namespace cyber { namespace proto { class ChangeMsg; class RoleAttributes; } // namespace proto } // namespace cyber } // namespace apollo class GeneralChannelMessage; // class GeneralMessage; class CyberTopologyMessage : public RenderableMessage { public: explicit CyberTopologyMessage(const std::string& channel); ~CyberTopologyMessage(); int Render(const Screen* s, int key) override; RenderableMessage* Child(int index) const override; void TopologyChanged(const apollo::cyber::proto::ChangeMsg& change_msg); void AddReaderWriter(const apollo::cyber::proto::RoleAttributes& role, bool isWriter); private: CyberTopologyMessage(const CyberTopologyMessage&) = delete; CyberTopologyMessage& operator=(const CyberTopologyMessage&) = delete; void ChangeState(const Screen* s, int key); bool IsFromHere(const std::string& node_name); std::map<std::string, GeneralChannelMessage*>::const_iterator FindChild( int index) const; enum class SecondColumnType { MessageType, MessageFrameRatio }; SecondColumnType second_column_; int pid_; int col1_width_; const std::string& specified_channel_; std::map<std::string, GeneralChannelMessage*> all_channels_map_; }; #endif // TOOLS_CVT_MONITOR_CYBER_TOPOLOGY_MESSAGE_H_
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/screen.h
/****************************************************************************** * 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. *****************************************************************************/ #ifndef TOOLS_CVT_MONITOR_SCREEN_H_ #define TOOLS_CVT_MONITOR_SCREEN_H_ #include <map> #include <string> #include <vector> #ifndef CTRL #define CTRL(c) ((c)&0x1F) #endif class RenderableMessage; class Screen final { public: static const char InteractiveCmdStr[]; enum ColorPair { // foreground color - background color INVALID = 0, GREEN_BLACK = 1, YELLOW_BLACK, RED_BLACK, WHITE_BLACK, BLACK_WHITE }; static Screen* Instance(void); ~Screen(void); void Init(void); void Run(void); void Resize(); void Stop(void) { canRun_ = false; } int Width(void) const; int Height(void) const; void AddStr(int x, int y, ColorPair color, const char* str) const; ColorPair Color(void) const { return current_color_pair_; } void SetCurrentColor(ColorPair color) const; void AddStr(int x, int y, const char* str) const; void AddStr(const char* str) const; void MoveOffsetXY(int offsetX, int offsetY) const; void ClearCurrentColor(void) const; void SetCurrentRenderMessage(RenderableMessage* const render_obj) { if (render_obj) { current_render_obj_ = render_obj; } } private: explicit Screen(); Screen(const Screen&) = delete; Screen& operator=(const Screen&) = delete; int SwitchState(int ch); void HighlightLine(int line_no); void ShowInteractiveCmd(int ch); void ShowRenderMessage(int ch); bool IsInit(void) const; enum class State { RenderMessage, RenderInterCmdInfo }; mutable ColorPair current_color_pair_; bool canRun_; State current_state_; int highlight_direction_; RenderableMessage* current_render_obj_; }; #endif // TOOLS_CVT_MONITOR_SCREEN_H_
0
apollo_public_repos/apollo/cyber/tools
apollo_public_repos/apollo/cyber/tools/cyber_monitor/BUILD
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") load("//tools:cpplint.bzl", "cpplint") load("//tools/install:install.bzl", "install") package(default_visibility = ["//visibility:public"]) install( name = "install", runtime_dest = "cyber/bin", targets = [ ":cyber_monitor", ], ) cc_binary( name = "cyber_monitor", srcs = [ "cyber_topology_message.cc", "general_channel_message.cc", "general_message.cc", "general_message_base.cc", "main.cc", "renderable_message.cc", "screen.cc", ], linkopts = ["-pthread"], deps = [ ":cyber_topology_message", ":general_channel_message", ":screen", "//cyber:init", "//cyber/service_discovery:topology_manager", "@ncurses5", ], ) cc_library( name = "cyber_topology_message", hdrs = ["cyber_topology_message.h"], deps = [ ":renderable_message", ], ) cc_library( name = "general_channel_message", hdrs = ["general_channel_message.h"], deps = [ ":general_message", ":general_message_base", ":screen", "//cyber", "//cyber/message:raw_message", "//cyber/record:record_message", ], ) cc_library( name = "general_message", hdrs = ["general_message.h"], deps = [ ":general_message_base", "//cyber", "//cyber/message:raw_message", ], ) cc_library( name = "general_message_base", hdrs = ["general_message_base.h"], deps = [ ":renderable_message", ], ) cc_library( name = "renderable_message", hdrs = ["renderable_message.h"], deps = [ ":screen", ], ) cc_library( name = "screen", hdrs = ["screen.h"], ) cpplint()
0