### Setting Up and Starting the scene-editor Project (Shell) Source: https://github.com/tencent/tad_sim/blob/main/simapp/scene-editor/README.md This snippet provides the shell commands to set up and run the `scene-editor` project. It includes installing necessary dependencies using `npm install` and starting the development server with `npm run dev`. Users should ensure the `assets` folder is generated after startup and acquire the `service` folder for `sim-desktop`. ```shell ## 安装依赖 npm install ## 启动项目 npm run dev ``` -------------------------------- ### Installing Dependencies and Starting simapp Components Source: https://github.com/tencent/tad_sim/blob/main/simapp/README.md This snippet provides the necessary shell commands to set up the 'simapp' project. It includes steps for installing all required npm dependencies and then launching the individual development servers for the scene, desktop, and map editor applications. ```shell ## 安装依赖 npm install ## 启动项目 npm run dev:scene npm run dev:desktop npm run dev:map ``` -------------------------------- ### Installing Google Protocol Buffers on Ubuntu Source: https://github.com/tencent/tad_sim/blob/main/simcore/traffic/microsim_msg/README.md This snippet provides a sequence of shell commands to install Google Protocol Buffers version 3.14.0 on an Ubuntu 16.04 system. It includes installing build dependencies, configuring the protobuf source, compiling, and installing the library and compiler, followed by a version check. ```bash sudo apt-get install autoconf automake libtool curl make g++ unzip ``` ```bash cd protobuf-3.14.0 ``` ```bash sh ./autogen.sh ``` ```bash ./configure -prefix=安装目录 (如:/usr/local/) ``` ```bash sudo make ``` ```bash sudo make check ``` ```bash sudo make install ``` ```bash sudo ldconfig ``` ```bash protoc --version ``` -------------------------------- ### Compiling Example Module with CMake - Bash Source: https://github.com/tencent/tad_sim/blob/main/docs/user_guidelines/user_guidelines_desktop/source/402.算法接入说明.md This snippet provides the Bash commands to navigate into the example module directory, create a build directory, configure the project with CMake, and compile it using Make. This process generates both a dynamic library (.so) and an executable binary, demonstrating the typical build flow for txSimSDK projects. ```Bash cd my_module mkdir build && cd build cmake .. make ``` -------------------------------- ### Compiling Example Module with CMake and Make (Shell) Source: https://github.com/tencent/tad_sim/blob/main/simcore/framework/docs/index.rst This shell script demonstrates the steps to compile the `my_module` example project within the txSimSDK. It navigates into the module directory, creates and enters a build directory, then uses CMake to configure the project and Make to compile it, resulting in a dynamic library and an executable. ```Shell cd my_module mkdir build && cd build cmake .. make ``` -------------------------------- ### CMake Installation for ReaderWriterQueue Source: https://github.com/tencent/tad_sim/blob/main/simcore/framework/src/utils/ds/spsc_queue/README.md This snippet provides the standard CMake commands to build and install the readerwriterqueue library. It outlines the steps to create a build directory, configure the project with CMake, and then compile and install the library. ```CMake mkdir build cd build cmake .. make install ``` -------------------------------- ### Installing Dependencies with Vcpkg for Windows (PowerShell) Source: https://github.com/tencent/tad_sim/blob/main/simcore/grading/README.md This PowerShell command uses Vcpkg to install a comprehensive list of required third-party libraries for the TAD Sim project on a Windows x64 platform. It ensures all necessary dependencies like zlib, boost, protobuf, grpc, and others are available for compilation. ```PowerShell ./vcpkg.exe install zlib boost eigen3 flann gflags glm glog protobuf grpc gtest curl proj libspatialite sqlite3 libxml2 jsoncpp log4cpp-log4cpp pugixml soci tbb uriparser xerces-c grpc tinyxml2 cppzmq --triplet x64-windows ``` -------------------------------- ### Example Request Body for Loading HAD Map Data (JSON) Source: https://github.com/tencent/tad_sim/blob/main/simcore/map_server/hadmap_server/API.md This JSON object represents an example request body for the `/hadmapdata` API to load a HAD map. It specifies the command `loadhadmap`, the map file name `x.xodr`, an optional version, and `fineRsp` to request a detailed response. ```JSON { "cmd":"loadhadmap", "mapname":"x.xodr", "version":"1670310633", "fineRsp":true } ``` -------------------------------- ### Setting Up ROS Noetic Core Environment - Bash Source: https://github.com/tencent/tad_sim/blob/main/adapter/ros2/README.md This snippet provides a sequence of bash commands to set up a basic development environment for ROS Noetic. It includes pulling a Docker image, updating package lists, and installing essential build tools like 'gcc' and 'build-essential' required for compiling ROS packages. ```bash docker pull ros:noetic-ros-core apt-get update apt install gcc sudo apt-get install build-essential ``` -------------------------------- ### Setting up Docker Environment for Ubuntu Compilation Source: https://github.com/tencent/tad_sim/blob/main/simcore/protobuf_log/README.md This Bash command initiates an interactive Docker container, configured to remove itself upon exit. It mounts the host's current working directory into the container at /build, sets this as the working directory, and then launches a Bash shell. This setup is essential for providing a consistent and isolated environment for compiling the protobuf_log module on Ubuntu. ```Bash docker run -it --rm -v "$(pwd)":/build -w /build desktop:tag /bin/bash ``` -------------------------------- ### Compiling Custom Protocol Buffer Files Source: https://github.com/tencent/tad_sim/blob/main/simcore/traffic/microsim_msg/README.md This snippet shows the shell commands to clean and build custom Protocol Buffer files using a Makefile. It assumes a 'Makefile' is already configured to compile '.proto' files into the desired language bindings, following the structure of 'its_sim.proto'. ```bash make clean; make ``` -------------------------------- ### Installing Python Dependencies for TAD Sim Data Parsing - Bash Source: https://github.com/tencent/tad_sim/blob/main/simcore/post_script/README.md This command installs the essential Python libraries required for processing TAD Sim simulation data. The packages glog, grpcio-tools, and pyinstaller are installed using pip, providing functionalities for logging, gRPC tools, and application packaging respectively. ```Bash python3 -m pip install glog grpcio-tools pyinstaller ``` -------------------------------- ### Ultrasonic Sensor Initialization Sequence Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/Ultrasonic/README.md This PlantUML sequence diagram illustrates the initialization flow for the Ultrasonic sensor. It shows the `SimSDK` initiating the `Ultrasonic` component, which in turn triggers the `FovDepth` component to initialize the depth camera, establishing the necessary setup for sensor operation. ```plantuml @startuml SimSDK -> Ultrasonic: init Ultrasonic -> FovDepth: init depth camera @enduml ``` -------------------------------- ### Compiling Docker Images for TAD_Sim Desktop on Ubuntu Source: https://github.com/tencent/tad_sim/blob/main/docs/prerequisites_ubuntu.md This snippet provides commands to build Docker images for the TAD_Sim desktop application on Ubuntu. It includes standard `docker build` for the current platform, `docker buildx` for specific architectures like `linux/amd64`, and a local build option (`Dockerfile_local`) for environments with network restrictions. The `BASE_MIRROR` argument specifies the Tencent Cloud image source, which can be omitted to use the default Docker Hub. ```bash # 切换路径为项目根目录 cd TAD_Sim # 使用 docker build 按当前平台进行构建 # 注意如果本机是 arm 芯片, 则需要使用下面 buildx 方式进行构建 # 此处指定了腾讯云镜像源, 如果不指定将默认使用 docker.io/library/ 官方镜像源 docker build . -t tadsim/desktop:v1.0 --build-arg BASE_MIRROR=ccr.ccs.tencentyun.com/library/ # 使用 docker buildx 选择平台(linux/amd64 或 linux/arm64)进行构建 # 目前仅 linux/amd64 被验证, 此处保留扩展能力 docker buildx build . --platform linux/amd64 -t tadsim/desktop:v1.0 BASE_MIRROR=ccr.ccs.tencentyun.com/library/ # 对于网络限制情况, 提供本地方式 # 需注意此时版本升级将受到限制, 除了 dockerfile 中更改外, 还需要同步更新 TAD_Sim/tools/docker_libraries 下面的压缩包版本 docker build . -t tadsim/desktop:v1.0 --build-arg BASE_MIRROR=ccr.ccs.tencentyun.com/library/ -f ./Dockerfile_local ``` -------------------------------- ### Example Response Body for Map Loading (JSON) Source: https://github.com/tencent/tad_sim/blob/main/simcore/map_server/hadmap_server/API.md This JSON object illustrates a successful response from the `/hadmapdata` API after a map loading request. It includes a `code` of 0 for success, `message` 'ok', and `data` containing map boundary information like `min`, `max`, and `center` coordinates. ```JSON { "code":0, "data":{ "unrealLevelIndex":0, "min":"x,y,z", "max":"x,y,z", "center":"x,y,z" }, "message":"ok" } ``` -------------------------------- ### Example Lane Link Data Structure (JSON) Source: https://github.com/tencent/tad_sim/blob/main/simcore/map_server/hadmap_server/API.md This JSON object presents an example of the lane link data structure from the map query API. It contains an `array` of lane link segments, each with geometric points, length, and IDs connecting to from/to roads, sections, and junctions. Global map bounds are also included. ```JSON { "array": [ { "array": [ {"x": 1.69310982,"y": -10.258414160000001,"z": -0.00000853}, {"x": 4.85289856,"y": -10.619907040000001,"z": -0.00001074}, ... ], "count": 28, "fid": -2, "frid": 10, "fsid": 0, "id": 36, "junctionid": 2, "len": 34.257578481539305, "tid": -2, "trid": 40, "tsid": 0 }, ... ], "center": "118.509368896484,0.000277545885,0.000000000000", "count": 24, "max": "118.510719299316,0.001197464648,0.000000000931", "min": "118.508018493652,-0.000642372877,-0.000000000931" } ``` -------------------------------- ### Example Map Object Data Structure (JSON) Source: https://github.com/tencent/tad_sim/blob/main/simcore/map_server/hadmap_server/API.md This JSON object provides an example of map object data, specifically a traffic light, returned by the map query API. It includes properties like `id`, `name`, `strType`, dimensions (`height`, `width`), and 3D coordinates (`x`, `y`, `z`, `pitch`, `roll`, `yaw`). Global map bounds are also included. ```JSON { "array": [ { "count": 0, "groundHeight": 0, "height": 0.6, "id": 5, "length": 0, "name": "pole-1", "pitch": 0, "roll": 0, "strSubType": "l2", "strType": "trafficLight", "type": 16, "userData": [ { "s": "0.05" }, { "t": "-7.088798366670616" } ], "width": 0.2, "x": 64.75977017134414, "y": -4.1113178653783224, "yaw": 3.09616898344662, "z": 5.999669900724851 } ], "center": "118.509368896484,0.000277545885,0.000000000000", "count": 8, "max": "118.510719299316,0.001197464648,0.000000000931", "min": "118.508018493652,-0.000642372877,-0.000000000931" } ``` -------------------------------- ### Running Docker Container for Ubuntu Development Environment (Bash) Source: https://github.com/tencent/tad_sim/blob/main/simcore/grading/README.md This Bash command runs a Docker container in interactive mode, mounts the current working directory as `/build` inside the container, sets `/build` as the working directory, and starts a Bash shell. This sets up the isolated development environment for building the TAD Sim project on Ubuntu. ```Bash # 以交互方式运行 docker 容器, 将其设置为工作目录, 并启动 Bash shell docker run -it --rm -v "$(pwd)":/build -w /build desktop:tag /bin/bash ``` -------------------------------- ### Example Lane Data Structure (JSON) Source: https://github.com/tencent/tad_sim/blob/main/simcore/map_server/hadmap_server/API.md This JSON object provides an example of the lane data structure returned by the map query API. It contains an `array` of lane segments, each with geometric points, length, associated road and section IDs (`rid`, `sid`), and boundary IDs (`lbid`, `rbid`). Global map bounds are also included. ```JSON { "array": [ { "arr": 0, "array": [ {"x": 33.91482499,"y": 21.57208486,"z": -0.00012689}, {"x": 33.24111767,"y": 101.73302562,"z": -0.00090342}, ... ], "count": 2, "id": -1, "lbid": 13, "len": 80.16377177043474, "rbid": 14, "rid": 30, "sid": 0, "sl": 0, "type": 1, "wid": 3.5 }, ... ], "center": "118.509368896484,0.000277545885,0.000000000000", "count": 16, "max": "118.510719299316,0.001197464648,0.000000000931", "min": "118.508018493652,-0.000642372877,-0.000000000931" } ``` -------------------------------- ### Sensor Actor Interface Diagram - PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/README.md This PlantUML class diagram defines the abstract SensorActor class and its concrete implementations for Camera, Lidar, Fisheye, and Ultrasonic sensors. It specifies the common abstract methods Init, Update, and Install (for SensorActor) that these sensor classes must implement, outlining the core interface for sensor interaction. ```plantuml @startuml class SensorActor { +void {abstract} Init(SensorConfig) +void {abstract} Update(Input, Output) +void {abstract} Install(SensorConfig) } class Camera { +void {abstract} Init(SensorConfig) +void {abstract} Update(Input, Output) } class Lidar { +void {abstract} Init(SensorConfig) +void {abstract} Update(Input, Output) } class Fisheye { +void {abstract} Init(SensorConfig) +void {abstract} Update(Input, Output) } class Ultrasonic { +void {abstract} Init(SensorConfig) +void {abstract} Update(Input, Output) } SensorActor <|-down- Camera SensorActor <|-down- Lidar SensorActor <|-down- Fisheye SensorActor <|-down- Ultrasonic @enduml ``` -------------------------------- ### Sensor Class Interface Definition - PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/CameraSensors/README.md This PlantUML diagram defines the interfaces and inheritance relationships for the sensor classes. It shows SensorActor as the base class with abstract Init, Update, and Install methods. Camera and Fisheye inherit from SensorActor, while Depth and Semantic inherit from Camera, each with specific methods like Save or constructors. ```plantuml @startuml class SensorActor { +void {abstract} Init(SensorConfig) +void {abstract} Update(Input, Output) +void {abstract} Install(SensorConfig) } class Camera { +void {abstract} Init(SensorConfig) +void {abstract} Update(Input, Output) +void {abstract} Save() } class Depth { Depth() +void {abstract} Save() } class Fisheye { +void {abstract} Init(SensorConfig) +void {abstract} Update(Input, Output) } class Semantic { Semantic() +void {abstract} Save() } SensorActor <|-down- Camera Camera <|-down- Depth SensorActor <|-down- Fisheye Camera <|-down- Semantic @enduml ``` -------------------------------- ### Example Road Data Structure (JSON) Source: https://github.com/tencent/tad_sim/blob/main/simcore/map_server/hadmap_server/API.md This JSON object demonstrates the structure for road data returned by the map query API. It contains an `array` of road segments, each with geometric points, length, `roadid`, and type. Global map bounds (`min`, `max`, `center`) and total count are also included. ```JSON { "array": [ { "array": [ {"x": 32.16960467,"y": 21.5564208,"z": -0.00011779000000000001}, {"x": 31.49588062,"y": 101.71935437,"z": -0.00089434}, ... ], "count": 2, "dir": 0, "len": 80.16576465364858, "mat": 0, "roadid": 30, "type": 0 }, ... ], "center": "118.509368896484,0.000277545885,0.000000000000", "count": 8, "max": "118.510719299316,0.001197464648,0.000000000931", "min": "118.508018493652,-0.000642372877,-0.000000000931" } ``` -------------------------------- ### Example Lane Boundary Data Structure (JSON) Source: https://github.com/tencent/tad_sim/blob/main/simcore/map_server/hadmap_server/API.md This JSON object illustrates the structure for lane boundary data from the map query API. It includes an `array` of boundary segments, each defined by geometric points, an `id`, and a `mark` value. Global map bounds and total count are also provided. ```JSON { "array": [ { "array": [ {"x": 32.16959629,"y": 21.55741807,"z": -0.0001178}, {"x": 31.495889000000002,"y": 101.7183571,"z": -0.00089433}, ... ], "count": 2, "id": 13, "mark": 65553 }, ... ], "center": "118.509368896484,0.000277545885,0.000000000000", "count": 24, "max": "118.510719299316,0.001197464648,0.000000000931", "min": "118.508018493652,-0.000642372877,-0.000000000931" } ``` -------------------------------- ### Blocking ReaderWriterQueue Usage with Threads in C++ Source: https://github.com/tencent/tad_sim/blob/main/simcore/framework/src/utils/ds/spsc_queue/README.md This example illustrates how to use the BlockingReaderWriterQueue in a multi-threaded scenario. It sets up a reader thread that uses wait_dequeue (or wait_dequeue_timed) and a writer thread that uses enqueue, demonstrating how threads can block until an item is available or a timeout occurs. ```C++ BlockingReaderWriterQueue q; std::thread reader([&]() { int item; #if 1 for (int i = 0; i != 100; ++i) { // Fully-blocking: q.wait_dequeue(item); } #else for (int i = 0; i != 100; ) { // Blocking with timeout if (q.wait_dequeue_timed(item, std::chrono::milliseconds(5))) ++i; } #endif }); std::thread writer([&]() { for (int i = 0; i != 100; ++i) { q.enqueue(i); std::this_thread::sleep_for(std::chrono::milliseconds(10)); } }); writer.join(); reader.join(); assert(q.size_approx() == 0); ``` -------------------------------- ### Configuring JPEG Quality for Sensor Data in Tadsim (INI) Source: https://github.com/tencent/tad_sim/blob/main/docs/user_guidelines/user_guidelines_desktop/source/306.传感器仿真.md This INI configuration sets the JPEG compression quality for sensor image data in Tadsim. The value, ranging from 0 to 100, determines the trade-off between image quality and file size/performance. A value of 85 is provided as an example. ```ini [Sensor] JpegQuality=85 ``` -------------------------------- ### Configuring Development Environment with Python Source: https://github.com/tencent/tad_sim/blob/main/docs/user_guidelines/README.md This snippet provides the bash commands to navigate into the 'docs' directory and then execute a Python script named 'startup.py'. This script is responsible for building and running Docker containers and configuring the development environment for the documentation project. ```bash cd docs python3 startup.py ``` -------------------------------- ### Running excel2asam Windows Binary with Excel Input Source: https://github.com/tencent/tad_sim/blob/main/simcore/excel2asam/README.md This command executes the pre-compiled Windows binary of `excel2asam.exe`. It takes an Excel file as input, defining the input mode, the full Windows path to the Excel data, the output directory for generated files, and the location of necessary catalog files for the conversion. ```powershell .\excel2asam.exe --input_mode=excel --input_data=D:\UGit\excel2asam\tests\testdata\virturalmapdemo.xlsm --pathdir_output=.\output --pathdir_catalog=.\Catalogs ``` -------------------------------- ### Generating Desktop User Guidelines HTML Source: https://github.com/tencent/tad_sim/blob/main/docs/user_guidelines/README.md This bash command is used to generate the HTML documentation specifically for the desktop version of the user guidelines. It invokes a Python script `generate_doc.py` with parameters to specify the project (`-p desktop`) and the edition (`-e standard`). ```bash python3 generate_doc.py -p desktop -e standard ``` -------------------------------- ### Illustrating Component Initialization Flow (PlantUML) Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/CameraSensors/README.md This PlantUML diagram visualizes the initialization sequence within the tad_sim project. It shows SimSDK initiating Camera and Fisheye components, with Camera subsequently initializing Depth and Semantic cameras, outlining the hierarchical initialization process. ```plantuml @startuml SimSDK -> Camera: init Camera -> Depth: init depth camera Camera -> Semantic: init Semantic camera SimSDK -> Fisheye: init fisheye @enduml ``` -------------------------------- ### Running excel2asam Linux Binary with Excel Input Source: https://github.com/tencent/tad_sim/blob/main/simcore/excel2asam/README.md This command executes the pre-compiled Linux binary of `excel2asam`. It processes an Excel file, specifying the input mode, the absolute path to the Excel data, the desired output directory, and the path to the catalog files required for the conversion process. ```bash ./excel2asam --input_mode=excel --input_data=/work/tests/testdata/virturalmapdemo.xlsm --pathdir_output=./output --pathdir_catalog=/work/excel2asam/catalogs ``` -------------------------------- ### Running excel2asam Locally with Excel Input (Python) Source: https://github.com/tencent/tad_sim/blob/main/simcore/excel2asam/README.md This command sequence navigates to the project directory and executes the `producer.py` script using Python 3. It configures the input mode as 'excel', specifies the path to the Excel data file (`virturalmapdemo.xlsm`), and defines the output directory for the generated OpenSCENARIO and OpenDRIVE files. ```bash cd /work/excel2asam python3 producer.py --input_mode=excel --input_data=../tests/testdata/virturalmapdemo.xlsm --pathdir_output=./output ``` -------------------------------- ### Compiling Protobuf_log on Windows with PowerShell Source: https://github.com/tencent/tad_sim/blob/main/simcore/protobuf_log/README.md This snippet demonstrates the PowerShell commands required to compile the protobuf_log module on a Windows environment. It involves navigating to the module's directory and executing the build.bat script, which handles the creation of Visual Studio project files and the compilation process. This method provides a command-line alternative to direct compilation within Visual Studio. ```PowerShell cd TAD_Sim/simcore/protobuf_log ./build.bat ``` -------------------------------- ### Cloning TAD Sim Repository and Navigating to Grading Module (PowerShell) Source: https://github.com/tencent/tad_sim/blob/main/simcore/grading/README.md This PowerShell snippet demonstrates how to clone the TAD Sim repository from a remote Git URL and then navigate into the `tadsim/simcore/grading` directory. This is the initial step for setting up the development environment for the Grading module. ```PowerShell # step 1: 获得远程仓库地址及权限 # tadsim (包含构建单机版tadsim的所有代码) # step 2: 获取代码并进入根目录 # 获得远程仓库地址及权限 (下述以 xxx 代替) git clone xxx.git # 进入根目录 cd tadsim/simcore/grading ``` -------------------------------- ### Compiling TAD_Sim with CMake and Make Source: https://github.com/tencent/tad_sim/blob/main/simcore/envpb/README.md This snippet provides the standard command-line steps to compile the TAD_Sim project using CMake and Make. It creates a build directory, navigates into it, configures the build system, and then compiles the source code. ```Shell mkdir build cd build cmake .. make ``` -------------------------------- ### Running Pytest for excel2asam Source: https://github.com/tencent/tad_sim/blob/main/simcore/excel2asam/README.md This command sequence navigates to the `/work/tests` directory and then executes a specific pytest test file, `test_xxx.py`. This is used to perform unit or integration testing for the `excel2asam` project's components. ```bash cd /work/tests pytest test_xxx.py ``` -------------------------------- ### Configuring VS Code Debugging for TAD_Sim (LLDB) Source: https://github.com/tencent/tad_sim/blob/main/simcore/envpb/README.md This JSON snippet defines a VS Code launch configuration for debugging the TAD_Sim module using LLDB. It specifies the program path, arguments, environment variables (like LD_LIBRARY_PATH), and the working directory for the debugger. ```JSON { "version": "0.2.0", "configurations": [ { "type": "lldb", "request": "launch", "name": "Debug", "program": "/修改为你的路径/txsim-module-launcher", "args": [ "envpb(Tadsim配置的模块名字)", "${workspaceFolder}/build/lib/libtxsim-radar.so", "127.0.0.1:21302" ], "env": { "LD_LIBRARY_PATH": "/home/root/TAD_Sim/buildin/simdeps/:$LD_LIBRARY_PATH" }, "cwd": "${workspaceFolder}" } ] } ``` -------------------------------- ### Main Business Sequence Diagram - PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/sim_label/README.md This PlantUML sequence diagram details the interaction flow between SimSDK and the simlabel module, including data processing steps, queue interactions, and data persistence to disk. It outlines the initialization, reset, step-by-step data processing, and stop phases of the simulation annotation process. ```PlantUML @startuml\nSimSDK -> Simlabel: init\nSimSDK -> Simlabel: reset\nSimlabel -> Scene: 读取传感器数据\nScene -> Simlabel: 计算camera和语义相机的配对关系\nSimSDK -> Simlabel: step\ncollections DataQueue\nSimlabel -> DataQueue: 将image/pointcloud/truth加入数据队列\nSimlabel -> DataQueue: 通知队列并对齐\nDataQueue --> DataQueue: 数据不全就等待\nqueue WriteQueue\nDataQueue -> WriteQueue: 写入一条标注\ndatabase Disk\nWriteQueue ->Disk: 落盘\nSimSDK -> SimSDK: step by step\nSimSDK -> Simlabel: stop\n@enduml ``` -------------------------------- ### System Initialization Flow with PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/LidarSensors/README.md This PlantUML sequence diagram illustrates the initialization process of the Lidar simulation system. It shows how the SimSDK initiates LidarSensor initialization, which then triggers further initializations in TraditionalLidar (for specific lidar types like RS or Hesai) and LidarBufferFun (for data acquisition methods like Depth or Raytracing). ```PlantUML @startuml SimSDK -> LidarSensor: init LidarSensor -> TraditionalLidar: 初始化型号 TraditionalLidar -> "RS or Hesai": 初始化打包 LidarSensor -> LidarBufferFun: 初始化方法 LidarBufferFun -> "Depth or Raytracing": 初始化探测方法 @enduml ``` -------------------------------- ### Business Sequence Diagram - SimSDK and Envpb Interaction Source: https://github.com/tencent/tad_sim/blob/main/simcore/envpb/README.md This PlantUML sequence diagram depicts the interaction flow between SimSDK and the Envpb (environment processing) module. It outlines the sequence of operations including initialization, reset, reading environment configuration, calculating keyframes, stepping, interpolation, broadcasting environment messages, and stopping, illustrating how SimSDK orchestrates environmental data processing. ```PlantUML @startuml SimSDK -> Envpb: init SimSDK -> Envpb: reset Envpb -> Scene: 读取环境配置 Scene -> Envpb: 计算关键帧 SimSDK -> Envpb: step Envpb -> Interpolation: 插值 Interpolation -> SimSDK: 广播环境消息 SimSDK -> SimSDK: step by step SimSDK -> Envpb: stop @enduml ``` -------------------------------- ### Main Thread Interaction Diagram - PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/README.md This PlantUML diagram visualizes the interaction and data flow between the txsim, game, and render threads. It shows txsim interacting with game, game feeding into render, and render influencing the next game state, illustrating the core threading model of the simulation. ```plantuml @startuml rectangle "txsim" rectangle "game" rectangle "render" rectangle "next game" as game2 txsim <-up-> game game -> render render -> game2 @enduml ``` -------------------------------- ### System Structure Diagram - envpb Module Source: https://github.com/tencent/tad_sim/blob/main/simcore/envpb/README.md This PlantUML diagram illustrates the system structure of the envpb module, showing its interactions with Init, Reset, Step, Stop behaviors, Config module, and Interpolation module, which further includes linear, nearest, and corner sub-modules. It visualizes the flow and dependencies within the environment processing system. ```PlantUML @startuml skinparam rectangle<> { roundCorner 25 } sprite $bProcess jar:archimate/business-process sprite $aService jar:archimate/physical-equipment sprite $aBase jar:archimate/actor sprite $aTool jar:archimate/strategy-capability rectangle "Init" as INIT <<$bProcess>><> #Business rectangle "Reset" as RESET <<$bProcess>><> #Business rectangle "Step" as STEP <<$bProcess>><> #Business rectangle "Stop" as STOP <<$bProcess>><> #Business rectangle "envpb" as ENVPB <<$aService>><> #Business INIT -right->> RESET RESET -right->> STEP STEP -right->> STOP INIT -down- ENVPB RESET -down- ENVPB STEP -down- ENVPB STOP -down- ENVPB rectangle "Config" as CONFIG CONFIG -up-> ENVPB rectangle 插值 插值 -up-> ENVPB rectangle linear linear -up-> 插值 rectangle nearest nearest -up-> 插值 rectangle corner corner -up-> 插值 @enduml ``` -------------------------------- ### Building Grading Module on Windows (PowerShell) Source: https://github.com/tencent/tad_sim/blob/main/simcore/grading/README.md This PowerShell snippet navigates to the Grading module's source directory and then executes `build.bat`. This batch script is responsible for generating Visual Studio project files and initiating the compilation process for the Grading module on Windows. ```PowerShell # 进入待编译代码目录下(用户定义) cd TAD_Sim/simcore/grading # 创建 VS 工程文件, 和直接编译 ./build.bat ``` -------------------------------- ### Compiling Grading Module on Ubuntu (Bash) Source: https://github.com/tencent/tad_sim/blob/main/simcore/grading/README.md This Bash command executes the `build.sh` script located in `TAD_Sim/simcore/grading`. This script compiles the Grading module on Ubuntu, assuming all prerequisites like generated `sim_msg` source code and Docker environment are already set up. ```Bash sh ./build.sh ``` -------------------------------- ### System Step Update and Data Flow with PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/LidarSensors/README.md This PlantUML sequence diagram visualizes the step-by-step update process in the Lidar simulation system. It details the flow from SimSDK initiating an update, through Scan Range calculation, LidarBufferFun data acquisition, Buffer queue management, Points simulation, UDP broadcasting, and final result publishing back to SimSDK. ```PlantUML @startuml SimSDK -> Update: step Update -> "Scan Range": 计算探测范围 "Scan Range" -> LidarBufferFun: 获取buffer LidarBufferFun -> "Buffer queue": buffer放入队列 "Buffer queue" -> Points: 模型仿真 Points -> UDP: UDP广播 Points -> Update: 单帧融合 Update -> SimSDK: 广播 SimSDK -> SimSDK: step by step @enduml ``` -------------------------------- ### System Architecture Diagram - PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/CameraSensors/README.md This PlantUML diagram illustrates the overall system architecture for camera sensor simulation. It shows the relationships between core processes (Init, Reset, Step, Stop), the Manager, the Base Actor class, and the various camera types (Camera, Depth, Fisheye, Semantic), highlighting their inheritance hierarchy and dependencies on SensorConfig. ```plantuml @startuml skinparam rectangle<> { roundCorner 25 } sprite $bProcess jar:archimate/business-process sprite $aService jar:archimate/physical-equipment sprite $aBase jar:archimate/actor sprite $aTool jar:archimate/strategy-capability rectangle "Init" as INIT <<$bProcess>><> #Business rectangle "Reset" as RESET <<$bProcess>><> #Business rectangle "Step" as STEP <<$bProcess>><> #Business rectangle "Stop" as STOP <<$bProcess>><> #Business rectangle "Base(Actor)" as BASE <<$aBase>><> #Business rectangle "Manger" as MANGER <<$aService>><> #Business rectangle "SensorConfig" as SENSOR INIT -right->> RESET RESET -right->> STEP STEP -right->> STOP INIT -down- MANGER RESET -down- MANGER STEP -down- MANGER STOP -down- MANGER MANGER -right- BASE SENSOR -up-> MANGER rectangle "Camera" as CAMERA #Application rectangle "Depth" as DEPTH #Application rectangle "Fisheye" as FISHEYE #Application rectangle "Semantic" as SEMANTIC #Application CAMERA -up-> BASE DEPTH -up-> CAMERA FISHEYE -up-> BASE SEMANTIC -up-> CAMERA @enduml ``` -------------------------------- ### System Architecture Diagram - PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/README.md This PlantUML diagram illustrates the high-level system architecture, showing the relationships between core processes like Init, Reset, Step, Stop, and management components (Manger, Base, SensorConfig). It also depicts various sensor types (Camera, Depth, Fisheye, Semantic, Ultrasonic, Lidar, Hesai, Rslidar) and their connections to the Base component. ```plantuml @startuml skinparam rectangle<> { roundCorner 25 } sprite $bProcess jar:archimate/business-process sprite $aService jar:archimate/physical-equipment sprite $aBase jar:archimate/actor sprite $aTool jar:archimate/strategy-capability rectangle "Init" as INIT <<$bProcess>><> #Business rectangle "Reset" as RESET <<$bProcess>><> #Business rectangle "Step" as STEP <<$bProcess>><> #Business rectangle "Stop" as STOP <<$bProcess>><> #Business rectangle "Base" as BASE <<$aBase>><> #Business rectangle "Manger" as MANGER <<$aService>><> #Business rectangle "SensorConfig" as SENSOR INIT -right->> RESET RESET -right->> STEP STEP -right->> STOP INIT -down- MANGER RESET -down- MANGER STEP -down- MANGER STOP -down- MANGER MANGER -right- BASE SENSOR -up-> MANGER rectangle "Camera" as CAMERA #Application rectangle "Depth" as DEPTH #Application rectangle "Fisheye" as FISHEYE #Application rectangle "Semantic" as SEMANTIC #Application rectangle "Ultrasonic" as ULTRA #Application rectangle "Lidar" as LIDAR #Application rectangle "Hesai" as HESAI #Application rectangle "Rslidar" as RS #Application CAMERA -up-> BASE DEPTH -up-> CAMERA FISHEYE -up-> BASE SEMANTIC -up-> CAMERA ULTRA -up-> BASE LIDAR -up-> BASE HESAI -up-> LIDAR RS -up-> LIDAR @enduml ``` -------------------------------- ### Styling the Main Application Container - CSS Source: https://github.com/tencent/tad_sim/blob/main/simapp/desktop/src/renderer/skeleton-main.html This snippet defines the styles for the main application container (`.app`), setting its height to 100%, enabling flexbox for vertical layout, and applying a dark background color. It serves as the root for the application's UI structure. ```CSS .app { height: 100%; display: flex; flex-direction: column; background-color: #020202; } ``` -------------------------------- ### Game Thread Data Flow Diagram - PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/README.md This PlantUML diagram details the four main steps within the game thread for processing business data: read (from message), set (to UE asset), sensor (calculating sensor data, influenced by render), and pub (publishing sensor data). It illustrates the sequence and dependencies of these operations. ```plantuml @startuml rectangle "message" rectangle "UE asset" as asset rectangle "render" rectangle "read" rectangle "set" rectangle "sensor" rectangle "pub" message -down-> read read -> set set -> sensor sensor -> pub set -up-> asset render -down->sensor @enduml ``` -------------------------------- ### Command-Line Usage of Post-processing Script Source: https://github.com/tencent/tad_sim/blob/main/simcore/protobuf_log/README.md This snippet illustrates the command-line syntax for using the post_process script, which converts pblog data into xlsx and json formats. The -f flag is mandatory for specifying the input pblog file, while optional flags like -p, -i, and -s allow users to selectively process specific types of messages, such as trajectory, control, IMU, GPS, or custom messages. ```Bash post_process -f xxx.pblog \ -p \ -i \ -s ``` -------------------------------- ### Embedding Centered Videos in HTML Source: https://github.com/tencent/tad_sim/blob/main/docs/user_guidelines/README.md This HTML snippet demonstrates how to embed a video into a document, centering it and providing standard video controls. It uses a `figure` element with a `center-video` class, a `video` tag with `controls` and `width`, and a `source` tag to specify the video file. ```html
xxxxxx
``` -------------------------------- ### Converting Word to Markdown with Pandoc Source: https://github.com/tencent/tad_sim/blob/main/docs/user_guidelines/README.md This bash command demonstrates how to use Pandoc to convert a Microsoft Word document (`.docx`) into a Markdown (`.md`) file. The `--extract-media` option ensures that any embedded images are extracted and saved to a specified directory, making them accessible for the Markdown output. ```bash ./pandoc -s input.docx -t markdown -o output.md --extract-media=./images ``` -------------------------------- ### SimSDK Radar Component Interaction Sequence Diagram Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/radar/README.md This PlantUML diagram illustrates the main operational sequence involving SimSDK, Radar, Sensor, and RarLib components. It covers initialization, reset, step-by-step execution, and stop operations, showing data flow and control signals between these modules. ```plantuml @startuml SimSDK -> Radar: init SimSDK -> Radar: reset Radar -> Sensor: read Radar -> RarLib: init SimSDK -> Radar: step Radar -> RarLib: 信号输入 RarLib -> Radar: 信号输出 Radar -> SimSDK: OSI广播 SimSDK -> SimSDK: step by step SimSDK -> Radar: stop @enduml ``` -------------------------------- ### Logging Messages in Perfect Control Module Source: https://github.com/tencent/tad_sim/blob/main/simcore/perfect_control/README.md This snippet demonstrates the standard logging macros used within the Perfect Control module. It supports three levels: INFO for general information, WARNING for potential issues, and ERROR for critical failures. These macros are part of a common C++ logging framework, likely glog or a similar library, providing structured output for debugging and monitoring. ```C++ LOG(INFO) LOG(WARNING) LOG(ERROR) ``` -------------------------------- ### System Structure Diagram - PlantUML Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/sim_label/README.md This PlantUML diagram illustrates the high-level system architecture of the simlabel module and its interactions with other components like Init, Reset, Step, Stop processes, and data/write queues. It visually represents the data flow and control relationships within the simulation annotation system. ```PlantUML @startuml\nskinparam rectangle<> {\n roundCorner 25\n}\nsprite $bProcess jar:archimate/business-process\nsprite $aService jar:archimate/physical-equipment\nsprite $aBase jar:archimate/actor\nsprite $aTool jar:archimate/strategy-capability\n\nrectangle "Init" as INIT <<$bProcess>><> #Business\nrectangle "Reset" as RESET <<$bProcess>><> #Business\nrectangle "Step" as STEP <<$bProcess>><> #Business\nrectangle "Stop" as STOP <<$bProcess>><> #Business\nrectangle simlabel <<$aService>><> #Business\n\nINIT -right->> RESET\nRESET -right->> STEP\nSTEP -right->> STOP\nINIT -down- simlabel\nRESET -down- simlabel\nSTEP -down- simlabel\nSTOP -down- simlabel\n\n\n\nrectangle "数据队列" as DATA\nrectangle "写入队列" as WRITE\nDATA <-up- simlabel\nDATA -right-> WRITE\n\n@enduml ``` -------------------------------- ### Markdown Image to Centered HTML Conversion Pattern Source: https://github.com/tencent/tad_sim/blob/main/docs/user_guidelines/README.md This snippet provides a text replacement pattern used to convert standard Markdown image syntax into HTML `div` and `img` tags. This transformation centers the image and sets its width, which is useful for post-processing Markdown files, especially after converting from Word documents. ```text ![](

