AFSim学习-mission平台移动
添加平台平台类型 TARGET具体平台 target01阵营 blue初始位置 position# One Platform Demoend_time10sec platform_type TARGET WSF_PLATFORM end_platform_type platform target01 TARGET side blue position39:38:18.98n75:55:20.79w end_platform execute at_time0.1sec absolute writeln(One platform demo started.);end_execute execute at_time5sec absolute writeln(Simulation reached 5 sec.);end_execute执行./build/mission-mi1/home/ubuntu/afsim_ws/project1/7-one-platform/one_platform.txt移动平台在1s时间输出在30s时间输出在60s时间输出输出内容读取平台名读取经纬度读取高度读取速度读取航向end_time60sec platform_type SIMPLE_AIRCRAFT WSF_PLATFORM mover WSF_AIR_MOVER end_mover end_platform_type platform blue_1 SIMPLE_AIRCRAFT side blue position38:49:12.88n93:08:16.09w altitude35000ft msl heading90deg route position38:49:12.88n93:08:16.09w altitude35000ft msl speed500kts position38:49:12.11n89:52:40.60w altitude35000ft msl speed500kts end_route execute at_time1sec absolute writeln(T1 name, PLATFORM.Name());writeln(T1 location, PLATFORM.Location());writeln(T1 lat, PLATFORM.Latitude(), lon, PLATFORM.Longitude(), alt_m, PLATFORM.Altitude(), speed, PLATFORM.Speed(), heading_deg, PLATFORM.Heading());end_execute execute at_time30sec absolute writeln(T30 name, PLATFORM.Name());writeln(T30 location, PLATFORM.Location());writeln(T30 lat, PLATFORM.Latitude(), lon, PLATFORM.Longitude(), alt_m, PLATFORM.Altitude(), speed, PLATFORM.Speed(), heading_deg, PLATFORM.Heading());end_execute execute at_time60sec absolute writeln(T60 name, PLATFORM.Name());writeln(T60 location, PLATFORM.Location());writeln(T60 lat, PLATFORM.Latitude(), lon, PLATFORM.Longitude(), alt_m, PLATFORM.Altitude(), speed, PLATFORM.Speed(), heading_deg, PLATFORM.Heading());end_execute end_platform execute at_time0.1sec absolute writeln(Moving platform demo started.);end_execute execute at_time30sec absolute writeln(Simulation reached 30 sec.);end_execute执行显示仿真推进时间信息./build/mission-mi10/home/ubuntu/afsim_ws/project1/8-moving-platform/moving_platform.txt隐藏推进时间不打印时间./build/mission-sm/home/ubuntu/afsim_ws/project1/8-moving-platform/moving_platform.txt周期输出平台信息每隔10s输出# 周期性输出平台状态end_time60sec platform_type SIMPLE_AIRCRAFT WSF_PLATFORM mover WSF_AIR_MOVER end_mover end_platform_type platform blue_1 SIMPLE_AIRCRAFT side blue position38:49:12.88n93:08:16.09w altitude35000ft msl heading90deg route position38:49:12.88n93:08:16.09w altitude35000ft msl speed500kts position38:49:12.11n89:52:40.60w altitude35000ft msl speed500kts end_route execute at_time0.1sec absolute writeln(time,name,lat,lon,alt_m,speed_mps,heading_deg);end_execute execute at_interval_of10sec writeln(TIME_NOW,,, PLATFORM.Name(),,, PLATFORM.Latitude(),,, PLATFORM.Longitude(),,, PLATFORM.Altitude(),,, PLATFORM.Speed(),,, PLATFORM.Heading());end_execute end_platform execute at_time0.1sec absolute writeln(Moving platform demo started.);end_execute execute at_time30sec absolute writeln(Simulation reached 30 sec.);end_execute执行./build/mission-sm/home/ubuntu/afsim_ws/project1/8-moving-platform/moving_platform.txt注意第一次触发点不是 10 秒而是从 AFSIM 内部安排的某个起始事件时间开始。用processor定时输出把这些代码放到一个 processor 里让它像“平台上的一个组件”一样周期运行。# Script Processor Demoend_time60sec platform_type SIMPLE_AIRCRAFT WSF_PLATFORM mover WSF_AIR_MOVER roll_rate_limit1rad/sec default_linear_acceleration1.0g default_radial_acceleration6.5g default_climb_rate400fps maximum_climb_rate400fps maximum_speed600.0knots minimum_speed150.0knots maximum_altitude50000ft minimum_altitude50ft maximum_linear_acceleration9g at_end_of_path extrapolate turn_rate_limit4.0deg/sec end_mover processor state_logger WSF_SCRIPT_PROCESSOR update_interval10sec on_update writeln(TIME_NOW,,, PLATFORM.Name(),,, PLATFORM.Latitude(),,, PLATFORM.Longitude(),,, PLATFORM.Altitude(),,, PLATFORM.Speed(),,, PLATFORM.Heading());end_on_update end_processor end_platform_type platform blue_1 SIMPLE_AIRCRAFT side blue position38:49:12.88n93:08:16.09w altitude35000ft msl heading90deg route position38:49:12.88n93:08:16.09w altitude35000ft msl speed500kts position38:49:12.11n89:52:40.60w altitude35000ft msl speed500kts end_route execute at_time0.1sec absolute writeln(time,name,lat,lon,alt_m,speed_mps,heading_deg);end_execute end_platform运行./build/mission-sm/home/ubuntu/afsim_ws/project1/9-script-processor/script_processor_demo.txt输出mission: WSF Version:2.9.0 02-25-2022 Built: Jun30202618:34:10 Plugin API version info: Version:2.9Compiler: lnx_90400_64bit_release-hwe Extensions Included: sensor_plot_lib, wsf_cyber, wsf_grammar_check, wsf_l16, wsf_mil, wsf_mil_parser, wsf_mtt, wsf_nx, wsf_parser, wsf_ripr, wsf_space, wsf_weapon_server, wsf_simdis Loading simulation input. Loading simulation input complete. Elapsed Wall Clock Time:0.000632Elapsed Processor Time:0Initializing simulation. Initializing simulation complete. Elapsed Wall Clock Time:0.00109Elapsed Processor Time:0Starting simulation.0,blue_1,38.8202,-93.1378,10668,257.222,88.9829 time,name,lat,lon,alt_m,speed_mps,heading_deg10,blue_1,38.8206,-93.1082,10668,257.222,89.005520,blue_1,38.821,-93.0786,10668,257.222,89.02430,blue_1,38.8214,-93.0491,10668,257.222,89.042440,blue_1,38.8218,-93.0195,10668,257.222,89.060950,blue_1,38.8222,-92.9899,10668,257.222,89.079460,blue_1,38.8226,-92.9603,10668,257.222,89.0978 Simulation complete Elapsed Wall Clock Time:0.000144Elapsed Processor Time:0