Nao Module: Difference between revisions
(Created page with "== How to create a module == === module_generator === The easiest way to create a new module, is by using the module_generator script. For some reason, however, it is not inc...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
The easiest way to create a new module, is by using the module_generator script. For some reason, however, it is not included with NAOqi C++ SDK 1.14.1, but it still available in the 1.12.5 SDK package (can be downloaded from [http://users.aldebaran-robotics.com/ http://users.aldebaran-robotics.com/]). It is not clear, why the module_generator was dropped, but it seems to be working with the newer version as well. | The easiest way to create a new module, is by using the module_generator script. For some reason, however, it is not included with NAOqi C++ SDK 1.14.1, but it still available in the 1.12.5 SDK package (can be downloaded from [http://users.aldebaran-robotics.com/ http://users.aldebaran-robotics.com/]). It is not clear, why the module_generator was dropped, but it seems to be working with the newer version as well. | ||
To use the module_generator, you do not have to keep the whole old SDK package, you only need the python scipt | To use the module_generator, you do not have to keep the whole old SDK package, you only need the python scipt <b>/path/to/sdk/bin/module_generator.py</b> and the template files <b>/path/to/sdk/share/module_generator/templates/module/</b>. | ||
The module_generator generates some skeleton code that can be used to create your own module. Keep in mind to use the cross-toolchain, as the module is going to work in the Nao. | The module_generator generates some skeleton code that can be used to create your own module. Keep in mind to use the cross-toolchain, as the module is going to work in the Nao. | ||
Line 10: | Line 10: | ||
=== Loading the module === | === Loading the module === | ||
When you have managed to build the module .so file, you also need to place it inside the Nao and make sure the Nao will load your module. According to [http://robotica.unileon.es/mediawiki/index.php/Nao_tutorial_1:_First_steps#Modules this] page (about older version, some mismatch), it is neccessary to place the module | When you have managed to build the module .so file, you also need to place it inside the Nao and make sure the Nao will load your module. According to [http://robotica.unileon.es/mediawiki/index.php/Nao_tutorial_1:_First_steps#Modules this] page (about older version, some mismatch), it is neccessary to place the module files in <b>/home/nao/naoqi/lib/naoqi/</b>. The directories might not exist yet. Now you need to tell NAOqi to load your module. You can do it by adding the module's name with its full path to the <b>/home/nao/naoqi/preferences/autoload.ini</b> file under the "[user]" tag. | ||
Actually it is probable that the modules could be located anywhere, as long as their full paths are given, but at the time when our team was trying to solve the module-loading problem, we found the aforenamed webpage and used its suggestion. It should be tested to be sure.<br><br> | Actually it is probable that the modules could be located anywhere, as long as their full paths are given, but at the time when our team was trying to solve the module-loading problem, we found the aforenamed webpage and used its suggestion. It should be tested to be sure.<br><br> | ||
The NAOqi loads all the modules at startup. Unfortunately, our team hasn't found a way to load a single module at a time yet, so we just restart the whole NAOqi using the command <code>nao restart</code>. If something fails and you would like to find out the error message, then the easiest way is to execute NAOqi manually with the command <code>naoqi</code>. These messages can most likely be found in some log files as well. | The NAOqi loads all the modules at startup. Unfortunately, our team hasn't found a way to load a single module at a time yet, so we just restart the whole NAOqi using the command <code>nao restart</code>. If something fails and you would like to find out the error message, then the easiest way is to execute NAOqi manually with the command <code>naoqi</code>. These messages can most likely be found in some log files as well. | ||
== Possible problems == | |||
=== Module loading fails === | |||
The easiest way to track down the problem, is to stop NAOqi with <code>nao stop</code> and enter <code>naoqi</code>. It shows information about the full module-loading sequence and is most likely to give you some error message about you own module. That way you can narrow your problem down to something more specific. | |||
=== Blinking green light === | |||
The blinking green light on the stomach means that the NAOqi is not working. It might easily happen during a module development proccess. It turns out that the NAOqi error-handling is not very good, an accidental error in your code might cause the NAOqi to crash during the module loading proccess. The obvious solution is removing or fixing the module and restarting the NAOqi with <code>nao restart</code>. | |||
It can also happen when you overwrite the old module with the new one inside the Nao. As the NAOqi has already loaded the module into its memory, overwriting it will cause a crash in most cases. The solution is to just restart the NAOqi. |
Latest revision as of 01:41, 7 February 2013
How to create a module
module_generator
The easiest way to create a new module, is by using the module_generator script. For some reason, however, it is not included with NAOqi C++ SDK 1.14.1, but it still available in the 1.12.5 SDK package (can be downloaded from http://users.aldebaran-robotics.com/). It is not clear, why the module_generator was dropped, but it seems to be working with the newer version as well.
To use the module_generator, you do not have to keep the whole old SDK package, you only need the python scipt /path/to/sdk/bin/module_generator.py and the template files /path/to/sdk/share/module_generator/templates/module/.
The module_generator generates some skeleton code that can be used to create your own module. Keep in mind to use the cross-toolchain, as the module is going to work in the Nao.
Loading the module
When you have managed to build the module .so file, you also need to place it inside the Nao and make sure the Nao will load your module. According to this page (about older version, some mismatch), it is neccessary to place the module files in /home/nao/naoqi/lib/naoqi/. The directories might not exist yet. Now you need to tell NAOqi to load your module. You can do it by adding the module's name with its full path to the /home/nao/naoqi/preferences/autoload.ini file under the "[user]" tag.
Actually it is probable that the modules could be located anywhere, as long as their full paths are given, but at the time when our team was trying to solve the module-loading problem, we found the aforenamed webpage and used its suggestion. It should be tested to be sure.
The NAOqi loads all the modules at startup. Unfortunately, our team hasn't found a way to load a single module at a time yet, so we just restart the whole NAOqi using the command nao restart
. If something fails and you would like to find out the error message, then the easiest way is to execute NAOqi manually with the command naoqi
. These messages can most likely be found in some log files as well.
Possible problems
Module loading fails
The easiest way to track down the problem, is to stop NAOqi with nao stop
and enter naoqi
. It shows information about the full module-loading sequence and is most likely to give you some error message about you own module. That way you can narrow your problem down to something more specific.
Blinking green light
The blinking green light on the stomach means that the NAOqi is not working. It might easily happen during a module development proccess. It turns out that the NAOqi error-handling is not very good, an accidental error in your code might cause the NAOqi to crash during the module loading proccess. The obvious solution is removing or fixing the module and restarting the NAOqi with nao restart
.
It can also happen when you overwrite the old module with the new one inside the Nao. As the NAOqi has already loaded the module into its memory, overwriting it will cause a crash in most cases. The solution is to just restart the NAOqi.