博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
behavior planning——10 behaior planning pseudocode
阅读量:6824 次
发布时间:2019-06-26

本文共 2058 字,大约阅读时间需要 6 分钟。

One way to implement a transition function is by generating rough trajectories for each accessible "next state" and then finding the best. To "find the best" we generally use cost functions. We can then figure out how costly each rough trajectory is and then select the state with the lowest cost trajectory.

We'll discuss this in more detail later, but first read carefully through the pseudocode below to get a better sense for how a transition function might work.

def transition_function(predictions, current_fsm_state, current_pose, cost_functions, weights):    # only consider states which can be reached from current FSM state.    possible_successor_states = successor_states(current_fsm_state)    # keep track of the total cost of each state.    costs = []    for state in possible_successor_states:        # generate a rough idea of what trajectory we would        # follow IF we chose this state.        trajectory_for_state = generate_trajectory(state, current_pose, predictions)        # calculate the "cost" associated with that trajectory.        cost_for_state = 0        for i in range(len(cost_functions)) :            # apply each cost function to the generated trajectory            cost_function = cost_functions[i]            cost_for_cost_function = cost_function(trajectory_for_state, predictions)            # multiply the cost by the associated weight            weight = weights[i]            cost_for_state += weight * cost_for_cost_function         costs.append({
'state' : state, 'cost' : cost_for_state}) # Find the minimum cost state. best_next_state = None min_cost = 9999999 for i in range(len(possible_successor_states)): state = possible_successor_states[i] cost = costs[i] if cost < min_cost: min_cost = cost best_next_state = state return best_next_state

Obviously we are glossing over some important details here. Namely: what are these cost functions and how do we create them? We'll talk about that next!

转载于:https://www.cnblogs.com/fuhang/p/8983828.html

你可能感兴趣的文章
8086汇编指令速查手册
查看>>
j2EE web.xml中的url-pattern的映射规则
查看>>
设计模式之单例模式
查看>>
获取客户端ip地址
查看>>
sessionid如何产生?由谁产生?保存在哪里?
查看>>
oracle 监听服务异常
查看>>
网络流——最大流Dinic算法
查看>>
下面的div浮动上来了
查看>>
程序员生存定律
查看>>
windows 下搭建 apache + php52 + postgreSQL7/8/9环境
查看>>
python正则表达式
查看>>
分布式系统的面试题3
查看>>
带输入输出参数的存储过程
查看>>
CSS3 3D酷炫立方体变换动画
查看>>
1B. Spreadsheets
查看>>
$(selector).each()和$.each()的区别
查看>>
Java并发编程:线程池的使用
查看>>
C++学习笔记01
查看>>
C# 反射机制
查看>>
c++ 2.1 编译器何时创建默认构造函数
查看>>