How to build a Naoqi module - the basics

[For my colleagues]

So, if you want to build a Naoqi (LOCAL) module that will eventually run on the Nao robot, you have to use Ubuntu (12.04)

First install qibuild, the current version is v3.2, but it seems to have some problems. So if v3.2 somehow does not work, use v3.1 instead (that's what I use). The v3.1 qibuild can be found here

https://github.com/aldebaran/qibuild/releases/tag/v3.1

Extract the zip folder, then run

./generate-sourceme.sh

And put the following line into the end of .bashrc
source ~/qibuild/sourceme.sh

Restart the terminal, and you will be able to callqibuild and qitoolchain directly.


Then you can create a worktree:

$ cd /path/to/your/worktree
$ qibuild init

This will create a .qi directory in your worktree path. It contains a qibuild.xml and worktree.xml, which are pretty much empty for now (will be modified by following commands). Note before you runqibuild init, the current directory has to be empty.

Then it's time to create a project. According to the Aldebaran official documentation, one could simply typeqibuild create yourproject, and everything will be taken care of. But a funny thing is, since v3.1qibuild create is GONE. And there are NO substitutes. So, if you want a new qibuild project, you have to modify theworktree.xml yourself. Oh, and write yourCMakeLists.txt from scratch. EDIT: you also need to manually compose a project.xml file in your project folder. I forgot about this last time and misled my colleagues. My appologies. A typical project.xml looks like

<project name="helloworld">
  <depends buildtime="true" runtime="true" names="libnaoqi" />
</project>

So, my recommendation: always start from an existing projects.


For example, if in your project folder is named helloworld, then you should update your worktree.xml as

<worktree>
  <project src="helloworld" />
</worktree>

Later you can add more <project/> nodes into it.

Then create a toolchain. You need to download the proper Naoqi SDK. For example, if you use Ubuntu 12.04 64-bit, and you want to create a REMOTE module, you should downloadnaoqi-sdk-1.rr.x.y-linux64, but if you want to create a LOCAL module, you should use a cross-compilation SDK such aslinux64-nao-atom-cross-toolchain-1.rr.x.y-2013-mm-dd.

The command is

$ qitoolchain create my-toolchain /path/to/your/sdk/toolchain.xml

I strongly do NOT recommend the use of--default argument. It makes compiling less flexible and mistake-prone. I would recommend to use-c to specify your toolchain every time youconfigure and make. Note this command has to be run inside the worktree directory.

Now, suppose your CMakeLists.txt and source code are ready in your project folder. You can do
$ qibuild configure helloworld -c my-toolchain
$ qibuild make helloworld -c my-toolchain

If you are building a REMOTE module, this will create an executable in the build directory, you can run it directly from your Ubuntu machine with the proper IP and port number.

If you are building a LOCAL module, this will generate a shared library, you need to copy the shared library to the robot

$ scp helloworld/build-my-toolchain/sdk/lib/naoqi/libhelloworld.so nao@10.0.222.100:~/

Then add the following line into theautoload.ini under /home/nao/naoqi/preferences/
/home/nao/libhelloworld.so


Then ssh to the robot and restart naoqi

$ nao restart

N ow you will see your own module in the package list in the robot webpage.

So, this article does not cover how the CMakeLists and the source code should be composed. It is just a flow description of compilation under qibuild framework. The examplehelloworld that is shipped with SDK package is a good start

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
### 回答1: 《C语言入门之旅:基础知识》是一本以C语言为主题的书籍,旨在帮助读者快速掌握C语言的基本知识。以下是对该书的回答: 《C语言入门之旅:基础知识》这本书重点介绍了C语言的基本概念、语法特性以及常见用法。它适合那些想要学习C语言编程,但没有任何编程经验的读者。该书从简单易懂的角度出发,循序渐进地引导读者入门C语言。 首先,《C语言入门之旅:基础知识》详细介绍了C语言的起源和发展历程,帮助读者了解C语言的背景和重要性。接着,书中从最基本的数据类型开始,逐步介绍了C语言的各类数据类型、变量和常量的定义与使用方法。读者通过实例代码的学习和练习,可以更好地理解这些概念。 该书还介绍了C语言的运算符和表达式,包括算术运算符、关系运算符、逻辑运算符等。通过这部分的学习,读者能够掌握基本的运算和表达式求值的方法。 另外,书中还涵盖了C语言的流程控制语句,例如条件语句(if-else语句)、循环语句(for循环、while循环等)和跳转语句(break语句、continue语句等)。读者可以学习如何使用这些语句来实现程序的控制流。 此外,该书还介绍了C语言中的数组和字符串,以及如何使用它们进行数据的存储和处理。同时,它还包含了C语言的函数创建与调用、指针的使用方法等重要内容。 总之,《C语言入门之旅:基础知识》通过简单易懂的语言,系统全面地介绍了C语言的基础知识。无论是初学者还是有一定编程基础的读者,都可以通过这本书快速入门C语言编程,打下坚实的基础。 ### 回答2: " C语言基础之旅" 是一次让您了解C语言基础知识的旅程。C语言是一种广泛应用于系统编程和嵌入式设备的高级编程语言,也是许多计算机科学专业学习中的必修课程。 首先,我们将介绍C语言的历史和起源,以及它为什么成为一种如此重要的编程语言。接着,我们将深入了解C语言的基本语法和语义,包括变量、数据类型、运算符、控制结构和函数定义等。这些基础知识将为您构建和理解C语言程序打下坚实的基础。 在旅程的下一站,我们将探索C语言的输入和输出,包括如何从键盘接收输入和将数据输出到屏幕或文件中。我们还将介绍如何使用C语言的库函数来进行字符串处理、数学运算和内存管理等。 然后,我们将进一步深入研究C语言的数组和指针,这是C语言中一个非常重要也最具挑战性的概念。我们将学习如何声明、初始化和操作数组,以及如何使用指针来访问和操作内存中的数据。这些概念将帮助我们提高代码的效率和灵活性。 在最后的旅程中,我们将介绍C语言的结构体和文件操作。通过学习如何定义和使用结构体,我们可以创建自定义的数据类型来组织和管理数据。而文件操作将使我们能够读取和写入文件,使我们的程序能够与外部系统进行交互。 通过这次"C语言基础之旅",您将全面了解C语言的基础知识和概念,为进一步深入学习编程和开发复杂的应用程序奠定坚实的基础。无论是寻求职业发展还是追求计算机科学的真正爱好者,掌握C语言将成为您的重要优势。让我们一起开始这次旅程吧! ### 回答3: 《C语言基础教程》是一本针对初学者的C语言入门指南。C语言是一种通用的编程语言,广泛应用于软件程序的开发。该书通过一个实例化的游览项目,带领读者逐步了解C语言的基本概念和技巧。 首先,该书介绍了C语言的历史和发展,并解释了为什么学习C语言对于软件开发人员至关重要。它探讨了C语言与其他编程语言的区别,以及C的主要特征和优势。 接下来,书中详细解释了如何设置C语言的开发环境。读者将学会如何安装和配置C语言的编译器,以及如何使用集成开发环境(IDE)进行编程。此外,该书还介绍了用于编写C代码的文本编辑器和调试器,并提供了一些常见问题的解决方案。 在了解了开发环境之后,书中引导读者学习C语言的基本语法和语义。读者将了解如何声明和使用变量、编写基本的控制结构(如条件语句和循环),以及如何定义和调用函数。通过大量的示例代码和练习题,读者可以逐步巩固所学内容。 此外,《C语言基础教程》还介绍了C语言中常用的数据类型、运算符和数组等。读者将学会如何使用这些概念来解决实际问题,并掌握一些常见的编程技巧和最佳实践。 尽管《C语言基础教程》只是C语言学习的一个入门指南,但它提供了足够的基础知识,让读者能够理解和编写简单的C程序。通过学习这本书,读者可以为进一步深入学习C语言奠定坚实的基础,并为未来的软件开发之旅做好准备。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值