机器人概率定位学习笔记第二篇_使用python建立机器人感知函数(sense fuction)

本笔记学习于优达学城 Artificial Intelligence for Robotics课程

1,用python实现一个Uniform Probability 均衡概率数组,五个概率。

answer:

p=[]
n=5
for i in range(0,n):
    p.append(1.0/n)
print p

2,先看下图 假设世界有5个方格,机器人在哪个方格的概率是一样的,所以在每个方格为概率是0.2。接下来,让每个方格有不同的颜色,三个绿色,两个红色。

ok,下一步机器人开始感知了,机器人感知到的颜色是红色,这个是条件,所以明显的看出,在x2,x3位置处的概率应该变大,而在x1,x3,x4位置处的概率应该变小。

所以我们让正确的位置处乘以0.6,即红色位置处乘以0.6,绿色位置乘以0.2,这个两个数是随机的,但是很明显0.6是0.2的三倍。

最后计算,机器人感知之后带来的概率影响,计算每个方格的概率?

answer:0.04,0.04,0.12,0.12,0.04

3,但是上面的结果总和并不是1,所以我们要计算他们总和,并normalize distribution 标准化概率。简单的python代码可以如下

p=[]
n=5
for i in range(0,n):
    p.append(1.0/n)
p[0]=p[0]*0.2
p[1]=p[1]*0.6
p[2]=p[2]*0.6
p[3]=p[3]*0.2
p[4]=p[4]*0.2
sum1=sum(p)
for i in range(0,5):
    p[i]=p[i]/sum1
print p
4,感知方程 sense fuction ,现在我们就是要做一个感知方程,并均值化感知后的概率,python代码如下
p=[0.2, 0.2, 0.2, 0.2, 0.2]
world=['green', 'red', 'red', 'green', 'green']
Z = 'red'
pHit = 0.6
pMiss = 0.2

def sense(p, Z):
    q=[]
    for i in range(len(p)):
        hit = (Z == world[i])
        q.append(p[i] * (hit * pHit + (1-hit) * pMiss))
    a =sum(q)
    for i in range(len(q)):
        q[i]=q[i]/a
    return q
print sense(p,Z)

5,多次感知,假设现在机器人第一次感知到红色,第二次又感知到绿色,求出最后的概率

answer:

p=[0.2, 0.2, 0.2, 0.2, 0.2]
world=['green', 'red', 'red', 'green', 'green']
measurements = ['red', 'green']
pHit = 0.6
pMiss = 0.2

def sense(p, Z):
    q=[]
    for i in range(len(p)):
        hit = (Z == world[i])
        q.append(p[i] * (hit * pHit + (1-hit) * pMiss))
    s = sum(q)
    for i in range(len(q)):
        q[i] = q[i] / s
    return q
#
#ADD YOUR CODE H
for i in range(len(measurements)):
    p=sense(p,measurements[i])

print p




