# Air-Arena **Repository Path**: zhangLinZuo/airsim-simulator-manager ## Basic Information - **Project Name**: Air-Arena - **Description**: Air-Arena is a comprehensive framework for automating UAV testing and scene management in AirSim-based simulation environments. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 6 - **Forks**: 4 - **Created**: 2024-12-13 - **Last Updated**: 2025-08-31 ## Categories & Tags **Categories**: testing **Tags**: None ## README # Air-Arena ## Introduction Air-Arena is an automated testing framework designed for AirSim-based simulation environments. It provides features for simulation control, automated testing, result recording, and web-based management. ## Usage ### Setting Up the Simulator 1. Package the simulator and place it in the Ubuntu environment. 2. Create an `auto_cast.args` file in the `SIMULATOR_PROJECT_FOLDER` with the following structure: ```plaintext --window-title circle_obstacle --record-output-dir record --start-trigger-box StartTriggerBox # optional --end-trigger-box EndTriggerBox # optional --settings-file settings.json --simulator-script circle_obstacle.sh --scene-config-file scene_config.json # optional ``` 3. Launch the simulator using: ```bash ./start.sh /path/to/SIMULATOR_PROJECT_FOLDER ``` When setting up the scene, ensure that a **Start Trigger Box** and an **End Trigger Box** are created. The manager will automatically track the number of laps completed by the actor in the scene, publishing this information as a ROS topic. --- ## Screen Recording and Web Interface Air-Arena includes a built-in screen recording feature and a web-based frontend for managing test results: - **Accessing the Frontend** - **IP Address**: Defined in `settings.json` or set via `--page-ip`. - **Port**: `5342`

<\p> - **WebSocket API** - **Address**: `localhost:8765` - Used for video tag updates and PLY file generation. ### WebSocket Interface #### Send Data **Update Video Tags** ```json { "type": "update_video_tags", "video_path": "path/to/video.mp4", "video_tags": ["tag1", "tag2"] } ``` **Request PLY File** ```json { "type": "get_ply", "save_path": "path/to/save/ply" } ``` **Reset Simulator** ```json { "type": "reset" } ``` #### Receive Data **Success Response** ```json { "status": "success", "message": "Received your data" } ``` **Error Response** ```json { "status": "error", "message": "Error details" } ``` --- ## Scene Reset Functionality The `reset_scene` feature allows for dynamic reconfiguration of the simulation environment using a JSON configuration file. ### Steps 1. **Create a JSON File** Define objects, randomization parameters, and constraints: ```json { "objects": [ { "name": "Object1", "rand_pos": [[-5, 5], [-5, 5], [0, 5]], "rand_rot": [[0, 360], [0, 0], [0, 360]], "rand_scale": [[0.8, 1.2], [0.8, 1.2], [0.8, 1.2]], "maintain_aspect_ratio": true, "priority": 1 } ], "swarms":[ { "objects": ["Object1","Object2","Object3"], "rand_pos": [[-5, 5], [-5, 5], [0, 5]], "rand_rot": [[0, 360], [0, 0], [0, 360]], "priority": 0 } ], "constraints": [ { "type": "distance", "obj1": "Object1", "obj2": "Object2", "value": [3, 0, 0] } ] } ``` 2. **Use the Configuration** Pass the file to the program via `--scene-config-file`. 3. **Trigger Reset** The reset occurs when a message is published to the topic defined by `--reset-topic` (default: `/auto_test/reset`). --- ## Auto Testing Automate UAV testing with streamlined control, monitoring, and result storage. ### Steps 1. **Prepare the Task Script** - Create a `.sh` file that launches the UAV and performs the desired tasks within the simulator. - **Important**: The `.sh` file must accept at least one argument. The **first argument** must be the output directory where the results will be saved. 2. **Start the Simulator** - Launch the simulator in the Ubuntu environment and ensure it is functioning correctly and ready to respond to control commands from the task script. 3. **Run the Auto-Test Command** - Use the `auto_test.py` script to start the automated testing process. This script will execute the `.sh` file, monitor the UAV's performance, and handle result recording. Example command: ```bash ./auto_test.py --finish-line 40 --trigger-topic "/bfctrl/cmd" --odom-topic "/bfctrl/local_odom" \ --collision-topic "/airsim_node/drone_1/collision" --max-iter 20 --max-time 60 \ --shfile "tools/avd_mpc.sh" --output_dir "./output" --test-args arg1 arg2 --tags "2mps" ``` ### Arguments | Argument | Type | Default Value | Description | |----------------------|---------------|-----------------------|-------------------------------------------------------------------------------------------------| | `--finish-line` | `float` | `40` | Distance threshold for task completion. | | `--trigger-topic` | `str` | `/bfctrl/cmd` | Topic for control commands. Collision data is recorded on receiving commands. | | `--odom-topic` | `str` | `/bfctrl/local_odom` | Topic for UAV odometry data. | | `--collision-topic` | `str` | `/airsim_node/drone_1/collision` | Topic for detecting collisions. | | `--max-iter` | `int` | `20` | Maximum test iterations. | | `--max-time` | `int` | `60` | Maximum time (seconds) per test run. | | `--shfile` | `str` | `tools/avd_mpc.sh` | Path to the `.sh` file for launching UAV. | | `--output_dir` | `str` | `./output` | Directory for test results. | | `--tags` | `list` | `["2mps"]` | Scenario description tags for database and frontend display. | | `--save-ply` | `store_true` | `False` | Save PLY files. | --- ## Recommended Tools For resetting AirSim, we recommend the [AirSim ROS Wrapper](https://gitee.com/zhangLinZuo/airsim-roswrapper). This wrapper simplifies reset operations, making integration seamless. Alternatively, include `--auto-reset-airsim` in the `auto_cast.args` file to reset AirSim via the `reset-topic`. --- ## Contact Information and Future Updates For any questions, suggestions, or feedback, feel free to contact me at: - **Email**: [zhanglinzuo@sjtu.edu.cn]