at Carnegie Mellon University
AIBO Networking Basics
Tekkotsu sets up two ports on the Aibo that you can telnet to for text input and output. The first is meant to be used as both standard output and standard input, and the second is meant for standard error (the difference is the second one is blocking). To use these, you should include Wireless/Socket.h. Socket.h defines two globals: sout and serr. To print to the standard output (by default port 10001) you can simply say:
Similary to print to the standard error (by default port 10002) you can simply say:
These standard text output sockets have automatic
fallbacks. In other words, if output is sent to serr, and nothing is connected
to port 10002, it will forward the output to sout. If nothing is
connected to port 10001, it will forward the output to the system cout, which is sent by the
system to port 59000.
Standard error (serr) is blocking and hence will slow your AIBO down significantly (the Main process does nothing for the 3+ milliseconds that it takes for wireless to send some data). It can be incredibly useful for debugging though, since it guarantees that the text is sent over wireless before it moves on to the next line.
For text input,
the best option is to use the TextMsgEvent
interface. You can simply subscribe to TextMsgEvent's. To actually send
a text string to the AIBO telnet to port 10001 on the Aibo, or type
the ControllerGUI input field:
!msg this will be received as a textmsgevent
Your Behavior will receive a TextMsgEvent with the string "this will be received as a textmsgevent".
Further information is available in the Console section of the TekkotsuMon Tutorial
Any data you want to send has to be encoded in a byte/char array. The LoadSave class provides some utilities for encoding primitive types into a buffer. To add serialization for your own classes, simply inherit from the LoadSave class and override the LoadBuffer, SaveBuffer, and getBinSize functions. It is recommended to look at some other subclasses of LoadSave to pick up some sample code - it's pretty mechanical.
The AIBO's MIPS processor is little endian. Since the AIBO probably has significantly less processing power than the Linux machine you are communicating with, the Tekkotsu wireless serializers send data out without converting to network byte order (big endian), and instead convert it on the receiving side.
Sample code can be found in the Behaviors/Mon directory.
Technical NotesArchitectural Overview
Execution and Configuration
Text Input, Output