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

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值