To start, the robot listens on
a TCP/IP port (see sample server code), awaiting a connection
from Brainhat. At some point, Brainhat will make a connection
and (perhaps) delegate commands to the robot. When a command
comes into the robot, it will look something like this:
This could be the equivalent
of a robot command: "put the red ball in the bin."
The tag value is a
unique identifier that the robot and Brainhat share to track
the state of a delegated command. We will see how it used,
The command is a
primitive action that the robot will understand. Examples
might be get, put or position. The
vocabulary of verbs that the robot might use is virtually
unlimited, and you may extend it as you like. External action
verbs for robot (and other) commands are identified in the
data files as children of a special concept called extaction,
label to get
verbs are organized the same as others, with an infinitive
form and subordinate forms connected as children. They may be
used for non-robot commands, just as any other verb.
is the object the robot is manipulating.
when present, will be the object of the preposition for
commands that specify a source or destination for an action.
Likewise, orientation will be the preposition for those
commands that specify a source or destination.
The sample above shows
"color=red" as one of the elements of the command to
the robot. "Color" is not a primitive for robot
commands. Rather, "color" just happens to be
non-prepositional attribute associated with the object in the
example (the ball). Any other attribute might have been
included as well. If the ball was big, for example, a
attribute/value pair like "size=big" might have been
part of the command. Accordingly, the number and variety of
attribute/value pairs is unlimited.
How you dispatch commands
within the robot depends the robot or service you have
created. When the command is completed, the robot should
inform Brainhat so that Brainhat can direct the robot to the
next task and/or tell the speaker that the command is
finished. Here's what you need to do: If the command completes
successfully, the robot may simply send Brainhat an
acknowledgement. The syntax for the successful completion is:
represents the tag number taken from the command as delegated
to the robot by Brainhat. The "Y" stands for
"yes" (meaning completion was successful). To finish
our example above, for instance, the robot would send Brainhat
Upon receipt of the message,
Brainhat would tell the speaker "the robot did put the
ball in the bin." You may also change the "Y"
to an "N" to signify failure:
Brainhat will inform the
speaker "the robot did not put the ball in the bin"
and perform any follow-on action associated with the failure.
You may tack on a reason as well, if you like:
4839:N:the ball is lost
Brainhat will report
"the robot did not put the ball in the bin because the
ball is lost."
Messages from the robot do
not have to be associated with commands. At any time you can
send Brainhat a message without a tag, such as
the water is cold
Brainhat will voice the
message and incorporate it into the conversation just as if it
had come from the user.
Note that the messages to
Brainhat can come asynchronously, while Brainhat is busy doing
other things; no sequencing is necessary. Likewise, you may
issue many messages to Brainhat. They will be processed as