diff --git a/.github/README.md b/.github/README.md
new file mode 120000
index 0000000..d18b8ba
--- /dev/null
+++ b/.github/README.md
@@ -0,0 +1 @@
+../README-NAO.md
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
old mode 100644
new mode 100755
index 4ae72d5..29f2730
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,9 @@
################################################################################
# Copyright 2013-2014 EPFL #
# Copyright 2013-2014 Quentin Bonnard #
+# Copyright 2016 Bahar Irfan #
# #
-# This file is part of chilitags. #
+# This file was modified to implement Chilitags on NAO robot. #
# #
# Chilitags is free software: you can redistribute it and/or modify #
# it under the terms of the Lesser GNU General Public License as #
@@ -26,7 +27,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "2")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
-add_definitions(-std=c++11)
+add_definitions(-std=gnu++11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(OpenCV REQUIRED )
include_directories(${OpenCV_INCLUDE_DIRS})
@@ -37,6 +38,7 @@ message(STATUS "OpenCV version: ${OpenCV_VERSION}")
##########################################
option(WITH_SAMPLES "Build demos" OFF)
+option(WITH_NAOMODULE "Build module for NAO" OFF)
option(WITH_TESTS "Build tests" OFF)
option(WITH_JNI_BINDINGS "Build JNI bindings compatible with ordinary Java and Android" OFF)
option(WITH_INVERTED_TAGS "Support for 'inverted' tags" OFF)
@@ -103,6 +105,10 @@ if (WITH_SAMPLES)
add_subdirectory(samples)
endif()
+if (WITH_NAOMODULE)
+ add_subdirectory(naoModule)
+endif()
+
if(WITH_TESTS)
add_subdirectory(test)
endif()
diff --git a/README-NAO.md b/README-NAO.md
new file mode 100755
index 0000000..badff8d
--- /dev/null
+++ b/README-NAO.md
@@ -0,0 +1,267 @@
+# ChilitagsModule: Chilitags for NAO Robot
+
+ChilitagsModule implements Chilitags (Bonnard et al., 2013) on a NAO robot (SoftBank Robotics Europe, France). Chilitags are 2D fiducial markers to detect objects and determine their positions. ChilitagsModule was tested on NAOqi 2.1 and 2.4 on a NAO robot. While Pepper robot (SoftBank Robotics Europe, France) also has a NAOqi operating system, ChilitagsModule was not tested on it.
+
+For looking and pointing at objects with Chilitags using a NAO robot, see B. Irfan (2016), "Robust Pointing with NAO Robot", `https://github.com/birfan/NAOpointing`, which uses ChilitagsModule.
+
+## Install Chilitags and ChilitagsModule on NAO Using Precompiled Libraries
+
+* Open Choregraphe. From Connection -> Advanced, choose file transfer.
+
+* Upload the precompiled ChilitagsModule files in *naoModule/compiled_files* to the robot (9 files).
+
+* Connect to the robot using terminal (e.g. via putty from Windows).
+
+* Run the following commands:
+
+```
+ $ su (password is root)
+ $ mv /usr/lib/libstdc++.so /usr/lib/libstdc++_nao.so
+ $ mv /usr/lib/libstdc++.so.6 /usr/lib/libstdc++_nao.so.6
+ $ mv /usr/lib/libstdc++.so.6.0.14 /usr/lib/libstdc++_nao.so.6.0.14
+ $ mkdir dev
+ $ cd dev
+ $ mkdir bin
+ $ mkdir lib
+ $ cd ../..
+ $ scp libchilitagsmodule.so /home/nao/dev/lib
+ $ scp testchilitagsmodule* /home/nao/dev/bin
+ $ scp libchilitags.so /usr/lib
+ $ scp libchilitags_static.a /usr/lib
+ $ scp libstdc++.so* /usr/lib
+
+ $ nano naoqi/preferences/autoload.ini
+```
+
+* Add the following line under [user]
+
+```
+ /home/nao/dev/lib/libchilitagsmodule.so
+```
+
+* Save and close the file (Ctrl + Alt + X), and restart naoqi
+
+```
+ $ nao restart
+```
+
+* Test the module by running
+
+```
+ $ python dev/bin/testchilitagsmodule.py
+```
+
+* Then present Chilitags number 8 to NAO to retrieve the info.
+
+
+## Install Chilitags and ChilitagsModule on NAO Using OpenNAO (Compile from Source)
+
+Use the following instructions for compiling Chilitags and ChilitagsModule for NAO robot (using OpenNAO) and running the module on the robot, if the precompiled libraries do not work.
+
+* Download OpenNAO OS VirtualBox and C++ NAOqi cross toolchain for Linux 32 from Software (OR use the *libnaoqi_files* folder in *naoModule* folder provided instead of the toolchain) in
+
+
+ http://community.aldebaran.com
+
+
+* Setup OpenNAO using VirtualBox
+
+
+* Clone Chilitags and ChilitagsModule to OpenNAO:
+
+
+ git clone https://github.com/birfan/chilitags
+
+```
+ $ cd chilitags
+```
+
+* Use the *naoModule/libnaoqi_files* folder to copy the files to *include*, *lib*, *bin*, *share/cmake* and *share/naoqi* (copy the naoqi folder completely) to */usr/local/include*, */usr/local/lib*, */usr/local/share*, */usr/local/bin*, respectively.
+
+ OR in the cross toolchain folder, go to *libnaoqi* folder and copy the files that contain "al" and "qi", along with "rttools" and "naoqi" from localhost to virtual (OpenNAO) to the respective places as above.
+
+### Configure GCC to C++11
+
+* In OpenNAO:
+
+```
+ $ mkdir src
+
+ $ mkdir dev
+```
+
+On local computer:
+
+
+* Get gcc-5.3.0
+
+
+* Copy the folder to OpenNAO:
+
+```
+ $ scp -P 2222 -r gcc-5.3.0/ nao@localhost:/home/nao/src/
+```
+
+On OpenNAO:
+
+```
+ $ cd src/gcc-5.3.0
+
+ $ mkdir build && cd build
+
+ $ ../configure --enable-languages=c,c++
+
+ $ sudo make -j8
+
+ $ sudo make install exec_prefix=/usr/local
+```
+
+
+* Export the local library path to update the gcc
+
+```
+ $ export "LD_LIBRARY_PATH=/usr/local/lib"
+```
+
+* In chilitags/CMakeLists.txt, change the add_definitions for c++11 to the format below:
+
+```
+ add_definitions(-std=gnu++11)
+```
+
+### Compile Chilitags
+
+In *chilitags/build* folder:
+
+* To run it locally on the NAO:
+
+```
+ $ cmake .. -DCMAKE_CXX_COMPILER="/usr/local/bin/c++" -DCMAKE_C_COMPILER="/usr/local/bin/gcc" -DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG -D_GLIBCXX_USE_CXX11_ABI=0 -s -mtune=atom -mssse3 -mfpmath=sse" -DCMAKE_C_FLAGS_RELEASE="-O3 -DNDEBUG -s -mtune=atom -mssse3 -mfpmath=sse" -DWITH_NAOMODULE=ON -DWITH_TOOLS=ON -DCMAKE_BUILD_TYPE=Release -DCHILITAGSMODULE_IS_REMOTE=OFF
+```
+
+* To run it remotely from OpenNAO:
+
+```
+ $ cmake .. -DCMAKE_CXX_COMPILER="/usr/local/bin/c++" -DCMAKE_C_COMPILER="/usr/local/bin/gcc" -DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG -D_GLIBCXX_USE_CXX11_ABI=0 -s -mtune=atom -mssse3 -mfpmath=sse" -DCMAKE_C_FLAGS_RELEASE="-O3 -DNDEBUG -s -mtune=atom -mssse3 -mfpmath=sse" -DWITH_NAOMODULE=ON -DWITH_TOOLS=ON -DCMAKE_BUILD_TYPE=Release -DCHILITAGSMODULE_IS_REMOTE=ON
+```
+
+### Rename Old Libraries On NAO
+
+To be able to revert to the default libraries in case of any problems, rename the libraries on NAO:
+
+```
+ $ mkdir dev && cd dev
+
+ $ mkdir bin && mkdir lib
+
+ $ sudo mv /usr/lib/libstdc++.so /usr/lib/libstdc++_nao.so
+
+ $ sudo mv /usr/lib/libstdc++.so.6 /usr/lib/libstdc++_nao.so.6
+
+ $ sudo mv /usr/lib/libstdc++.so.6.0.14 /usr/lib/libstdc++_nao.so.6.0.14
+```
+
+## Run Chilitags on NAO Locally:
+
+
+* Send the code from OpenNAO to NAO:
+
+```
+ $ cd chilitags/build/naoModule
+
+ $ scp libchilitagsmodule.so nao@robotIP:/home/nao/dev/lib
+
+ $ scp testchilitagsmodule* nao@robotIP:/home/nao/dev/bin
+
+ $ cd ../src
+
+ $ scp libchilitags.so nao@robotIP:/usr/lib
+
+ $ scp libchilitags_static.a nao@robotIP:/usr/lib
+
+ $ cd /usr/local/lib
+
+ $ scp libstdc++.so* nao@robotIP:/usr/lib
+```
+
+* On NAO:
+
+```
+ $ nano naoqi/preferences/autoload.ini
+```
+
+* Add the following line under [user]
+
+```
+ /home/nao/dev/lib/libchilitagsmodule.so
+```
+
+* Save and close the file, and restart naoqi
+
+```
+ $ nao restart
+```
+
+* When the robot starts (and all the modules load)
+
+```
+ $ cd dev/bin
+
+ $ ./testchilitagsmodule "127.0.0.1"
+```
+ OR
+
+```
+ $ python testchilitagsmodule.py
+```
+
+## Run Chilitags Remotely (from OpenNAO):
+
+(Comment /home/nao/dev/lib/libchilitagsmodule.so in the *autoload.ini* file, if previously added and restart Nao)
+
+```
+ $ cd chilitags/build/naoModule
+
+ $ ./chilitagsmodule --pip robotIP --pport 9559
+
+ $ ./testchilitagsmodule robotIP
+```
+ OR
+
+```
+ $ python testchilitagsmodule.py
+```
+
+## Coding style
+
+This repository uses `uncrustify`, a tool that does automatic code formatting based on a predefined configuration defined in `uncrustify.cfg` (updated according to version 0.71.0) to keep the code formatting consistent with Chilitags.
+
+## License
+
+ChilitagsModule is released under GNU Lesser General Public License v3.0 (LGPL3) in accordance with Chilitags (Bonnard et al., 2013). Cite the following if using this work:
+
+ * Chilitags for NAO Robot. B. Irfan and S. Lemaignan. University of Plymouth, UK. `https://github.com/birfan/chilitags`. 2016.
+
+ * Chilitags 2: Robust Fiducial Markers for Augmented Reality. Q. Bonnard, S. Lemaignan, G. Zufferey, A. Mazzei, S. Cuendet, N. Li, P. Dillenbourg. CHILI, EPFL, Switzerland. `http://chili.epfl.ch/software`. 2013.
+
+```
+ @misc{chilitagsModule,
+ title = {Chilitags for NAO Robot},
+ author={Irfan, Bahar and Lemaignan, S\'{e}verin},
+ publisher={University of Plymouth, UK},
+ url={https://github.com/birfan/chilitags},
+ year={2016}
+ }
+
+ @misc{chilitags,
+ title = {Chilitags 2: Robust Fiducial Markers for Augmented Reality and Robotics.},
+ author={Bonnard, Quentin and Lemaignan, S\'{e}verin and Zufferey, Guillaume and Mazzei, Andrea and Cuendet, S\'{e}bastien and Li, Nan and \"{O}zg\"{u}r, Ayberk and Dillenbourg, Pierre},
+ publisher={CHILI, EPFL, Switzerland},
+ url={http://chili.epfl.ch/software},
+ year={2013}
+ }
+```
+
+## Contact
+
+If you need further information about using Chilitags with the NAO robot, contact Bahar Irfan: bahar.irfan (at) plymouth (dot) ac (dot) uk (the most recent contact information is available at [personal website](https://www.baharirfan.com)).
diff --git a/README.md b/README.md
index 2c750ad..e3cfe35 100644
--- a/README.md
+++ b/README.md
@@ -154,6 +154,9 @@ in its source code.
Specific instructions for building Chilitags for Android can be found under
[README-ANDROID.md](README-ANDROID.md).
+Specific instructions for building Chilitags for NAO robot can be found under
+[README-NAO.md](README-NAO.md), which was developed by B. Irfan and S. Lemaignan.
+
### Coding style
This repository uses `uncrustify`, a tool that does automatic code formatting based on a predefined configuration defined in `uncrustify.cfg`.
diff --git a/naoModule/CMakeLists.txt b/naoModule/CMakeLists.txt
new file mode 100755
index 0000000..8188d42
--- /dev/null
+++ b/naoModule/CMakeLists.txt
@@ -0,0 +1,164 @@
+################################################################################
+# Copyright (c) 2016-present, Bahar Irfan. All rights reserved. #
+# #
+# This file is part of ChilitagsModule for NAO robot. #
+# #
+# Please cite the following work if using this work: #
+# #
+# Chilitags for NAO Robot. B. Irfan and S. Lemaignan. University of #
+# Plymouth, UK. https://github.com/birfan/chilitags. 2016. #
+# #
+# Chilitags 2: Robust Fiducial Markers for Augmented Reality. Q. Bonnard, #
+# S. Lemaignan, G. Zufferey, A. Mazzei, S. Cuendet, N. Li, P. Dillenbourg. #
+# CHILI, EPFL, Switzerland. http://chili.epfl.ch/software. 2013. #
+# #
+# Chilitags is free software: you can redistribute it and/or modify #
+# it under the terms of the Lesser GNU General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# Chilitags is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Lesser General Public License for more details. #
+# #
+# ChilitagsModule is released under GNU Lesser General Public License v3.0 #
+# (LGPL3) in accordance with Chilitags (Bonnard et al., 2013). You should #
+# have received a copy of the GNU Lesser General Public License along with #
+# Chilitags. If not, see . #
+################################################################################
+
+find_package(ALCOMMON REQUIRED)
+find_package(ALVISION REQUIRED)
+find_package(ALPROXIES REQUIRED)
+find_package(ALVALUE REQUIRED)
+find_package(ALERROR REQUIRED)
+
+find_package(QIMESSAGING REQUIRED)
+find_package(QITYPE REQUIRED)
+find_package(QI REQUIRED)
+find_package(QIBUILD REQUIRED)
+
+find_package(BOOST REQUIRED )
+find_package(BOOST_SYSTEM REQUIRED )
+find_package(BOOST_FILESYSTEM REQUIRED )
+
+include_directories(${BOOST_INCLUDE_DIRS}
+ ${ALCOMMON_INCLUDE_DIRS}
+ ${ALVISION_INCLUDE_DIRS}
+ ${ALPROXIES_INCLUDE_DIRS}
+ ${ALVALUE_INCLUDE_DIRS}
+ ${ALERROR_INCLUDE_DIRS}
+Â ${QI_INCLUDE_DIRS}
+ ${QIMESSAGING_INCLUDE_DIRS}
+ ${QITYPE_INCLUDE_DIRS}
+ ${QIBUILD_INCLUDE_DIRS}
+ )
+
+add_executable( calibrate_nao tagEstimation/camera_calibration_nao.cpp)
+
+target_link_libraries( calibrate_nao
+
+ ${OpenCV_LIBS}
+
+ ${BOOST_FILESYSTEM_LIBRARIES}
+ ${BOOST_SYSTEM_LIBRARIES}
+
+ ${ALCOMMON_LIBRARIES}
+ ${ALVISION_LIBRARIES}
+ ${ALPROXIES_LIBRARIES}
+ ${ALVALUE_LIBRARIES}
+ ${ALERROR_LIBRARIES}
+
+ ${QIMESSAGING_LIBRARIES}
+ ${QITYPE_LIBRARIES}
+ ${QI_LIBRARIES}
+ )
+
+install(TARGETS calibrate_nao
+
+ RUNTIME DESTINATION bin
+
+ )
+
+# Create an option to make is possible compiling the module
+# as a remote executable, or as a local shared library
+option(CHILITAGSMODULE_IS_REMOTE
+# "module is compiled as a remote module (ON or OFF)"
+ OFF)
+
+# Create a list of source files
+set(_srcs
+ chilitagsmodule/chilitagsmodule.cpp
+ chilitagsmodule/chilitagsmodule.hpp
+ chilitagsmodule/main.cpp
+ tagEstimation/estimate3d_nao.cpp
+ tagEstimation/estimate3d_nao.hpp
+)
+
+if(CHILITAGSMODULE_IS_REMOTE)
+ # Add a compile flag because code changes a little bit
+ # when we are compiling an executable
+ # This will let you use #ifdef HELLOWORLD_IS_REMOTE
+ # in the C++ code
+ add_definitions( " -DCHILITAGSMODULE_IS_REMOTE ")
+
+ # Create an executable
+ add_executable(chilitagsmodule ${_srcs})
+else()
+ # Create a plugin, that is a shared library, and make
+ # sure it is built in lib/naoqi, so that the naoqi executable
+ # can find it later
+ add_library(chilitagsmodule SHARED ${_srcs})
+endif()
+
+# Tell CMake that sayhelloworld depends on ALCOMMON and
+# ALPROXIES.
+# This will set the libraries to link sayhelloworld with,
+# the include paths, and so on
+
+target_link_libraries(chilitagsmodule chilitags chilitags_static)
+
+target_link_libraries(chilitagsmodule ${OpenCV_LIBS}
+
+ ${ALCOMMON_LIBRARIES}
+ ${ALPROXIES_LIBRARIES}
+ ${ALVALUE_LIBRARIES}
+ ${ALVISION_LIBRARIES}
+
+ ${QI_LIBRARIES}
+ ${QIBUILD_LIBRARIES}
+ )
+
+
+if(CHILITAGSMODULE_IS_REMOTE)
+ # Add a compile flag because code changes a little bit
+ # when we are compiling an executable
+ # This will let you use #ifdef HELLOWORLD_IS_REMOTE
+ # in the C++ code
+ install(TARGETS chilitagsmodule
+ RUNTIME DESTINATION bin
+ )
+else()
+ # Create a plugin, that is a shared library, and make
+ # sure it is built in lib/naoqi, so that the naoqi executable
+ # can find it later
+ install(TARGETS chilitagsmodule
+ LIBRARY DESTINATION lib
+ )
+endif()
+
+
+# Also create a simple executable capable of creating
+# a proxy to the helloworld module
+add_executable(testchilitagsmodule chilitagsmodule/testchilitagsmodule.cpp)
+
+target_link_libraries(testchilitagsmodule ${ALCOMMON_LIBRARIES}
+ ${ALPROXIES_LIBRARIES}
+ ${QI_LIBRARIES}
+ ${QIBUILD_LIBRARIES}
+ )
+
+install(TARGETS testchilitagsmodule
+ RUNTIME DESTINATION bin
+ )
diff --git a/naoModule/chilitagsmodule/.DS_Store b/naoModule/chilitagsmodule/.DS_Store
new file mode 100644
index 0000000..ca37ca7
Binary files /dev/null and b/naoModule/chilitagsmodule/.DS_Store differ
diff --git a/naoModule/chilitagsmodule/chilitagsmodule.cpp b/naoModule/chilitagsmodule/chilitagsmodule.cpp
new file mode 100644
index 0000000..712cc21
--- /dev/null
+++ b/naoModule/chilitagsmodule/chilitagsmodule.cpp
@@ -0,0 +1,168 @@
+/*******************************************************************************
+* Copyright (c) 2016-present, Bahar Irfan. All rights reserved. *
+* *
+* This file contains the class for ChilitagsModule (Chilitags for NAO Robot).*
+* *
+* Please cite the following work if using this work: *
+* *
+* Chilitags for NAO Robot. B. Irfan and S. Lemaignan. University of *
+* Plymouth, UK. https://github.com/birfan/chilitags. 2016. *
+* *
+* Chilitags 2: Robust Fiducial Markers for Augmented Reality. Q. Bonnard, *
+* S. Lemaignan, G. Zufferey, A. Mazzei, S. Cuendet, N. Li, P. Dillenbourg.*
+* CHILI, EPFL, Switzerland. http://chili.epfl.ch/software. 2013. *
+* *
+* Chilitags is free software: you can redistribute it and/or modify *
+* it under the terms of the Lesser GNU General Public License as *
+* published by the Free Software Foundation, either version 3 of the *
+* License, or (at your option) any later version. *
+* *
+* Chilitags is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* ChilitagsModule is released under GNU Lesser General Public License v3.0 *
+* (LGPL3) in accordance with Chilitags (Bonnard et al., 2013). You should *
+* have received a copy of the GNU Lesser General Public License along with *
+* Chilitags. If not, see . *
+*******************************************************************************/
+
+#include "chilitagsmodule.hpp"
+#include
+#include
+#include
+#include
+#include
+
+using namespace AL;
+
+ChilitagsModule::ChilitagsModule(boost::shared_ptr broker, const std::string& name) :
+ ALModule(broker, name)
+{
+ /** Describe the module here. This will appear on the webpage*/
+ setModuleDescription("Chilitags module for estimating the 3d position of the tag and the transformation matrix between chili tag and the nao camera.");
+
+ functionName("subscribeCameraRemote", getName(), "Subscribe to the camera remotely by giving IP, port, and camera index.");
+ addParam("robotIp", "IP of the robot");
+ addParam("robotPort", "Port of the robot");
+ addParam("cameraIndex", "0 for top camera, 1 for bottom (default)");
+ BIND_METHOD(ChilitagsModule::subscribeCameraRemote);
+
+ functionName("subscribeCameraLocal", getName(), "Subscribe to the camera locally (on the robot), by giving camera index.");
+ addParam("cameraIndex", "0 for top camera, 1 for bottom (default)");
+ BIND_METHOD(ChilitagsModule::subscribeCameraLocal);
+
+ functionName("subscribeCameraDefault", getName(), "Subscribe to the bottom camera on the robot.");
+ BIND_METHOD(ChilitagsModule::subscribeCamera);
+
+ functionName("unsubscribeCamera", getName(), "Unsubscribe from the camera.");
+ BIND_METHOD(ChilitagsModule::unsubscribeCamera);
+
+ functionName("setCameraResolution640x480", getName(), "Set the camera resolution to 640x480 (optional function, default is 320x240).");
+ BIND_METHOD(ChilitagsModule::setCameraResolution640x480);
+
+ functionName("setCameraResolution320x240", getName(), "Set the camera resolution to 320x240 (needed to reset if the resolution has changed).");
+ BIND_METHOD(ChilitagsModule::setCameraResolution320x240);
+
+ functionName("setDefaultTagSize", getName(), "Set the default tag size for Chilitags. Default is 30 mm. Call this method (if you need to) before calling estimate functions.");
+ addParam("tagSize", "The tag size to set for the Chilitags (in mm)");
+ BIND_METHOD(ChilitagsModule::setDefaultTagSize);
+
+ functionName("readTagConfiguration", getName(), "Read the configuration of Chilitags from a YAML file. See 'tag_configuration_sample.yml' for an example.");
+ addParam("configFilename", "Configuration file name for tags");
+ BIND_METHOD(ChilitagsModule::readTagConfiguration);
+
+ functionName("resetTagSettings", getName(), "Reset tag settings: tag size is 30 mm and no configuration file is used.");
+ BIND_METHOD(ChilitagsModule::resetTagSettings);
+
+ functionName("estimatePosGivenTag", getName(), "Get a vector of a 17-element vector corresponding to the transformation matrix between the given chilitag and the nao camera");
+ addParam("estimatePosGivenTag", "Give a specific tag to search for");
+ BIND_METHOD(ChilitagsModule::estimatePosGivenTag);
+
+ functionName("estimatePosAllTags", getName(), "Get a vector of 17-element vectors corresponding to the transformation matrix between the chilitag and the nao camera for each visible chilitag");
+ BIND_METHOD(ChilitagsModule::estimatePosAllTags);
+
+}
+
+ChilitagsModule::~ChilitagsModule() {
+}
+void ChilitagsModule::init()
+{
+ /** Init is called just after construction.
+ *
+ * Here we call sayHello, so that the module does something
+ * without us having to explicitly call sayHello from somewhere else.
+ */
+}
+
+void ChilitagsModule::subscribeCameraRemote(std::string robotIp, int robotPort, int cameraIndex)
+{
+ ET.subscribeCamera(robotIp, robotPort, cameraIndex);
+ std::string camType = "bottom"; //cameraIndex = 1
+ if(cameraIndex == 0) {
+ camType = "top";
+ }
+ qiLogInfo("module.example") << "Subscribed "<< camType << " camera at " << robotIp << ":" << robotPort<< std::endl;
+
+}
+
+void ChilitagsModule::subscribeCameraLocal(int cameraIndex)
+{
+ std::string robotIp = "127.0.0.1";
+ int robotPort = 9559;
+ subscribeCameraRemote(robotIp, robotPort, cameraIndex);
+}
+
+void ChilitagsModule::subscribeCamera()
+{
+ int cameraIndex = 1; //bottom camera
+ subscribeCameraLocal(cameraIndex);
+}
+
+void ChilitagsModule::setCameraResolution640x480()
+{
+ ET.setCameraResolution(1);
+}
+
+void ChilitagsModule::setCameraResolution320x240()
+{
+ ET.setCameraResolution(0);
+}
+
+void ChilitagsModule::unsubscribeCamera()
+{
+ ET.unsubscribeCamera();
+ qiLogInfo("module.example") << "Unsubscribed camera." << std::endl;
+}
+
+void ChilitagsModule::setDefaultTagSize(float tagSize)
+{
+ ET.setDefaultTagSize(tagSize);
+}
+
+void ChilitagsModule::readTagConfiguration(std::string configFilename)
+{
+ ET.readTagConfiguration(configFilename);
+}
+
+void ChilitagsModule::resetTagSettings()
+{
+ ET.resetTagSettings();
+}
+
+std::vector< std::vector > ChilitagsModule::estimatePosAllTags()
+{
+ tagsVec.clear();
+ ET.estimateTagsNao(false, "", tagsVec);
+ qiLogInfo("module.example") << "Estimated position of all visible tags." << std::endl;
+ return tagsVec;
+}
+
+std::vector< std::vector > ChilitagsModule::estimatePosGivenTag(std::string givenTagName)
+{
+ tagsVec.clear();
+ ET.estimateTagsNao(true, givenTagName, tagsVec);
+ qiLogInfo("module.example") << "Estimated position of tag " << givenTagName << std::endl;
+ return tagsVec;
+}
diff --git a/naoModule/chilitagsmodule/chilitagsmodule.hpp b/naoModule/chilitagsmodule/chilitagsmodule.hpp
new file mode 100644
index 0000000..24d1a9f
--- /dev/null
+++ b/naoModule/chilitagsmodule/chilitagsmodule.hpp
@@ -0,0 +1,91 @@
+/*******************************************************************************
+* Copyright (c) 2016-present, Bahar Irfan. All rights reserved. *
+* *
+* This file contains the class for ChilitagsModule (Chilitags for NAO Robot).*
+* *
+* Please cite the following work if using this work: *
+* *
+* Chilitags for NAO Robot. B. Irfan and S. Lemaignan. University of *
+* Plymouth, UK. https://github.com/birfan/chilitags. 2016. *
+* *
+* Chilitags 2: Robust Fiducial Markers for Augmented Reality. Q. Bonnard, *
+* S. Lemaignan, G. Zufferey, A. Mazzei, S. Cuendet, N. Li, P. Dillenbourg.*
+* CHILI, EPFL, Switzerland. http://chili.epfl.ch/software. 2013. *
+* *
+* Chilitags is free software: you can redistribute it and/or modify *
+* it under the terms of the Lesser GNU General Public License as *
+* published by the Free Software Foundation, either version 3 of the *
+* License, or (at your option) any later version. *
+* *
+* Chilitags is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* ChilitagsModule is released under GNU Lesser General Public License v3.0 *
+* (LGPL3) in accordance with Chilitags (Bonnard et al., 2013). You should *
+* have received a copy of the GNU Lesser General Public License along with *
+* Chilitags. If not, see . *
+*******************************************************************************/
+
+#ifndef CHILITAGSMODULE_H
+#define CHILITAGSMODULE_H
+
+#include
+#include
+#include "../tagEstimation/estimate3d_nao.hpp"
+
+namespace AL
+{
+// This is a forward declaration of AL:ALBroker which
+// avoids including in this header
+class ALBroker;
+}
+
+/**
+ * A simple example module that says "Hello world" using
+ * text to speech, or prints to the log if we can't find TTS
+ *
+ * This class inherits AL::ALModule. This allows it to bind methods
+ * and be run as a remote executable or as a plugin within NAOqi
+ */
+class ChilitagsModule : public AL::ALModule
+{
+private:
+EstimateTag ET;
+std::vector< std::vector > tagsVec;
+public:
+ChilitagsModule(boost::shared_ptr pBroker, const std::string& pName);
+
+virtual ~ChilitagsModule();
+
+/** Overloading ALModule::init().
+ * This is called right after the module has been loaded
+ */
+virtual void init();
+
+void subscribeCameraRemote(std::string robotIp, int robotPort, int cameraIndex);
+
+void subscribeCameraLocal(int cameraIndex);
+
+void subscribeCamera();
+
+void unsubscribeCamera();
+
+void setCameraResolution640x480();
+
+void setCameraResolution320x240();
+
+void setDefaultTagSize(float tagSize);
+
+void readTagConfiguration(std::string configFilename);
+
+void resetTagSettings();
+
+std::vector< std::vector > estimatePosAllTags();
+
+std::vector< std::vector > estimatePosGivenTag(std::string givenTagName);
+
+};
+#endif // CHILITAGSMODULE_H
+
diff --git a/naoModule/chilitagsmodule/main.cpp b/naoModule/chilitagsmodule/main.cpp
new file mode 100644
index 0000000..dcbea18
--- /dev/null
+++ b/naoModule/chilitagsmodule/main.cpp
@@ -0,0 +1,80 @@
+/*******************************************************************************
+* Copyright (c) 2016-present, Bahar Irfan. All rights reserved. *
+* *
+* This is the main file for ChilitagsModule (Chilitags for NAO Robot). *
+* *
+* Please cite the following work if using this work: *
+* *
+* Chilitags for NAO Robot. B. Irfan and S. Lemaignan. University of *
+* Plymouth, UK. https://github.com/birfan/chilitags. 2016. *
+* *
+* Chilitags 2: Robust Fiducial Markers for Augmented Reality. Q. Bonnard, *
+* S. Lemaignan, G. Zufferey, A. Mazzei, S. Cuendet, N. Li, P. Dillenbourg.*
+* CHILI, EPFL, Switzerland. http://chili.epfl.ch/software. 2013. *
+* *
+* Chilitags is free software: you can redistribute it and/or modify *
+* it under the terms of the Lesser GNU General Public License as *
+* published by the Free Software Foundation, either version 3 of the *
+* License, or (at your option) any later version. *
+* *
+* Chilitags is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* ChilitagsModule is released under GNU Lesser General Public License v3.0 *
+* (LGPL3) in accordance with Chilitags (Bonnard et al., 2013). You should *
+* have received a copy of the GNU Lesser General Public License along with *
+* Chilitags. If not, see . *
+*******************************************************************************/
+
+#ifndef _WIN32
+# include
+#endif
+
+#include
+#include
+#include
+#include "chilitagsmodule.hpp"
+
+#ifdef CHILITAGSMODULE_IS_REMOTE
+# define ALCALL
+#else
+// when not remote, we're in a dll, so export the entry point
+# ifdef _WIN32
+# define ALCALL __declspec(dllexport)
+# else
+# define ALCALL
+# endif
+#endif
+
+extern "C"
+{
+ALCALL int _createModule(boost::shared_ptr pBroker)
+{
+ // init broker with the main broker instance
+ // from the parent executable
+ AL::ALBrokerManager::setInstance(pBroker->fBrokerManager.lock());
+ AL::ALBrokerManager::getInstance()->addBroker(pBroker);
+ // create module instances
+ AL::ALModule::createModule(pBroker, "ChilitagsModule");
+ return 0;
+}
+
+ALCALL int _closeModule( )
+{
+ return 0;
+}
+} // extern "C"
+
+
+#ifdef CHILITAGSMODULE_IS_REMOTE
+int main(int argc, char *argv[])
+{
+ // pointer to createModule
+ TMainType sig;
+ sig = &_createModule;
+ // call main
+ return ALTools::mainFunction("ChilitagsModule", argc, argv, sig);
+}
+#endif
diff --git a/naoModule/chilitagsmodule/testchilitagsmodule.cpp b/naoModule/chilitagsmodule/testchilitagsmodule.cpp
new file mode 100644
index 0000000..8905e69
--- /dev/null
+++ b/naoModule/chilitagsmodule/testchilitagsmodule.cpp
@@ -0,0 +1,101 @@
+/*******************************************************************************
+* Copyright (c) 2016-present, Bahar Irfan. All rights reserved. *
+* *
+* \file testchilitagsmodule.cpp *
+* \brief Test how to call a module from the outside. *
+* *
+* An example on how to call the example ChilitagsModule module from the *
+* outside. *
+* *
+* Please cite the following work if using this work: *
+* *
+* Chilitags for NAO Robot. B. Irfan and S. Lemaignan. University of *
+* Plymouth, UK. https://github.com/birfan/chilitags. 2016. *
+* *
+* Chilitags 2: Robust Fiducial Markers for Augmented Reality. Q. Bonnard, *
+* S. Lemaignan, G. Zufferey, A. Mazzei, S. Cuendet, N. Li, P. Dillenbourg.*
+* CHILI, EPFL, Switzerland. http://chili.epfl.ch/software. 2013. *
+* *
+* Chilitags is free software: you can redistribute it and/or modify *
+* it under the terms of the Lesser GNU General Public License as *
+* published by the Free Software Foundation, either version 3 of the *
+* License, or (at your option) any later version. *
+* *
+* Chilitags is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* ChilitagsModule is released under GNU Lesser General Public License v3.0 *
+* (LGPL3) in accordance with Chilitags (Bonnard et al., 2013). You should *
+* have received a copy of the GNU Lesser General Public License along with *
+* Chilitags. If not, see . *
+*******************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(int argc, char* argv[]) {
+ if(argc != 2)
+ {
+ std::cerr << "Wrong number of arguments!" << std::endl;
+ std::cerr << "Usage: testchilitagsmodule NAO_IP" << std::endl;
+ exit(2);
+ }
+
+ const std::string robotIP = argv[1];
+ int port = 9559;
+ int camIndex = 0;
+ float tagSize = 20.f;
+ std::string configFilename = "tag_configuration_sample.yml";
+
+ std::vector > givenTag;
+
+ try {
+ /** Create a generic proxy to "ChilitagsModule" module.
+ * Arguments for the constructor are
+ * - name of the module
+ * - string containing the IP adress of the robot
+ * - port (default is 9559)
+ */
+ boost::shared_ptr broker =
+ AL::ALBroker::createBroker("MyBroker", "0.0.0.0", 54500, robotIP, port);
+
+ boost::shared_ptr testProxy
+ = boost::shared_ptr(new AL::ALProxy(broker, "ChilitagsModule"));
+
+ // testProxy->callVoid("setCameraResolution640x480"); //optional
+
+ // testProxy->callVoid("setCameraResolution320x240"); //default but needed to reset again, if the resolution has changed
+
+ //testProxy->callVoid("subscribeCameraLocal", camIndex);
+
+ testProxy->callVoid("subscribeCameraRemote", robotIP, port, camIndex);
+
+ // testProxy->callVoid("readTagConfiguration", configFilename);
+
+ // testProxy->callVoid("setDefaultTagSize", tagSize);
+
+ // testProxy->callVoid("resetTagSettings");
+
+ // std::vector> allTags = testProxy->call< std::vector< std::vector > >("estimatePosAllTags");
+
+ givenTag = testProxy->call< std::vector< std::vector > >("estimatePosGivenTag", std::string("8"));
+
+ testProxy->callVoid("unsubscribeCamera");
+
+ for (std::vector >::const_iterator i = givenTag.begin(); i != givenTag.end(); ++i)
+ std::cout << *i << std::endl;
+
+ // for (std::vector>::const_iterator i = allTags.begin(); i != allTags.end(); ++i)
+ // std::cout << *i << std::endl;
+
+ }
+ catch (const AL::ALError& e) {
+ std::cerr << e.what() << std::endl;
+ }
+}
diff --git a/naoModule/chilitagsmodule/testchilitagsmodule.py b/naoModule/chilitagsmodule/testchilitagsmodule.py
new file mode 100755
index 0000000..cf9393d
--- /dev/null
+++ b/naoModule/chilitagsmodule/testchilitagsmodule.py
@@ -0,0 +1,90 @@
+#!/usr/local/bin/python
+"""
+/*******************************************************************************
+* Copyright (c) 2016-present, Bahar Irfan. All rights reserved. *
+* *
+* A sample test file for accessing the ChilitagsModule through Python. *
+* *
+* Please cite the following work if using this work: *
+* *
+* Chilitags for NAO Robot. B. Irfan and S. Lemaignan. University of *
+* Plymouth, UK. https://github.com/birfan/chilitags. 2016. *
+* *
+* Chilitags 2: Robust Fiducial Markers for Augmented Reality. Q. Bonnard, *
+* S. Lemaignan, G. Zufferey, A. Mazzei, S. Cuendet, N. Li, P. Dillenbourg.*
+* CHILI, EPFL, Switzerland. http://chili.epfl.ch/software. 2013. *
+* *
+* Chilitags is free software: you can redistribute it and/or modify *
+* it under the terms of the Lesser GNU General Public License as *
+* published by the Free Software Foundation, either version 3 of the *
+* License, or (at your option) any later version. *
+* *
+* Chilitags is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* ChilitagsModule is released under GNU Lesser General Public License v3.0 *
+* (LGPL3) in accordance with Chilitags (Bonnard et al., 2013). You should *
+* have received a copy of the GNU Lesser General Public License along with *
+* Chilitags. If not, see . *
+*******************************************************************************/
+"""
+
+__version__ = '0.0.1'
+
+__copyright__ = 'Copyright (c) 2016-present, Bahar Irfan. All rights reserved.'
+__author__ = 'Bahar Irfan'
+__email__ = 'bahar.irfan@plymouth.ac.uk'
+
+
+import qi
+
+robotIP = "127.0.0.1"
+#robotIP = "192.168.1.115" #IP address of the robot if connecting remotely
+port = 9559
+camIndex = 0 # 0: top camera, 1: bottom camera
+tagNumber = 8 # tag number to detect
+configFilename = "tag_configuration_sample.yml";
+
+connectAddress = "tcp://" + robotIP + ":" + str(port)
+
+qiapp = qi.Application(url=connectAddress)
+qiapp.start()
+session = qi.Session()
+session.connect(connectAddress)
+chilitags = session.service("ChilitagsModule")
+
+#chilitags.setCameraResolution640x480() # comment this line to set the camera resolution to default (320x240)
+
+#chilitags.setCameraResolution320x240() # default but needed to reset again, if the resolution has changed
+
+#chilitags.subscribeCameraDefault() # subscribes and starts the bottom camera (camIndex = 1)
+
+#chilitags.subscribeCameraLocal(camIndex) # comment the line above and uncomment this line to use the top camera instead (camIndex = 0)
+
+chilitags.subscribeCameraRemote(robotIP, port, camIndex) # comment the line above and uncomment this line to connect to the robot remotely
+
+chilitags.setDefaultTagSize(20)
+
+#chilitags.readTagConfiguration(configFilename)
+
+#chilitags.resetTagSettings()
+
+givenTag = chilitags.estimatePosGivenTag(str(tagNumber)) # estimate the position of a given tag
+
+allTags = chilitags.estimatePosAllTags() # estimate the position of all tags
+
+print("Transformation matrix from given tag " + str(tagNumber))
+for i in range(0, len(givenTag)):
+ for j in range(0, len(givenTag[i])):
+ print(givenTag[i][j])
+
+print("Transformation matrices for all visible tags")
+for i in range(0, len(allTags)):
+ for j in range(0, len(allTags[i])):
+ print(allTags[i][j])
+
+chilitags.unsubscribeCamera() # unsubscribes the camera (necessary before subscribing again)
+
+qiapp.stop()
diff --git a/naoModule/compiled_files/libchilitags.so b/naoModule/compiled_files/libchilitags.so
new file mode 100755
index 0000000..0a351b1
Binary files /dev/null and b/naoModule/compiled_files/libchilitags.so differ
diff --git a/naoModule/compiled_files/libchilitags_static.a b/naoModule/compiled_files/libchilitags_static.a
new file mode 100755
index 0000000..95d9784
Binary files /dev/null and b/naoModule/compiled_files/libchilitags_static.a differ
diff --git a/naoModule/compiled_files/libchilitagsmodule.so b/naoModule/compiled_files/libchilitagsmodule.so
new file mode 100755
index 0000000..6655dd0
Binary files /dev/null and b/naoModule/compiled_files/libchilitagsmodule.so differ
diff --git a/naoModule/compiled_files/libstdc++.so b/naoModule/compiled_files/libstdc++.so
new file mode 100755
index 0000000..ccbebc6
Binary files /dev/null and b/naoModule/compiled_files/libstdc++.so differ
diff --git a/naoModule/compiled_files/libstdc++.so.6 b/naoModule/compiled_files/libstdc++.so.6
new file mode 100755
index 0000000..ccbebc6
Binary files /dev/null and b/naoModule/compiled_files/libstdc++.so.6 differ
diff --git a/naoModule/compiled_files/libstdc++.so.6.0.21 b/naoModule/compiled_files/libstdc++.so.6.0.21
new file mode 100755
index 0000000..ccbebc6
Binary files /dev/null and b/naoModule/compiled_files/libstdc++.so.6.0.21 differ
diff --git a/naoModule/compiled_files/libstdc++.so.6.0.21-gdb.py b/naoModule/compiled_files/libstdc++.so.6.0.21-gdb.py
new file mode 100755
index 0000000..6b0cffe
--- /dev/null
+++ b/naoModule/compiled_files/libstdc++.so.6.0.21-gdb.py
@@ -0,0 +1,61 @@
+# -*- python -*-
+# Copyright (C) 2009-2015 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+import sys
+import gdb
+import os
+import os.path
+
+pythondir = '/usr/local/share/gcc-5.3.0/python'
+libdir = '/usr/local/lib'
+
+# This file might be loaded when there is no current objfile. This
+# can happen if the user loads it manually. In this case we don't
+# update sys.path; instead we just hope the user managed to do that
+# beforehand.
+if gdb.current_objfile () is not None:
+ # Update module path. We want to find the relative path from libdir
+ # to pythondir, and then we want to apply that relative path to the
+ # directory holding the objfile with which this file is associated.
+ # This preserves relocatability of the gcc tree.
+
+ # Do a simple normalization that removes duplicate separators.
+ pythondir = os.path.normpath (pythondir)
+ libdir = os.path.normpath (libdir)
+
+ prefix = os.path.commonprefix ([libdir, pythondir])
+ # In some bizarre configuration we might have found a match in the
+ # middle of a directory name.
+ if prefix[-1] != '/':
+ prefix = os.path.dirname (prefix) + '/'
+
+ # Strip off the prefix.
+ pythondir = pythondir[len (prefix):]
+ libdir = libdir[len (prefix):]
+
+ # Compute the ".."s needed to get from libdir to the prefix.
+ dotdots = ('..' + os.sep) * len (libdir.split (os.sep))
+
+ objfile = gdb.current_objfile ().filename
+ dir_ = os.path.join (os.path.dirname (objfile), dotdots, pythondir)
+
+ if not dir_ in sys.path:
+ sys.path.insert(0, dir_)
+
+# Call a function as a plain import would not execute body of the included file
+# on repeated reloads of this object file.
+from libstdcxx.v6 import register_libstdcxx_printers
+register_libstdcxx_printers(gdb.current_objfile())
diff --git a/naoModule/compiled_files/testchilitagsmodule b/naoModule/compiled_files/testchilitagsmodule
new file mode 100755
index 0000000..a3678a5
Binary files /dev/null and b/naoModule/compiled_files/testchilitagsmodule differ
diff --git a/naoModule/compiled_files/testchilitagsmodule.py b/naoModule/compiled_files/testchilitagsmodule.py
new file mode 100755
index 0000000..c821283
--- /dev/null
+++ b/naoModule/compiled_files/testchilitagsmodule.py
@@ -0,0 +1,90 @@
+#!/usr/local/bin/python
+"""
+/*******************************************************************************
+* Copyright (c) 2016-present, Bahar Irfan. All rights reserved. *
+* *
+* A sample test file for accessing the ChilitagsModule through Python. *
+* *
+* Please cite the following work if using this work: *
+* *
+* Chilitags for NAO Robot. B. Irfan and S. Lemaignan. University of *
+* Plymouth, UK. https://github.com/birfan/chilitags. 2016. *
+* *
+* Chilitags 2: Robust Fiducial Markers for Augmented Reality. Q. Bonnard, *
+* S. Lemaignan, G. Zufferey, A. Mazzei, S. Cuendet, N. Li, P. Dillenbourg.*
+* CHILI, EPFL, Switzerland. http://chili.epfl.ch/software. 2013. *
+* *
+* Chilitags is free software: you can redistribute it and/or modify *
+* it under the terms of the Lesser GNU General Public License as *
+* published by the Free Software Foundation, either version 3 of the *
+* License, or (at your option) any later version. *
+* *
+* Chilitags is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU Lesser General Public License for more details. *
+* *
+* ChilitagsModule is released under GNU Lesser General Public License v3.0 *
+* (LGPL3) in accordance with Chilitags (Bonnard et al., 2013). You should *
+* have received a copy of the GNU Lesser General Public License along with *
+* Chilitags. If not, see . *
+*******************************************************************************/
+"""
+
+__version__ = '0.0.1'
+
+__copyright__ = 'Copyright (c) 2016-present, Bahar Irfan. All rights reserved.'
+__author__ = 'Bahar Irfan'
+__email__ = 'bahar.irfan@plymouth.ac.uk'
+
+
+import qi
+
+#robotIP = "127.0.0.1"
+robotIP = "192.168.1.115" #IP address of the robot if connecting remotely
+port = 9559
+camIndex = 0 # 0: top camera, 1: bottom camera
+tagNumber = 8 # tag number to detect
+configFilename = "tag_configuration_sample.yml";
+
+connectAddress = "tcp://" + robotIP + ":" + str(port)
+
+qiapp = qi.Application(url=connectAddress)
+qiapp.start()
+session = qi.Session()
+session.connect(connectAddress)
+chilitags = session.service("ChilitagsModule")
+
+#chilitags.setCameraResolution640x480() # comment this line to set the camera resolution to default (320x240)
+
+#chilitags.setCameraResolution320x240() # default but needed to reset again, if the resolution has changed
+
+#chilitags.subscribeCameraDefault() # subscribes and starts the bottom camera (camIndex = 1)
+
+#chilitags.subscribeCameraLocal(camIndex) # comment the line above and uncomment this line to use the top camera instead (camIndex = 0)
+
+chilitags.subscribeCameraRemote(robotIP, port, camIndex) # comment the line above and uncomment this line to connect to the robot remotely
+
+chilitags.setDefaultTagSize(20)
+
+#chilitags.readTagConfiguration(configFilename)
+
+#chilitags.resetTagSettings()
+
+givenTag = chilitags.estimatePosGivenTag(str(tagNumber)) # estimate the position of a given tag
+
+allTags = chilitags.estimatePosAllTags() # estimate the position of all tags
+
+print("Transformation matrix from given tag " + str(tagNumber))
+for i in range(0, len(givenTag)):
+ for j in range(0, len(givenTag[i])):
+ print(givenTag[i][j])
+
+print("Transformation matrices for all visible tags")
+for i in range(0, len(allTags)):
+ for j in range(0, len(allTags[i])):
+ print(allTags[i][j])
+
+chilitags.unsubscribeCamera() # unsubscribes the camera (necessary before subscribing again)
+
+qiapp.stop()
diff --git a/naoModule/libnaoqi_files/include/alaudio/alsoundextractor.h b/naoModule/libnaoqi_files/include/alaudio/alsoundextractor.h
new file mode 100755
index 0000000..5c36db2
--- /dev/null
+++ b/naoModule/libnaoqi_files/include/alaudio/alsoundextractor.h
@@ -0,0 +1,137 @@
+/**
+ * @author Alexandre Mazel
+ *
+ */
+
+
+#pragma once
+#ifndef _LIBALAUDIO_ALAUDIO_ALSOUNDEXTRACTOR_H_
+#define _LIBALAUDIO_ALAUDIO_ALSOUNDEXTRACTOR_H_
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+typedef signed short AL_SOUND_FORMAT; // ASSUME: sound data are in 16 bits
+
+// deprecated
+// usable and practical logging system
+
+#define DESACTIVATE_ALL_DEV_INFO // define me to desactivate all debug or trace info (should be defined on public release version)
+
+#ifndef DESACTIVATE_ALL_DEV_INFO
+# define AL_SOUND_EXTRACTOR_DEBUG_PRINTF(...) if ( getDebugMode() ) { printf(__VA_ARGS__); }
+# define AL_SOUND_EXTRACTOR_DEBUG_LOG(onestr) if ( getDebugMode() ) { fLoggerProxy->debug( getName(), std::string( onestr ) ); }
+# define AL_SOUND_EXTRACTOR_INFO_LOG(onestr) if ( getDebugMode() ) { fLoggerProxy->info( getName(), std::string( onestr ) ); }
+# define AL_SOUND_EXTRACTOR_ERROR_LOG(onestr) if ( getDebugMode() ) { fLoggerProxy->error( getName(), std::string( onestr ) ); }
+#else
+# define AL_SOUND_EXTRACTOR_DEBUG_PRINTF(...) /* onestr */
+# define AL_SOUND_EXTRACTOR_DEBUG_LOG(onestr) /* onestr */
+# define AL_SOUND_EXTRACTOR_INFO_LOG(onestr) /* onestr */
+# define AL_SOUND_EXTRACTOR_ERROR_LOG(onestr) /* onestr */
+#endif
+
+namespace AL
+{
+class ALProxy;
+class ALBroker;
+
+enum AUDIOCHANNELTYPE
+{
+ ALLCHANNELS = 0,
+ LEFTCHANNEL = 1,
+ RIGHTCHANNEL = 2,
+ FRONTCHANNEL = 3,
+ REARCHANNEL = 4,
+ FIRSTCHANNEL = LEFTCHANNEL,
+ SECONDCHANNEL= RIGHTCHANNEL,
+ THIRDCHANNEL = FRONTCHANNEL,
+ FOURTHCHANNEL= REARCHANNEL
+};
+
+class ALSoundExtractor: public ALExtractor
+{
+public:
+ ALSoundExtractor( boost::shared_ptr pBroker, std::string pName );
+
+ virtual ~ALSoundExtractor();
+
+ virtual std::string version(void) {return "";}
+ virtual void startDetection(void);
+ virtual void stopDetection(void);
+
+ /**
+ * setDebugMode. enable/disable the printing of some debug information
+ * @param pbSetOrUnset enable the functionality when true
+ * @deprecated This functionnality is now handled by qi/log
+ */
+ QI_API_DEPRECATED void setDebugMode(const bool &pbSetOrUnset = true)
+ {
+ qiLogWarning("audio.alsoundextractor", "The call to setDebugMode() is "
+ "now deprectated. This functionnality is now handled by qi/log");
+ fbDebugMode = pbSetOrUnset;
+ }
+
+ /**
+ * getDebugMode. get the status about the printing of some debug information
+ * @deprecated This functionnality is now handled by qi/log
+ */
+ QI_API_DEPRECATED inline bool getDebugMode(void)
+ {
+ qiLogWarning("audio.alsoundextractor", "The call to getDebugMode() is "
+ "now deprectated. This functionnality is now handled by qi/log");
+ return fbDebugMode;
+ }
+
+
+ virtual void process(const int & nbOfChannels,
+ const int & nbrOfSamplesByChannel,
+ const AL_SOUND_FORMAT * buffer,
+ const ALValue & timestamp);
+
+
+ QI_API_DEPRECATED virtual void processSound(const int nbOfChannels,
+ const int nbrOfSamplesByChannel,
+ const AL_SOUND_FORMAT* buffer);
+
+ QI_API_DEPRECATED virtual void processSoundRemote(const int & nbOfChannels,
+ const int & nbrOfSamplesByChannel,
+ const ALValue & buffer);
+
+private:
+ void processRemote(const int & nbOfChannels,
+ const int & nbrOfSamplesByChannel,
+ const ALValue & timestamp,
+ const ALValue & buffer);
+
+ void xStartDetection(const int pPeriod,
+ const float pPrecision)
+ {
+ startDetection();
+ }
+
+ virtual void xUpdateParameters(const int pPeriod,
+ const float pPrecision){}
+
+ void xStopDetection(void)
+ {
+ stopDetection();
+ }
+
+ virtual std::vector getOutputNames();
+
+protected:
+
+ bool fIsRunning;
+ bool fbDebugMode;
+ boost::shared_ptr audioDevice;
+ ALValue fNullTimestamp;
+};
+
+}
+
+#endif
diff --git a/naoModule/libnaoqi_files/include/albehavior/albehavior.h b/naoModule/libnaoqi_files/include/albehavior/albehavior.h
new file mode 100755
index 0000000..53f76e8
--- /dev/null
+++ b/naoModule/libnaoqi_files/include/albehavior/albehavior.h
@@ -0,0 +1,339 @@
+/**
+* @author Aldebaran Robotics
+* Aldebaran Robotics (c) 2007 All Rights Reserved
+*/
+
+/**
+* The class that implements a Choregraphe box.
+* A behavior is an entity that have inputs and outputs.
+* So he can be enabled and produce events.
+*/
+
+
+#pragma once
+
+#ifndef _LIB_ALBEHAVIOR_ALBEHAVIOR_ALBEHAVIOR_H_
+#define _LIB_ALBEHAVIOR_ALBEHAVIOR_ALBEHAVIOR_H_
+
+#include
+#include
+#include
+
+namespace AL
+{
+ class ALBroker;
+ class ALMemoryProxy;
+ class ALResourceManagerProxy;
+ class ALProxy;
+ class ALMutexRW;
+ class ALOwner;
+ class ALTimeline;
+
+ struct Parameter
+ {
+ ::AL::ALValue value;
+ bool inheritFromParent;
+
+ Parameter() : inheritFromParent(false) {}
+ Parameter(const ::AL::ALValue& pValue, bool pInheritFromParent): value(pValue),
+ inheritFromParent(pInheritFromParent) {}
+ };
+
+ class ALBehavior: public ALModuleCore
+ {
+ protected:
+
+ //
+ // ALBehavior type definition
+ //
+
+ struct IO
+ {
+ // a link/input/output class.
+ // It stores the name of the IO, and the type.
+
+ IO(const std::string & pName, bool pIsBang) : fName(pName),
+ fIsBang(pIsBang)
+ {
+ // NOTHING
+ }
+
+ bool operator<(const ::AL::ALBehavior::IO& io) const {return fName < io.fName;}
+
+ const std::string fName;
+ const bool fIsBang; // always false for inputs !
+ };
+
+ typedef ::AL::ALBehavior::IO TInput;
+ typedef ::AL::ALBehavior::IO TOutput;
+
+ /**
+ * for each input, keep a list of ALMemory's value to which
+ * the input is subscribed.
+ */
+ typedef std::list TListValues;
+ typedef TListValues::iterator ITListValues;
+ typedef TListValues::const_iterator CITListValues;
+
+ typedef std::map TInputMap;
+ typedef TInputMap::iterator ITInputMap;
+ typedef TInputMap::const_iterator CITInputMap;
+
+ typedef std::map TOutputMap;
+ typedef TOutputMap::iterator ITOutputMap;
+ typedef TOutputMap::const_iterator CITOutputMap;
+
+ typedef std::map TParameterMap;
+ typedef TParameterMap::iterator ITParameterMap;
+ typedef TParameterMap::const_iterator CITParameterMap;
+
+ typedef std::vector TParameterVec;
+ typedef TParameterVec::const_iterator CITParameterVec;
+
+ // do something a little different, as parameters are a lot less often subscribed to anything !
+ // and it's easier to manipulate std::string for parameters, in order to use ALBehavior API.
+ typedef std::map TParameterSubscriptionMap;
+ typedef TParameterSubscriptionMap::iterator ITParameterSubscriptionMap;
+ typedef TParameterSubscriptionMap::const_iterator CITParameterSubscriptionMap;
+
+ //
+ // ALBehavior method definition
+ //
+
+ public :
+
+ /*
+ * Creates an ALModule. An ALModule has a name.
+ * @param pName the behavior name
+ */
+ ALBehavior(boost::shared_ptr pBroker, const std::string& pName);
+
+ virtual ~ALBehavior();
+
+
+ /**
+ * Wait a resource
+ * @param pList: resource name list
+ * @param pCallback: callback if loose resource
+ * @param pTimeout: timeout if wait resource
+ * @param pOwnerType (unused)
+ */
+ void waitFor(const std::vector& pList , const char *pCallback , int pTimeout, int pOwnerType);
+
+ /**
+ * Wait a resource
+ * @param pCallback: callback if loose resource
+ */
+ void acquireResources();
+
+ /**
+ * Wait his resource but never take resource to someone else
+ */
+ void waitResourceFree();
+
+ /**
+ * setResources
+ * @param pList: resource name list to store
+ */
+ void setResources(const std::vector& pList, const int &pTimeout);
+
+ /**
+ * isResourceFree
+ * @param pList: resource name list
+ * @return true if box resources free
+ */
+ bool isResourceFree(const std::vector& pList);
+
+ /**
+ * releaseResource Release box resources
+
+ */
+ void releaseResource();
+
+ virtual void init();
+
+ /**
+ * Will enable or disable a behavior. DEPRECATED since 1.14
+ * When switching from one state to another, all the subscription will be done/undone.
+ */
+ void setEnabled(const bool& pEnabled);
+
+ /**
+ * return true if state is ENABLED, false otherwise. DEPRECATED since 1.14
+ */
+ bool isEnabled();
+
+ /**
+ * DEPRECATED since 1.14
+ */
+ void setParameters(const ALValue& pValue);
+ void addOutputLink( const std::string & pOutputName, const std::string & pALMemoryValueName );
+ void removeOutputLink(const std::string & pOutputName, const std::string & pALMemoryValueName);
+
+ /**
+ * A behavior can have a parent (hierarchy in Choregraphe !)
+ * Using a string (name) instead of a pointer as we can come from Python !
+ */
+ void setParentFromName(const std::string& p);
+
+ /**
+ * Returns the input/ouput names !
+ */
+ std::vector getInputNames();
+ std::vector getOutputNames();
+
+ /**
+ * addInput. Add a new input to this behavior
+ * @param pInputName input name !
+ * @return true if input added (false if an in put with the same name already exists
+ */
+ bool addInput(const std::string & pInputName);
+
+ /**
+ * addOutput. Add a new output to this behavior
+ * @param pOutputName output name !
+ * @param pbIsBang is it a bang type ?
+ * @return true if input added (false if an in put with the same name already exists
+ */
+ bool addOutput(const std::string & pOutputName, bool pIsBang);
+
+ /**
+ * addParameter. Add a new parameter to this behavior
+ * @param pParameterName parameter name !
+ * @param pValue value of parameter
+ * @param pInheritFromParent do we want to inherit from parent
+ */
+ void addParameter(const std::string & pParameterName, const ::AL::ALValue& pValue, const bool& pInheritFromParent);
+
+ /**
+ * Returns current value of a given parameter.
+ * Throw an exception if parameter does not exist.
+ * Method is bound, and thus cannot be const :-(
+ */
+ ALValue getParameter(const std::string& pParameterName);
+
+ /**
+ * Returns the list of parameters.
+ */
+ std::vector getParametersList();
+
+ /**
+ * Returns true if box has a parameter of this name, false otherwise.
+ */
+ bool hasParameter(const std::string& pParameterName);
+
+ /**
+ * Set a given parameter to a new value.
+ * Throw an exception if parameter does not exist.
+ */
+ void setParameter(const std::string& pParameterName, const ::AL::ALValue& pValue);
+
+ /**
+ * connectInput. Add a connection between an ALMemory value and one input, it's a kind of trigger for this behavior: when a value in ALMemory change, the value is send to an input of this behavior.
+ * @param pInputName name of an input
+ * @param pALMemoryValueName name of the ALMemory that will
+ * throw an exception if something goes wrong
+ */
+ void _connectInput(const std::string & pInputName,
+ const std::string & pALMemoryValueName, const bool& enabled);
+
+ /**
+ * connectParameter. Add a connection between an ALMemory value and one parameter.
+ * Any change to given value will update parameter accordingly.
+ * @param pParameterName name of a parameter
+ * @param pALMemoryValueName name of the ALMemory that will
+ * throw an exception if something goes wrong
+ */
+ void _connectParameter(const std::string & pParameterName,
+ const std::string & pALMemoryValueName, const bool& enabled);
+
+ /**
+ * connectOutput. Add a link between an inner value and an output.
+ * Whenever the value changed, the matching output is stimulated.
+ * @param pOutputName name of an output
+ * @param pALMemoryValueName name of the ALMemory that will be removed
+ * throw an exception if something goes wrong
+ */
+ void _connectOutput(const std::string & pOutputName,
+ const std::string & pALMemoryValueName, const bool& enabled);
+
+ /**
+ * stimulateIP. stimulate the output of a box or the input of the diagram
+ * @param ioName
+ * @param p data
+ * throw an exception if something goes wrong
+ */
+ void stimulateIO(const std::string& ioName, const AL::ALValue& p);
+
+ /**
+ * dataChanged. Called by stm when subcription
+ * has been modified.
+ * @param pDataName Name of the modified data
+ * @param pValue Name of the modified data
+ * @param pMessage Name of the modified data
+ */
+ virtual void dataChanged(const std::string& pDataName,
+ const ::AL::ALValue& pValue,
+ const std::string& pMessage);
+
+ virtual std::string httpGet();
+
+ virtual void httpPut(const std::string& pValue);
+
+ void setTimeline(const boost::shared_ptr timeline);
+ boost::shared_ptr getTimeline();
+ void setParentTimeline(const boost::shared_ptr timeline);
+ boost::shared_ptr getParentTimeline();
+
+ //
+ // ALBehavior attribut definition
+ //
+
+ private:
+ boost::weak_ptr fParent;
+ std::string fParentName;
+ boost::weak_ptr fOwner;
+
+ protected:
+ boost::shared_ptr fStm;
+ boost::shared_ptr fResourceMnger;
+ boost::shared_ptr fToMe;
+ boost::shared_ptr fTimeline;
+ boost::weak_ptr fParentTimeline;
+
+ // list of inputs & mutex
+ TInputMap fInputList;
+ boost::shared_ptr fInputListMutex;
+ // same for outputs
+ TOutputMap fOutputList;
+ boost::shared_ptr fOutputListMutex;
+ // params
+ TParameterMap fParametersMap;
+ boost::shared_ptr fParametersMapMutex;
+ TParameterVec fParametersInStm;
+
+ // params subscription, separately
+ TParameterSubscriptionMap fParametersSubsMap;
+ boost::shared_ptr fParametersSubsMapMutex;
+
+ // true if someone asked to release resources
+ //bool fReleaseAsked;
+
+ // box resource list
+ std::vector fResourceNameList;
+ // box resource timeout
+ int fTimeoutResource;
+
+ // a string that can hold any data and that will be served on the behavior web page
+ std::string fHttpData;
+
+ bool fIsEnabled;
+
+ public:
+ static bool fDeprecationWarning;
+ };
+
+} // namespace AL
+
+#endif // _LIB_ALBEHAVIOR_ALBEHAVIOR_ALBEHAVIOR_H_
+
diff --git a/naoModule/libnaoqi_files/include/albehavior/altimeline.h b/naoModule/libnaoqi_files/include/albehavior/altimeline.h
new file mode 100755
index 0000000..3626292
--- /dev/null
+++ b/naoModule/libnaoqi_files/include/albehavior/altimeline.h
@@ -0,0 +1,55 @@
+/**
+* @author Aldebaran Robotics
+* Aldebaran Robotics (c) 2012 All Rights Reserved
+*/
+
+#pragma once
+
+#ifndef _LIB_ALBEHAVIOR_ALTIMELINE_ALBOX_H_
+#define _LIB_ALBEHAVIOR_ALTIMELINE_ALBOX_H_
+
+namespace AL
+{
+
+ class ALTimeline
+ {
+ public :
+
+ ALTimeline(){}
+ virtual ~ALTimeline(){}
+
+ /**
+ * play.\n
+ * Read a timeline from the current buffer till the end.\n
+ */
+ virtual void play(void) = 0;
+
+ /**
+ * pause.\n
+ * Pause the reading a timeline at the current frame.\n
+ */
+ virtual void pause(void) = 0;
+
+
+ /**
+ * stop.\n
+ * Stop reading a timeline.\n
+ */
+ virtual void stop(void) = 0;
+
+ /**
+ * goTo.\n
+ * goTo moving time cursor.\n
+ */
+ virtual void goTo(const int &pFrame) = 0;
+ virtual void goTo(const std::string &pFrameName) = 0;
+
+ virtual int getSize() const = 0;
+ virtual int getFPS() const = 0;
+ virtual void setFPS(const int fps) = 0;
+ };
+
+} // namespace AL
+
+#endif // _LIB_ALBEHAVIOR_ALTIMELINE_ALBOX_H_
+
diff --git a/naoModule/libnaoqi_files/include/alcommon/albroker.h b/naoModule/libnaoqi_files/include/alcommon/albroker.h
new file mode 100755
index 0000000..9ccbb70
--- /dev/null
+++ b/naoModule/libnaoqi_files/include/alcommon/albroker.h
@@ -0,0 +1,325 @@
+/**
+ * @author Aldebaran Robotics
+ * Copyright (c) Aldebaran Robotics 2011, 2011, 2012 All Rights Reserved
+ */
+
+/** @file
+ * @brief
+ */
+
+#pragma once
+#ifndef _LIBALCOMMON_ALCOMMON_ALBROKER_H_
+#define _LIBALCOMMON_ALCOMMON_ALBROKER_H_
+
+# include
+# include