About This Book, Design, simulate, build and program an interactive autonomous mobile robotProgram Robot Operating System using PythonGet a grip on the hands-on guide to robotics for learning various robotics concepts and build an advanced robot from scratch, Who This Book Is For, If you are an engineer, a researcher, or a hobbyist, and you are interested in robotics and want to build your own robot, this book is for you. Readers are assumed to be new to robotics but should have experience with Python., What You Will Learn, Understand the core concepts and terminologies of robotics Create 2D and 3D drawings of robots using freeware such as LibreCAD and Blender Simulate your robot using ROS and Gazebo Build robot hardware from the requirements Explore a diverse range of actuators and its interfacing Interface various robotic sensors to robots Set up and program OpenCV, OpenNI, and PCL to process 2D/3D visual data Learn speech processing and synthesis using Python Apply artificial intelligence to robots using Python Build a robot control GUI using Qt and Python Calibration and testing of robot, In Detail, Learning about robotics will become an increasingly essential skill as it becomes a ubiquitous part of life. Even though robotics is a complex subject, several other tools along with Python can help you design a project to create an easy-to-use interface., Learning Robotics Using Python is an essential guide for creating an autonomous mobile robot using popular robotic software frameworks such as ROS using Python. It also discusses various robot software frameworks and how to go about coding the robot using Python and its framework. It concludes with creating a GUI-based application to control the robot using buttons and slides., By the end of this tutorial, you'll have a clear idea of how to integrate and assemble all things into a robot and how to bundle the software package.
Design, simulate, and program interactive robots Key Features Design, simulate, build, and program an interactive autonomous mobile robot Leverage the power of ROS, Gazebo, and Python to enhance your robotic skills A hands-on guide to creating an autonomous mobile robot with the help of ROS and Python Book Description Robot Operating System (ROS) is one of the most popular robotics software frameworks in research and industry. It has various features for implement different capabilities in a robot without implementing them from scratch. This book starts by showing you the fundamentals of ROS so you understand the basics of differential robots. Then, you'll learn about robot modeling and how to design and simulate it using ROS. Moving on, we'll design robot hardware and interfacing actuators. Then, you'll learn to configure and program depth sensors and LIDARs using ROS. Finally, you'll create a GUI for your robot using the Qt framework. By the end of this tutorial, you'll have a clear idea of how to integrate and assemble everything into a robot and how to bundle the software package. What you will learn Design a differential robot from scratch Model a differential robot using ROS and URDF Simulate a differential robot using ROS and Gazebo Design robot hardware electronics Interface robot actuators with embedded boards Explore the interfacing of different 3D depth cameras in ROS Implement autonomous navigation in ChefBot Create a GUI for robot control Who this book is for This book is for those who are conducting research in mobile robotics and autonomous navigation. As well as the robotics research domain, this book is also for the robot hobbyist community. You're expected to have a basic understanding of Linux commands and Python. Table of Contents Getting started with ROS Understanding basics of differential robots Modeling the Differential Drive Robot Simulating a Differential Drive Robot Using ROS Designing ChefBot Hardware and Circuits Interfacing Actuators and Sensors to the Robot Controller Interfacing Vision Sensors with ROS Building ChefBot Hardware and the Integration of Software Designing a GUI for a Robot Using Qt and Python Assessments 设计,模拟和编程交互式机器人 主要特征 设计,模拟,构建和编程交互式自主移动机器人 利用ROS,Gazebo和Python的强大功能来增强您的机器人技能 在ROS和Python的帮助下创建自主移动机器人的实用指南 书说明 机器人操作系统(ROS)是研究和工业中最流行的机器人软件框架之一。它具有各种功能,可以在机器人中实现不同的功能而无需从头开始实现。 本书首先向您展示ROS的基础知识,以便您了解差分机器人的基础知识。然后,您将学习机器人建模以及如何使用ROS设计和模拟它。继续,我们将设计机器人硬件和接口执行器。然后,您将学习使用ROS配置和编程深度传感器和激光雷达。最后,您将使用Qt框架为您的机器人创建GUI。 在本教程结束时,您将清楚地了解如何将所有内容集成并组装到机器人中以及如何捆绑软件包。 你会学到什么 从头开始设计差速机器人 使用ROS和URDF建模差分机器人 使用ROS和Gazebo模拟差分机器人 设计机器人硬件电子 带嵌入式板的接口机器人执行器 探索ROS中不同3D深度相机的接口 在ChefBot中实现自主导航 为机器人控制创建GUI 这本书的用途是谁 本书适用于从事移动机器人和自主导航研究的人员。除了机器人研究领域,本书也适用于机器人爱好者社区。您应该对Linux命令和Python有基本的了解。 目录 ROS入门 了解差分机器人的基础知识 差动驱动机器人的建模 使用ROS模拟差分驱动机器人 设计ChefBot硬件和电路 将执行器和传感器连接到机器人控制器 将视觉传感器与ROS连接 构建ChefBot硬件和软件集成 使用Qt和Python机器人设计GUI 评估
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值