How to build a Naoqi module - the basics
2013-12-26 13:02
211 查看
[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
Extract the zip folder, then run
And put the following line into the end of .bashrc
Restart the terminal, and you will be able to callqibuild and
qitoolchain directly.
Then you can create a worktree:
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
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
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
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
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
Then add the following line into theautoload.ini under
/home/nao/naoqi/preferences/
Then ssh to the robot and restart naoqi
Now 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
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
Now 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
相关文章推荐
- How to build parport related driver upon parport module in the kernel
- Spring MVC: how to build a thread-safe Controller
- How to Install Nvidia Kernel Module Cuda and Pyrit in Kali Linux
- How to build and install Open vSwitch on a linux
- How to Compile Linux Kernel from Source to Build Custom Kernel
- How to Build RecastNavigation with VC2015
- How to build the environment of MSYS for the crossing compiler?
- Iphone how to build UI for both resolutions 640X960 and 320X480?
- How to control which module is built
- QT4: how to build QOCI (for linux and windows)
- How to build OpenOCD for windows
- how to build a runable jar
- 【Ant】How to print all the system properties in Ant build file
- php7+apache2.4+phalcon 问题 How to enable rewrite module in Apache
- How to Build Your Own Blockchain Part 4.2 — Ethereum Proof of Work Difficulty Explained
- how to build and debug wireshark2.4.2 source code
- How to create distribution build with XCode 4 ?
- how-to-build-ffmpeg-with-ndk-r9
- How to make project not set to be build
- How to Build an SMS Service