Velocity 解析多层Map

针对Map<String,Map<String,String>> 的情况


#foreach($other in ${otherParamMap.keySet()})//这里是遍历第一层Map
<table class="table_A">
<caption>$other</caption>//取出第一层Map的key值
<tbody>
#foreach($key in ${otherParamMap.get($other).keySet()})//这里是遍历第二层Map
<tr>
<th>$key</th>//第二层Map中的key
<td>${otherParamMap.get($other).get($key)}</td>//取出第二层Map中的值
</tr>
#end
</tbody>
</table>
#end


ps: Velocity这玩意没法调试还真是郁闷..来来回回的试了很多次才弄对...
function traditionalAPF3d() % 参数初始化 gridSize = [30, 30, 15]; % X,Y,Z维度 start = [3, 3, 2]; % 起点(地面层上方) goal = [28, 28, 5]; % 目标点 simTime = 80; % 总模拟时间 dt = 0.2; % 时间步长 % 生成城市环境 [staticMap, buildings] = generateCityMap(gridSize, 0.4); % 初始化动态障碍物 dynamicObstacles = initializeDrones(gridSize); % 执行APF路径规划 [path, dynPaths] = APF_3D_Urban(start, goal, staticMap, dynamicObstacles, simTime, dt); % 路径后处理 smooth_path = smoothTrajectory(path, staticMap); % 三维可视化 visualizeUrbanEnv(staticMap, buildings, dynamicObstacles, path, smooth_path, dynPaths, start, goal); end %% 城市环境生成函数 function [staticMap, buildings] = generateCityMap(gridSize, density) staticMap = zeros(gridSize); buildings = []; % 初始化为空数组 % 生成随机建筑 for x = 5:5:gridSize(1)-5 for y = 5:5:gridSize(2)-5 if rand() < density % 生成随机高度建筑(3-10层) h = randi([3,10]); staticMap(x-1:x+1, y-1:y+1, 1:h) = 1; buildings(end+1) = struct('position',[x,y], 'height',h); end end end end %% 动态障碍物初始化 function drones = initializeDrones(gridSize) drones = cell(3,1); % 悬停型无人机 drones{1} = struct('position',[15,15,5], 'velocity',[0,0,0], 'type','hover'); % 水平移动无人机 drones{2} = struct('position',[10,20,4], 'velocity',[0.3,0,0], 'type','horizontal'); % 垂直移动无人机 drones{3} = struct('position',[20,10,3], 'velocity',[0,0,0.2], 'type','vertical'); end %% 改进APF核心算法 function [path, dynPaths] = APF_3D_Urban(start, goal, staticMap, drones, simTime, dt) path = start; currentPos = start; dynPaths = cell(length(drones),1); for i = 1:length(drones) dynPaths{i} = drones{i}.position; end % 参数配置 k_att = 0.8; % 吸引力系数 k_rep = 1.2; % 斥力系数 rep_radius = 5; % 斥力作用半径 for t = 0:dt:simTime % 更新动态障碍物位置
最新发布
03-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值