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 =
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 =
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!

最新文章

  1. 【CF 710F】String Set Queries
  2. 第八周PSP
  3. eclipse的历史版本及下载
  4. SAP BW 通过视图创建数据源(无单位)
  5. 一款仿36氪iOS版APP源码
  6. Node.js 初探
  7. 容器 set
  8. GDI+ 中发生一般性错误(在 OutputStream 中保存 PNG 格式图像时遇到的问题)
  9. MFC 单文档中动态添加菜单项和响应菜单事件
  10. Flood it 游戏
  11. HDU 1258 Sum It Up(DFS)
  12. css遇到的那些坑——浏览器默认样式设置
  13. java中string.trim()函数的使用
  14. vue 引入iconfont字体库
  15. FTRL优化算法
  16. Linux 各种运算符
  17. sqlite 字符串拼接
  18. MATLAB 不能保存变量问题及解决办法
  19. PLSQL连接ORACLE配置字符串简介 oracle网络配置 三个配置文件 listener.ora、sqlnet.ora、tnsnames.ora原理解释
  20. 对象的操作-javascript

热门文章

  1. python Pandas文件读写
  2. 洛谷P1314 [NOIP2011提高组Day2T2] 聪明的质监员
  3. 微信小程序之项目的创建
  4. 数据库通过sql备份脚本恢复时,报错误The user specified as a definer (&#39;root&#39;@&#39;%&#39;) does not exist
  5. setStorage、getStorage、 removeStorage 封装
  6. 【JZOJ3601】【广州市选2014】Tree(tree)
  7. React高阶组件 和 Render Props
  8. [Vue CLI 3] 插件开发之 registerCommand 到底做了什么
  9. day39-Spring 19-今天的内容总结
  10. SPSS函数之期和时间函数