C++用于对 Lego NXT 进行编程的 OOP 库
不久前,我收到了一套 LEGO Mindstorms NXT 圣诞套装,现在我想用 C++ 对其进行编程。
我环顾四周,在这里和其他地方,找不到一个“感觉正确”的跨平台、开源、OOP C++ 库,包括 lestat 和 nxtOSEK。
所以,我决定,除非我能找到一个我喜欢的库,否则编写自己的库对我来说将是一次很好的学习经历。
我做了一些研究,并决定通过蓝牙与其进行通信是最简单的,而不是将我的程序编译为 NXT 机器代码。
我还希望以 OOP 风格完成此操作,这意味着 NXT 砖、电机、传感器等将作为对象存在。
所以,我的问题是:在开始之前我需要知道什么?我在哪里可以获得好的参考资料(除了这里,并且特定于 NXT)?对于蓝牙通信等功能,还有哪些其他不错的“基本”库*?
*顺便说一句,如果有必要的话,我完全赞成使用 boost 和 STL。
或者,我相信如果没有必要,就不要重新发明轮子,所以如果有一个像样的 C++ OOP 蓝牙通信 NXT 库,请告诉我!
A while back, I got a LEGO Mindstorms NXT set for Christmas, and now I would like to program it in C++.
I have looked around, here and other places, and could not find a cross-platform, open source, OOP C++ library that "felt right", including lestat and nxtOSEK.
So, I have decided that unless I can find one I do like, then it would be a great learning experience for me to write my own library.
I have done a little research, and decided it would be easiest to communicate with it over bluetooth, rather than compiling my programs to the NXT machine code.
I would also like this to be done in OOP style, meaning the NXT brick, motors, sensors, etc would exist as objects.
So, my question is: what do I need to know before embarking on this? where can I get good references (besides here, and specific to the NXT)? What are other decent "basic" libraries* for things like Bluetooth communication?
*I am all for using boost and the STL, if necessary, by the way.
Alternatively, I believe in not reinventing the wheel if I don't have to, so if there is a decent C++ OOP bluetooth-communicating NXT library out there, let me know!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我之前已经考虑过这样做。
从这里开始查找:http://bricxcc.sourceforge.net/
在此页面上,您可以下载它。我最终所做的是将我的 C 源代码编译为 NXT 砖可以理解的字节代码。
这使我能够向 C 添加一些自定义扩展,尽管我确实花费了大量时间将 C 编译为适合 NXT 内存的字节代码的足够紧凑的形式:)
如果您想使用现有的 C 实现,请查看此图表:http://www.teamhassenplug.org/NXT/NXTSoftware.html
NBC(下一个字节代码)列表从此页开始。我发现它非常有帮助。
http://bricxcc.sourceforge.net/nbc/
I've taken a look at doing this before.
Start looking here: http://bricxcc.sourceforge.net/
On this page you can download the source for it. What I ended up doing is compiling my C source code down to byte codes that the NXT brick can understand.
This allowed me to add some custom extensions to C though I did spend alot of time compiling C down to a compact enough form in byte codes that fit into the NXT's memory:)
If you want to use an existing C implementation then check out this chart: http://www.teamhassenplug.org/NXT/NXTSoftware.html
For a list of the NBC(Next Byte Codes) start with this page. I found it extremely helpful.
http://bricxcc.sourceforge.net/nbc/
我用的是这个,不知道你有没有检查过:
http://www.norgesgade14.dk/bluetoothlibrary.php norgesgade14.dk/bluetoothlibrary.php
该库支持通过蓝牙连接读取各种传感器数据以及控制电机。
此外,该库可以轻松修改,而且我发现重新配置它非常容易。
I used this one, I don't know whether you have checked it out or not:
http://www.norgesgade14.dk/bluetoothlibrary.php
This library provides support for reading various sensor data over a bluetooth connection as well as support for controlling motors.
Moreover the library can be easily modified, and I found it extremely easy to reconfigure it.
去年,我在开发一个使用 C++ 控制机器人手臂的项目时遇到了这个线程。我使用了 2 个 NXT 积木和 5 个电机。
您可以在这里找到原始的 NXT++ 0.6 库:
http://nxtpp.clustur.com
https://sourceforge.net/projects/nxtpp/forums/
不幸的是,这个网站没有更新。
我分叉了一个新版本 NXT++ 0.7,其中包含一些修复,并通过 USB 或蓝牙支持多个砖块:
https://github.com/dbworth/nxt-plus-plus
有关详细信息,请参阅自述文件。
另一位用户 Piotr 为 NXT++ 0.6-2 添加了对 HiTechnic 传感器多路复用器和 Lego 颜色传感器的支持:
http://wmii.uwm.edu.pl/~artem/downloads.html
问候,
大卫.
I came across this thread last year, while working on a project using C++ to control a robot arm. I used 2 NXT bricks and 5 motors.
You can find the original NXT++ 0.6 library here:
http://nxtpp.clustur.com
https://sourceforge.net/projects/nxtpp/forums/
Unfortunately this site is not being updated.
I forked a new version NXT++ 0.7 with some fixes, and support for multiple bricks, via USB or Bluetooth:
https://github.com/dbworth/nxt-plus-plus
See the Readme file for details.
Another user, Piotr, has added support to NXT++ 0.6-2 for the HiTechnic sensor multiplexor and Lego color sensor:
http://wmii.uwm.edu.pl/~artem/downloads.html
Regards,
David.
让我们看看 NXT++ 的可能性演示,直方图过滤,
https://www.youtube.com/watch?v=PDYtjWgvsxg
它基于支持多路复用器的最新版本,
来自 http://wmii.uwm.edu.pl/~artem 和下载部分,
Lets see the demonstration of possibilities of NXT++, the histogram filtering,
https://www.youtube.com/watch?v=PDYtjWgvsxg
it is based on the latest version supporting multiplexers,
from http://wmii.uwm.edu.pl/~artem and download section,