问题描述
我有一个带有 Arduino Uno 的机器人类型项目,长话短说,我正在试验一些人工智能算法.但是,我需要使用 NumPy/SciPy,但它们在 C 或 C++ 中简直就是一场噩梦.即使有图书馆,这也变得很荒谬.
I have a robotics type project with an Arduino Uno, and to make a long story short, I am experimenting with some AI algorithms. However, I need to implement some high level matrix algorithms that would be quite simple using NumPy/SciPy, but they are an utter nightmare in C or C++. Even with the libraries out there, this is just getting ridiculous.
有什么办法可以用 Python 完成这个项目吗?我想我听说过 Mega 具有此功能,但我有一个 Uno,在这一点(这会使项目倒退很多.)此外,我听说了一些关于使用 Python 通过 USB 与 Arduino 通信的消息,但是在运行时我无法插入 USB 电缆.我需要能够上传程序并完成它.
Is there any way I can do this project in Python? I think I heard something about the Mega having this capability, but I have an Uno, and replacing it is not an option at this point (that would set the project back quite a bit.) Also, I heard somethings about using Python to communicate to the Arduino via USB, but I cannot have the USB cable in while the thing is running. I need to be able to upload the program and be done with it.
有没有其他选择,或者我刚刚走到了死胡同?
Are there any options out there, or have I just reached a dead end?
推荐答案
今年有一个关于在机器人技术中使用 Python 的讨论 PyConAU 调用了啊!我看到你的机器会BING"! Graeme Cross 博士.
There was a talk about using Python with robotics at this years PyConAU called Ah! I see you have the machine that goes 'BING'! by Dr. Graeme Cross.
他推荐的在微控制器板上使用 Python 的唯一选择是 PyMite,我认为它也被称为Python-On-A-Chip.
The only option he recommended for using Python on a microcontroller board was PyMite which I think also goes by the name of Python-On-A-Chip.
它已经被移植到一系列的板子上——特别是他提到了 Arduino Mega,你说它不适合你,但它可能在其他 Arduino 板上受支持.
It has been ported to a range of boards - specifically he mentions the Arduino Mega which you said is not an option for you, but it is possible it is supported on other Arduino boards.
但是,因为它是 Python 的不包含电池"版本,所以很可能在启动和运行 numpy/scipy 等时遇到实际问题.
However, because it is a "batteries not included" version of Python it is more than likely that you will have a real problem getting numpy/scipy etc up and running.
正如其他海报所暗示的那样,用 C 实现可能是阻力最小的途径.
As other posters have suggested, implementing in C might be the path of least resistence.
更新: 再次,不是专门针对 Arduino,但 pyMCU 希望在一个芯片.作者表示,如果有足够的兴趣,他可能会考虑开发 pyMCU 的 Arduino 版本.
Update: again, not specifically for Arduino, but pyMCU looks to provide python on a chip. The author states he may look at developing an Arduino version of pyMCU if there is enough interest.
这篇关于有没有办法“编译"?Python 代码到 Arduino (Uno) 上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!