``` -------------------------------- ### Synthetic Data Directory Structure (Markdown) Source: https://github.com/tencent/tad_sim/blob/main/docs/user_guidelines/user_guidelines_desktop/source/308.仿真合成数据生成.md This markdown snippet illustrates the hierarchical directory structure for generated synthetic data. It shows that data is organized by 'scene_name', containing subdirectories for 'camera' (with JPG images and JSON annotations), 'lidar' (with PCD point clouds and JSON annotations), and 'semantic' (with PNG semantic images and JSON annotations). Each sensor type has its raw data and corresponding OpenLABEL JSON annotation files. ```Markdown scene_name │ ├── camera │ ├── jpg │ │ └── 0000000060_1.jpg │ └── 0000000060_1.json │ ├── lidar │ ├── pcd │ │ └── 0000000100_1.pcd │ └── 0000000100_1.json │ └── semantic ├── png │ └── 0000000060_1.png └── 0000000060_1.json ``` -------------------------------- ### SensorTruth Module Pluggable Architecture (PlantUML) Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/sensor_truth/README.md This PlantUML diagram demonstrates the pluggable architecture of the SensorTruth module. It shows a `Base` abstract class defining common SDK interfaces (Init, Reset, Step, Stop) and a `Manger` class that manages a list of `Base` implementations. Various truth calculation modules like `ParkingSpace`, `LidarTruth`, `CameraTruth`, `SensorTruth`, and `UltrasonicTruth` inherit from the `Base` class, enabling a flexible and extensible design. ```PlantUML @startuml class Base { +void {abstract} Init(InitHelper) +void {abstract} Reset(ResetHelper) +void {abstract} Step(StepHelper) +void {abstract} Stop(StopHelper) } class Manger { +void {abstract} Init(InitHelper) : List->Init +void {abstract} Reset(ResetHelper) : List->Reset +void {abstract} Step(StepHelper) : List->Step +void {abstract} Stop(StopHelper) : List->Stop List } Base --right--> Manger class ParkingSpace { } class LidarTruth { } class CameraTruth { } class SensorTruth { } class UltrasonicTruth { } ParkingSpace -up->Base LidarTruth -up->Base CameraTruth -up->Base SensorTruth -up->Base UltrasonicTruth -up->Base @enduml ``` -------------------------------- ### Project Directory Structure for Camera Sensors Source: https://github.com/tencent/tad_sim/blob/main/simcore/sensors/display/Source/Display/Objects/Sensors/CameraSensors/README.md This snippet outlines the directory structure for the CameraSensors module, detailing the C++ source (.cpp) and header (.h) files for various camera types: CameraSensor (general), DepthSensor, FisheyeSensor, and SemanticCamera. It provides an overview of how different camera functionalities are organized within the codebase. ```text CameraSensors | CameraSensor.cpp 普通相机 | CameraSensor.h | DepthSensor.cpp 深度相机 | DepthSensor.h | FisheyeSensor.cpp 鱼眼相机 | FisheyeSensor.h | SemanticCamera.cpp 语义相机 | SemanticCamera.h ```