jNabServer for Nabaztag

Last update : March 1, 2017

JNabServer is an open-source server software which handles communication with Nabaztag/tags, Wi-Fi enabled robotic rabbits that can be used as physical user-agents in human-computer interaction.

JNabServer is a part of a project by SPI -Research Group from University of Tampere in Finland. It is the base on a research on how Nabaztag could be used as an multimodal user-agent. The project is a part of Speech-based & Pervasive Interaction Group research.

JNabServer is written in j2se 6 (Java Standard edition) so it is platform independent. Main idea is that people can develop their applications and ideas more freely on jNabServer platform. By releasing this code as an Open-Source Project the developers want to give this extendible platform to be used in various projects including her own research in the university of Tampere.

The jNab server is started with the following command from the jNab folder

java -cp libjNab.jar jNab

in the command prompt window with a Java 6 environment.

The customization of the server is done in the configuration file jNab.conf. I set the following parameters:

# Ip address to which the server will be bound
jNab.server.ip=192.168.1.2

# Port to which the server will be bound to listen for Nabaztag’s
jNab.server.port=81

# Ip address to which the configuration server will be bound
jNab.conf.ip=192.168.1.2

# Port to which the configuration server will be bound to listen to a Telnet client
jNab.conf.port=6969

To manage the jNab.Server, a Telnet session is established with the telnet program which is usually located in the C:/WINDOWS/system32/ folder. The telnet program is started with the following command from the WINDOWS/system32/ folder

telnet.exe 192.168.1.2 6969

in the command prompt window (or use the telnet command o [ip-address] [port]). If the connection is succesful, the server will answer with a welcome message :

MicroServer configuration front-end. v1.0

An example is shown in the following figure :

Telnet

Telnet

If the connection fails, possible reasons are :

  • an error in the configuration file or in the telnet address
  • the ports are barred in the firewall
  • the ports are used by an other program running

A recommended solution to solve the problems is to verify the correct working of the server and the telnet client on the same computer with the IP-address “localhost” or “127.0.0.1”. If the computer running the jNabServer is managed by DHCP (Dynamic Host Configuration Protocol), the  IP-address attributed by the router is to be used.

To connect the Nabaztag’s to the server, you have to modify his connection parameters. To activate the wireless access-point of the Nabaztag, press down and hold the button between his ears while plugging the power cord. When all the lights of the Nabaztag turn blue, you can release the button. Catch the wireless network of the Nabaztag with the name nabaztag## on your laptop and click Connect.

Enter the Nabaztag IP address http://192.168.0.1 in the browser to access the Nabaztag configuration page. Go to the advanced configuration page and change the address of the Violet platform from r.nabaztag.com/vl to 192.168.1.4:81/vl. Click Update and Start and the Nabaztag will connect to the jNab-server.

The Nabaztag will request the bc.jsp webpage from the server with a HTTP-GET command and receive as answer the file bootcode.bin (59 KByte) with the binary boot code. It’s the initial bootcode from Violet before the protocol was changed to XMPP (Jabber).

The hardware of the Nabaztag consist of two moving ears which positions are tracked with optical sensors, a button, a microphone, a speaker and a rfid-reader. The rfid-reader reads tags of type ISO 14443 B. These tags operate on 13,56mhz and have a 4096-bit EEPROM.

The loaded byte code inside Nabaztag operates the following actions :

  • display and change the colour of the five LED’s (four in front and one in bottom)
  • turn the ears forward or backward
  • register a single or a double button-click
  • register an ear movement
  • read RFID tags
  • record and encode (ADPCM) sound from microphone when button was pressed for 2 seconds
  • receive and play sound to the speaker
  • send the events to the server
  • process data received from server
  • call the server with fixed intervals (ping interval)

The GET/POST requests used by the Nabaztag are the following :

  • bc.jsp (to request and process the correct booting byte code)
  • locate.jsp (to ask the IP adresses of the ping- and the broadcast-server)
  • p4.jsp (basic ping calls with informations about events)
  • record.jsp (encoded audio data of the recorded sound is passed to the server)
  • rfid.jsp (ID of the sniffed RFID is passed to the server)

A more detailed information is available at the website of the university of Tampere in Finland.

The implemented commands to send via the Telnet protocol to the jNab-server are (my Nabaztag “Aenderhues” and “Ouschterhues” with serial numbers “0013d3845819” and “0019db01e01f” are used as example) :

  • INFO server
  • SHUTDOWN client
  • SHUTDOWN server
  • INFO bunnies
  • INFO bunny: 0013d3845819
  • SET bunny name: 0013d3845819 Aenderhues
  • SET bunny ping interval: 0013d3845819 25
  • ADD bunny plugin: 0013d3845819 Dice_Plugin
  • SET bunny plugin parameter: 0013d3854819 Talkie_Plugin 0019db01e01f
  • REMOVE bunny plugin: 0013d3845819 Dice_Plugin
  • SAVE bunny: 0013d3845819

The available plugin’s are :

  • Dice_Plugin
  • GreenOrangeRedWithEars_Plugin
  • SystemOutLogger_Plugin
  • Echo_Plugin
  • Null_Plugin
  • Talkie_Plugin

The processing requests treated by the worker java class are :

  • case 1 : bunny asks for its bootcode
  • case 2 : bunny asks for location
  • case 3 : bunny notifies an event (ping, rfid, record, …)
  • case 4 : bunny asks for a choreography
  • case 5 : bunny asks for a local file

I installed the jNab-server on my Desktop (wired) and run the Telnet client on my Laptop (wireless), both are connected to a Thomson Speedtouch Router 585i of my Home Network (LAN). The following informations are displayed on the console during normal operation:

<jNab/server> new connection from /192.168.1.34:12933

<jNab/server/worker: /192.168.1.34:12933> Request received:

Request with params : {tc=7fffffff  v=65808  st=1  requestfile = /vl/p4.jsp  h=4  sd=0  sn=0013d3845819}

<jNab/server/worker: /192.168.1.34:12933> Processing request

<bunny /0013d3845819> Handling a ping event

<jNab/server/worker :/192.168.1.34:12933> Packet to send is a default packet

<jNab/server/worker:/192.168.1.34:12933> Sending packet:

Packet:

[Data block type: 3 size: 1]

[Raw data :20]

[Ping interval block set for 20 seconds]

[Data block type: 4 size: 23]

[Raw data 127 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]

The server sends a packet to the Nabaztag when it request a ping command. The answer packets are custom byte arrays. These byte arrays start with byte 7F and end with FF and 0A bytes. In between there can be any amount of blocks. Blocks consists of three parts. First there is a byte telling the type of the block(03 , 04 , 09 and 0A). Next three bytes are reserved to indicate the length of data in the blocks. After the length bytes there is the data for the block. The following figure shows an example :

Nabaztag packet

Nabaztag packet

There are four different block types :

  • 03 : ping blocks to change the ping interval
  • 04 : ambient blocks sets light flashing patterns
  • 09 : reboot block
  • 0A : message blocks contains commands that are separated from each other with newline character

There are eight possible commands in a message block :

  • ID : id of the message
  • CL : color
  • PL : palette
  • CH : choreography
  • MU : sound
  • MC : sound
  • ST : shoutcast streaming
  • MW : wait

Choreographies are files that can be played by calling them from message blocks with CH command.