【计算机科学速成课】- 第三十七章机器人-Robots
时间:2021-9-14 作者:smarteng 分类: 课程视频
第三十七章机器人-Robots
翻译内容
Hi, I’m Carrie Anne, and welcome to Crash Course Computer Science!
嗨,我是 Carrie Anne,欢迎收看计算机速成课
Today we’re going to talk about robots.
今天 我们要讨论机器人
The first image that jumps to your mind is probably a humanoid robot,
你脑中冒出来的第一个印象估计是 类人机器人
like we usually see in shows or movies.
经常在电视剧和电影里看到.
Sometimes they’re our friends and colleagues,
有时候它们是朋友和同事
but more often, they're sinister, apathetic and battle-hardened.
但更常见的是阴险无情,身经百战
We also tend to think of robots as a technology of the future.
我们经常把机器人看成未来科技
But the reality is: they’re already here – by the millions
但事实是:机器人时代已经来临了
– and they're our workmates,
- 它们是同事
helping us to do things harder, better, faster, and stronger.
帮我们把困难的工作,做得更快更好
There are many definitions for robots, but in general,
机器人的定义有很多种,但总的来说,
these are machines capable of carrying out a series of actions automatically
机器人由计算机控制,可以自动执行一系列动作的机器
guided by computer control.
机器人由计算机控制,可以自动执行一系列动作的机器
How they look isn’t part of the equation –
外观并不重要
robots can be industrial arms that spray paint cars,
可以是给汽车喷漆的机械臂
drones that fly, snake-like medical robots that assist surgeons,
无人机,或辅助外科医生的蛇状机器人
as well as humanoid robotic assistants.
以及人形机器人
Although the term "robot" is sometimes
有时我们叫虚拟人物"机器人"
applied to interactive virtual characters,
有时我们叫虚拟人物"机器人"
it’s more appropriate to call these "bots", or even better, "agents."
但叫 bot 甚至 agent 会更合适
That’s because the term "robot" carries a physical connotation
因为"机器人"的潜在含义是 存在于现实世界中的机器
a machine that lives in and acts on the real world.
因为"机器人"的潜在含义是 存在于现实世界中的机器
The word "robot" was first used in a 1920 Czech play
robot (机器人) 一词 \N 首次出现在1920年的一部捷克戏剧
to denote artificial, humanoid characters.
代表人造的类人角色
The word was derived from "robota", the slavic-language word for a forced laborer,
robot 源于斯拉夫语词汇 robota \N 代表强迫劳动
indicating peasants in compulsory service in feudal, nineteenth century Europe.
代表农民在十九世纪 \N 欧洲封建社会的强迫劳动
The play didn’t go too much into technological details.
戏剧没讲太多技术细节
But, even a century later, it’s still a common portrayal:
但即使一个世纪后,这种描述依然很普遍:
mass-produced, efficient, tireless creatures that look human-esque,
机器人都是大规模生产,高效不知疲倦,看起来像人的东西
but are emotionless, indifferent to self-preservation and lack creativity.
但毫无情感,不会保护自己,没有创造力
The more general idea of self-operating machines
更广义的自动运行机器,早在1920年代前就有了
goes back even further than the 1920s.
更广义的自动运行机器,早在1920年代前就有了
Many ancient inventors created mechanical devices that
很多古代发明家 \N 发明了能自动运行的机械装置
performed functions automatically,
很多古代发明家 \N 发明了能自动运行的机械装置
like keeping the time and striking bells on the hour.
比如计时和定时敲钟
There are plenty of examples of automated animal and humanoid figures,
有很多装置 有动物和人类的形象 \N 能跳舞,唱歌,打鼓等
that would perform dances, sing songs, strike drums and do other physical actions.
有很多装置 有动物和人类的形象 \N 能跳舞,唱歌,打鼓等
These non-electrical and certainly non-electronic machines were called automatons.
这些不用电,而且肯定没有电子部件的机器,叫"自动机"
For instance, an early automaton created in 1739
举个例子 \N 1739年法国人 Jacques de Vaucans 做了个自动机
by the Frenchman Jacques de Vaucanson
举个例子 \N 1739年法国人 Jacques de Vaucans 做了个自动机
was the Canard Digerateur or Digesting Duck,
法语叫 Canard Digerateur,翻译过来是 "吃饭鸭"
a machine in the shape of a duck that appeared
一个像鸭子的机器,能吃东西然后排便
to eat grain and then defecate.
一个像鸭子的机器,能吃东西然后排便
In 1739 Voltaire wrote,
伏尔泰在1739年写
"Without the voice of le Maure and Vaucanson’s duck,
"如果没有吃饭鸭的声音
you would have nothing to remind you of the glory of France."
还有什么能提醒你法国的荣光呢?"
One of the most infamous examples was the "Mechanical Turk":
一个名声很臭的例子是"土耳其行棋傀儡"
a chess-playing, humanoid automaton.
一个能下国际象棋的人形机器人
After construction in 1770, it toured all over Europe,
在1770年建造完成后,就在欧洲各地展览
wowing audiences with its surprisingly good chess-playing.
好棋艺惊叹观众
It appeared to be a mechanical, artificial intelligence.
像某种机械人工智能
Unfortunately, it was a hoax – there was a dainty human stuffed inside the machine.
不幸的是,这是个骗局 - 机器里有人控制
The first machines controlled by computers emerged in the late 1940s.
第一台计算机控制的机器,出现在1940年代晚期
These Computer Numerical Control, or CNC machines,
这些计算机数控的机器,简称 CNC 机器
could run programs that instructed a machine to perform a series of operations.
可以执行一连串 程序指定的操作
This level of control also enabled the creation of new manufactured goods,
精细的控制 让我们能生产之前很难做的物品
like milling a complex propellor design out of a block of aluminum
比如从一整块铝 加工出复杂的螺旋桨
– something that was difficult to do using standard machine tools,
- 这用普通机械工具很难做到
and with tolerances too small to be done by hand.
并且误差容忍度很小,无法手工加工
CNC machines were a huge boon to industry,
CNC 机器大大推进了制造业
not just due to increased capability and precision,
不仅提高了制造能力和精确度 还降低了生产成本
but also in terms of reducing labor costs by automating human jobs
不仅提高了制造能力和精确度 还降低了生产成本
– a topic we'll revisit in a later episode.
- 我们之后会深入讨论这个(第40集)
The first commercial deployment was a programmable industrial robot
第一个商业贩卖的 可编程工业机器人
called the Unimate, sold to General Motors in 1960
叫 Unimate,于1960年卖给通用汽车公司
to lift hot pieces of metal from a die casting machine and stack them.
它可以把压铸机做出来的热金属成品提起来,然后堆起来
This was the start of the robotics industry.
机器人行业由此开始
Soon, robots were stacking pallets, welding parts, painting cars and much more.
很快,机器人开始堆叠货盘,焊接,给汽车喷漆等等
For simple motions – like a robotic gripper that moves back and forth on a track
对于简单运动 - 比如机器爪子 在轨道上来回移动
a robot can be instructed to move to a particular position,
可以指示它移动到特定位置
and it'll keep moving in that direction until the desired position is reached
它会一直朝那个方向移动,直到到达 \N 然后停下来
at which point it’ll stop.
它会一直朝那个方向移动,直到到达 \N 然后停下来
This behavior can be achieved through a simple control loop.
这种行为 可以用简单控制回路做
First, sense the robot position.
首先,判断机器人的位置
Are we there yet?
我们到了吗?
Nope.
没有
So keep moving.
那么继续前进
Now sense position again.
再次判断位置
Are we there yet?
我们到了吗?
Nope, so keep moving.
没有,所以继续前进
Are we there yet?
我们到了吗?
Yes!
是的!
So we can stop moving, and also please be quiet!
现在可以停下来了,别问了!
Because we’re trying to minimize the distance between
因为我们在不断缩小 当前位置和目标位置的距离
the sensed position and the desired position,
因为我们在不断缩小 当前位置和目标位置的距离
this control loop is, more specifically, a negative feedback loop.
这个控制回路 更准确的叫"负反馈回路"
A negative feedback control loop has three key pieces.
负反馈回路 有三个重要部分
There’s a sensor, that measures things in the real world,
首先是一个传感器,可以测量现实中的东西
like water pressure, motor position, air temperature,
比如水压,马达位置,气温,
or whatever you’re trying to control.
或任何你想控制的东西
From this measurement, we calculate how far we are from
根据传感器,计算和目标值相差多大
where we want to be – the error.
得到一个"错误"
The error is then interpreted by a controller,
然后"控制器"会处理这个"错误"
which decides how to instruct the system to minimize that error.
决定怎么减小错误
Then, the system acts on the world though pumps, motors,
然后用泵,电机,加热元件,或其他物理组件来做出动作
heating elements, and other physical actuators.
然后用泵,电机,加热元件,或其他物理组件来做出动作
In tightly controlled environments, simple control loops, like this, work OK.
在严格控制的环境中,这种简单控制回路也够用了
But in many real world applications, things are a tad more complicated.
但在很多现实应用中,情况复杂得多
Imagine that our gripper is really heavy, and even when the control loop says to stop,
假设爪子很重,哪怕控制回路叫停了
momentum causes the gripper to overshoot the desired position.
惯性让爪子超过了预期位置
That would cause the control loop to take over again,
然后控制回路又开始运行
this time backing the gripper up.
叫爪子移动回去
A badly tuned control loop might overshoot and overshoot and overshoot,
一个糟糕的控制回路 可能会让爪子不断来回移动
and maybe even wobble forever.
甚至永远循环
To make matters worse, in real world settings,
更糟糕的是,现实世界中
there are typically external and variable forces acting on a robot,
机器人会受到各种外力影响
like friction, wind and items of different weight.
比如摩擦力,风,等等
To handle this gracefully, more sophisticated control logic is needed.
为了处理这些外力,我们需要更复杂的控制逻辑
A widely used control-loop, feedback mechanism is a
一个使用广泛的机制,有控制回路和反馈机制。
proportional–integral–derivative controller.
叫 "比例-积分-微分控制器"
That’s a bit of a mouthful, so people call them PID controllers.
这个有点绕口,所以一般简称 "PID控制器"
These used to be mechanical devices, but now it’s all done in software.
它以前是机械设备,现在全是纯软件了
Let’s imagine a robot that delivers coffee.
想象有一个机器人,端咖啡给客人
Its goal is to travel between customers at two meters per second,
设计目标是 每秒两米的速度在顾客间穿行
which has been determined to be the ideal speed
这个速度是理想速度
that’s both safe and expedient.
安全又合适
Of course, the environment doesn’t always cooperate.
当然,环境是会变化的
Sometimes there’s wind, and sometimes there's uphills and downhills
有时候有风,有时候有上坡下坡
and all sorts of things that affect the speed of the robot.
以及其他影响机器人速度的因素
So, it’s going to have to increase and decrease power
所以,给马达的动力要加大或减少,以保持目标速度
to its motors to maintain the desired speed.
所以,给马达的动力要加大或减少,以保持目标速度
Using the robot's speed sensor, we can keep track of its
用机器人的速度传感器,我们可以
actual speed and plot that alongside its desired speed.
把当前速度和目标速度画张图
PID controllers calculate three values from this data.
PID 控制器根据这些数据,算出3个值
First is the proportional value, which is the difference between
首先是"比例值",就是"实际值"和"理想值"差多少
the desired value and the actual value
首先是"比例值",就是"实际值"和"理想值"差多少
at the most recent instant in time or the present.
"实际值"可能有一定滞后,或者是实时的。
This is what our simpler control loop used before.
之前的简单控制回路,用的就是这个值
The bigger the gap between actual and desired,
"实际值"和"理想值"的差距越大,
the harder you'll push towards your target.
就越用力
In other words, it’s proportional control.
换句话说,它是"比例控制"的
Next, the integral value is computed,
接下来,算"积分值"
which is the sum of error over a window of time,
就是一段时间内 误差的总和
like the last few seconds.
比如最近几秒
This look back helps compensate for steady state errors,
帮助弥补误差
resulting from things like motoring up a long hill.
比如上坡时可能就会产生误差
If this value is large, it means proportional control is not enough,
如果这个值很大,说明比例控制不够,
and we have to push harder still.
要继续用力前进
Finally, there’s the derivative value,
最后有"导数值"
which is the rate of change between the desired and actual values.
是期望值与实际值之间的变化率
This helps account for possible future error,
有助于解决 未来可能出现的错误,
and is sometimes called "anticipatory control".
有时也叫"预期控制"
For example, if you are screaming in towards your goal too fast,
比如前进的太快
you'll need to ease up a little to prevent overshoot.
要稍微放松一点,避免冲过头
These three values are summed together, with different relative weights,
这三个值会一起使用,它们有不同权重
to produce a controller output that’s passed to the system.
然后用来控制系统
PID controllers are everywhere,
PID 控制器到处都是
from the cruise control in your car,
比如汽车里的巡航控制
to drones that automatically adjust their rotor speeds to maintain level flight,
无人机调整螺旋桨速度,以保持水平
as well as more exotic robots,
以及一些更奇怪的机器人,
like this one that balances on a ball to move around.
比如这个用球来平衡和移动的机器人
Advanced robots often require many control loops running in parallel,
更高级的机器人一般需要多个控制回路同时运行
working together, managing everything from robot balance to limb position.
来保持机器人平衡,调整肢体位置,等等
As we’ve discussed, control loops are responsible for
之前说过,控制回路负责
getting robot attributes like location to desired values.
把机器人的属性(比如当前位置)变成期望值
So, you may be wondering where these values come from.
你可能好奇这些值 是哪里来的
This is the responsibility of higher-level robot software,
这是更高层软件的责任
which plans and executes robot actions,
软件负责做出计划 并让机器人执行动作,
like plotting a path around sensed obstacles, or breaking down physical tasks,
比如制定一条路线来绕过障碍物,或者把任务分成一步步
like picking up a ball, into simple, sequential motions.
比如把拿起一个球,分解成一个个简单连续动作
Using these techniques, robots have racked up some impressive achievements
用这些技术,机器人已经取得不少令人印象深刻的成就
– they've been to the deepest depths of Earth's oceans
- 它们潜到了海洋最深处
and roved around on Mars for over a decade.
在火星上跑了十几年
But interestingly, lots of problems that are trivial for many humans
但有趣的是,许多对人类来说很简单的任务
have turned out to be devilishly difficult for robots:
对机器人很困难:
like walking on two legs, opening a door, picking up objects
比如两条腿走路,开门,拿东西时不要捏碎了
without crushing them, putting on a t-shirt, or petting a dog.
或是穿T恤,或是摸狗
These are tasks you may be able to do without thinking,
这些你可能想都不用想
but a supercomputer-powered robot fails at spectacularly.
但有超级计算机能力的机器人却做不到
These sorts of tasks are all active areas of robotics research.
机器人研究领域在全力解决这些问题
Artificial intelligence techniques,
我们前几集聊过的 人工智能
which we discussed a few episodes ago, are perhaps
我们前几集聊过的 人工智能
the most promising avenue to overcome these challenges.
最有可能解决这些问题
For example, Google has been running an experiment
例如,谷歌在进行一项实验
with a series of robotic arms that spend their days
让一堆机器人手臂把各种东西
moving miscellaneous objects from one box to another, learning from trial and error.
从一个盒子拿到另一个盒子,不断试错学习
After thousands of hours of practice, the robots had cut their error rate in half.
经过数千小时的练习,机器人把错误率降低了一半
Of course, unlike humans, robots can run twenty-four hours a day
不像人类,机器人可以24小时全天运行
and practice with many arms at the same time.
而且多个手臂同时练习
So, it may just be a matter of time until they become adept at grasping things.
所以机器人擅长抓东西只是时间问题
But, for the time being, toddlers can out-grasp them.
但现在,小婴儿都比机器人更会抓东西
One of the biggest and most visible robotic breakthrough
近年最大的突破之一
in recent years has been self-driving, autonomous cars.
是无人驾驶汽车
If you think about it, cars don’t have too many system inputs
如果你仔细想想,汽车没几个输入
– you can speed up or slow down, and you can steer left or right.
- 只是加速减速,左转右转
The tough part is sensing lanes, reading signs,
难的问题是 判断车道,理解路标
and anticipating and navigating traffic, pedestrians,
预测车流,车流中穿行,留心行人和骑自行车的。
bicyclists, and a whole host of obstacles.
以及各种障碍
In addition to being studded with proximity sensors,
车上布满了传感器
these robotic vehicles heavily rely
无人驾驶汽车非常依赖
on Computer Vision algorithms, which we discussed in Episode 35.
计算机视觉算法,我们在第35集讨论过
We’re also seeing the emergence of very primitive androids
现在也开始出现类人机器人
– robots that look and act like humans.
- 外貌和行为像人类的机器人
Arguably, we’re not close on either of those goals,
不过现在两个目标都没接近(外貌和行为)
as they tend to look pretty weird and act even weirder.
因为看起来一般怪怪的,行为也怪怪的.
At least we’ll always have Westworld.
但至少有《西部世界》可以看看
But anyway, these remain a tantalizing goal for roboticists
无论如何,对机器人研究者来说,把各种技术结合起来
combine many computer science topics
比如人工智能,计算机视觉和自然语言处理
we’ve touched on over the last few episodes, like artificial intelligence,
比如人工智能,计算机视觉和自然语言处理
computer vision and natural language processing.
来让机器人越来越像人,是个诱人的目标
As for why humans are so fascinated by
至于人类为什么如此着迷 做出和我们一样的机器人
creating artificial embodiments of ourselves.
至于人类为什么如此着迷 做出和我们一样的机器人
you'll have to go to Crash Course Philosophy for that.
你得去看《哲学速成课》
And for the foreseeable future,
在未来好一段时间里
realistic androids will continue to be the stuff of science fiction.
和人类一样的机器人 依然只能存在科幻小说里。
Militaries also have a great interest in robots –
军队也对机器人很有兴趣 -
they're not only replaceable, but can surpass humans
因为机器人可以替换,
in attributes like strength, endurance, attention, and accuracy.
而且力量,耐力,注意力,准确性可以远超人类
Bomb disposal robots and reconnaissance drones are fairly common today.
拆弹机器人和无人侦察机如今很常见
But fully autonomous, armed-to-the-teeth robots are slowly appearing,
但完全自主决定,全副武装的机器人也在慢慢出现
like the Samsung SGR-A1 sentry gun deployed by South Korea.
比如韩国的三星 SGR-A1 哨兵炮
Robots with the intelligence and capability to take human lives
有智力并且可以杀人的机器人
are called lethal autonomous weapons.
叫 "致命自主武器"
And they’re widely considered a complex and thorny issue.
这种武器是复杂又棘手的问题
Without doubt, these systems could save soldiers lives
毫无疑问,它们可以把士兵从战场带离 挽救生命
by taking them off the battlefield and out of harm’s way.
毫无疑问,它们可以把士兵从战场带离 挽救生命
It might even discourage war all together.
甚至阻止战争的发生
Though it’s worth noting that people said the same thing
值得注意的是 人们对炸药和核弹也说过一样的话
about dynamite and nuclear weapons.
值得注意的是 人们对炸药和核弹也说过一样的话
On the flip side, we might be creating ruthlessly
另一方面,我们可能会不小心创造出 \N 无情又高效的杀人机器
efficient killing machines that don't apply human judgment
没有人类般的判断力和同情心
or compassion to complex situations.
没有人类般的判断力和同情心
And the fog of war is about as complex and murky as they come.
战争的硝烟会变得更加黑暗和复杂
These robots would be taking orders and executing them
机器人会接受命令并高效执行
as efficiently as they can and sometimes
机器人会接受命令并高效执行
human orders turn out to be really bad.
但有时人类的命令是错的
This debate is going to continue for a long time,
这场辩论会持续很长时间,
and pundits on both sides will grow louder as robotic technology improves.
而且随着机器人技术的进步,两边的辩论会越来越激烈
It’s also an old debate –
这也是个老话题了
the danger was obvious to science fiction writer Isaac Asimov,
科幻作家 艾萨克·阿西莫夫 早预见了这种危险
who introduced a fictional "Three Laws of Robotics" in his 1942 short story "Runaround".
他在1942年短篇小说 Runaround 中写了"机器人三定律"
And then, later he added a zeroth rule.
之后又加了"定律0"
In short, it’s a code of conduct or moral compass for robots –
简单说 这些定律指导机器人的行为准则 或者说道德指南
guiding them to do no harm, especially to humans.
让机器人不要伤害,特别是不要伤害人类
It’s pretty inadequate for practical application and it leaves plenty of room for equivocation.
这些规则实践起来相当不足,并且有很多模糊的地方
But still, Asimov’s laws inspired a ton of science fiction and academic discussion,
但阿西莫夫三定律 激发了大量科幻小说讨论和学术讨论,
and today there are whole conferences on robot ethics.
如今有专门讨论机器人伦理的会议
Importantly, Asimov crafted his fictional rules
重要的是,阿西莫夫写这些虚构规则
as a way to push back on "Robot as a Menace" memes
是为了反对 "机器人都很邪恶" 这种常见描述
common in fiction from his childhood.
他童年读的小说里,这样的场景很常见
These were stories where robots went off the rails,
机器人脱离控制,然后伤害甚至毁灭创造者
harming or even destroying their creators in the process.
机器人脱离控制,然后伤害甚至毁灭创造者
Asimov, on the other hand, envisioned robots as useful,
阿西莫夫认为 机器人有用,可靠,甚至可以让人喜爱
reliable, and even loveable machines.
阿西莫夫认为 机器人有用,可靠,甚至可以让人喜爱
And it’s this duality I want to leave you thinking about today.
我想让你思考这种两面性
Like many of the technologies we’ve discussed throughout this series,
我们讨论过的许多技术,有好的一面也有坏的一面
there are benevolent and malicious uses.
我们讨论过的许多技术,有好的一面也有坏的一面
Our job is to carefully reflect on computing's potential and peril,
我们要认真思考计算机的潜力和危害
and wield our inventive talents to improve the state of the world.
来改善这个世界
And robots are one of the most potent reminders of this responsibility.
而机器人最能提醒我们这一点了
I’ll see you next week.
我 们 下 周 见