Interaction Interface for networked robots

Download Report

Transcript Interaction Interface for networked robots

Providing an
’Interaction Interface'
for networked robots
using Squeak
ITB844 Bachelor Project Presentation
by Svein-Magnus Sørensen (n4607048)
Supervised by Joaquin Sitte
Objectives and Goals
Project objectives:




Create a generic robot interaction interface in Squeak, based
on the Java-implementation by Erik Berglund. It should enable
the passing of messages to remote objects and execute them.
Use the Agora Distributed Object-architecture as a basis for
message passing to remote objects over any TCP/IP network.
Install and run the Squeak VM on the Koala PC/104 system.
Using the generic interface, implement and test a specific
controller for the K-Team ’Koala’-robot.
Learning goals:



Learn to use and become familiar with the Squeakenvironment and Smalltalk for application development.
Become familiar with the K-Team ’Koala’-robot and its
extension, the PC/104 architecture running Linux.
Be able to perform and manage a medium sized programming
project for on time delivery.
Smalltalk
What is it?



A programming language and development environment
developed by Alan Kay in the 1960s.
The first pure object oriented environment created.
A very simple but powerful language. Can usually do three times
as much as conventional languages with the same amount of
code, and is grammatically comparable to English.
Squeak
What is it?

A Smalltalk-80 implementation with all source code available for
changing on the fly, where everything is written in Squeak itself,
including the Virtual Machine!
Why Squeak ?








Interactive programming with a late-bound protocol shortens
the Edit-Compile-Test-Debug cycle considerably.
Effective programming in a simple but powerful language that is
fully object oriented.
Highly portable. Ports are available for many different platforms,
and can easily be ported to new platforms when needed.
The Virtual Machine gives completely bit-identical running of
any Squeak applications on any available platform.
It is fast. Comparable in speed to programs written in C.
It is small. The image can be shrunk to just a few hundred
kilobytes which allows it to run on small mobile devices.
Extendable. Supports C primitives to run drivers for almost any
kind of hardware.
It is available for free with a liberal license.
K-Team’s Koala-robot




Is a powerful mid-sized robot designed for real-world applications.
It rides on 6 wheels for indoor all-terrain operation.
Sports 16 infra-red and ambient light sensors arranged around the
robot in all directions.
It is modular, and a range of other sensors and various utilities can
be added to improve its functionality.
Supports serial-communication over a wired or wireless RS232 link
following aschii sequences of the SerCom-protocol.
Extensions to the Koala robot provided by
Smart Devices Laboratory at QUT-FIT:
• A PC/104 computer running Linux
• A optical pan-tilt turret-camera
• Wireless network capabilities
PC/104 Architechture





A IEEE standard for PC compatible embedded systems.
Has a compact form factor and rugged connectors.
Uses a unique self-stacking bus to eliminate the need for
backplanes and card cages.
A relaxed bus drive gives very low power requirements.
PC/104+ incorporates the PCI-bus into the PC/104 form factor.
The Koala-addon PC/104 from K-Team features:
 Pentium MMX 266mhz CPU
 64mb RAM
 Onboard video and Ethernet controllers.
 Ultra Slim 20gb Hard-drive
Agora




A highly modular and easy maintainable system for point-topoint communication between microcomputers.
Inspired by the Transputer, it is an extension of the same ideas
about modular systems for smart appliances.
Provides transparent and dynamic usage of remote objects in a
consistent way over any architecture.
An implementation in Squeak was created last year by Johannes
Jansson at QUT’s Smart Devices Laboratory.
How it all works together
1.
2.
3.
4.
5.
6.
A robot and a client-computer must both be running a Squeak-VM with all
the necessary Robot and Agora classes installed.
An Agora-server must be started in the Squeak-VM on the robot to
accept incoming connections from clients.
The client must instantiate and start a RemoteClient object on the local
Squeak-VM.
The starting client tries to make an Agora-connection to the specified
AgoraServer at the specified or default port (40000).
When a connection is established, the client tries to instantiate a
RobotController on the remote VM through the Agora architecture, and a
local ProxyObject is also created.
Now the client can transparently send messages to, and receive returnvalues from, the ProxyObject like with any other local object, while the
execution of the messages are taking place in the actual RobotController
object on the Robot-Server.
Any control-functions or sensor-values from the robot can now be
accessed directly from the ProxyObject in a uniform manner.
The values can then be processed on the client, lowering the CPU and
memory requirements of the robot itself.
How it all works with the Koala:
Instance of class ”KoalaRemoteClient” on client-computer
Client system
Understands messages from the generic control protocol.
The control message in turn sends the relevant SerCom message.
SerCom
command
SerCom
return value
Connects to
AgoraController
and creates a
local ProxyObject
AgoraORB ”RobotController”
Passes messages transparently through a network
TCP/IP
Network
AgoraController on PC/104
K-Team Koala Robot system
Creates instance of RobotController
Instance of class ”KoalaRobotController”
Koala processor
Connects to the Koala processor through a seriallink and passes SerCom-commands and returnvalues between the Koala and the AgoraController
Understands and
replies to SerCom
commands
The Robot-Server
AgoraController
 The primary component of the server functionality. Controls the networking
functionality of the provided implementation of the Agora architecture.
 When instantiated it uses the AgoraLinkManager to start an Agora-server
listening for TCP connections (default port is 40000).
 Closes the TCP-port and terminates when stopped.
RobotController
 Is an AgoraObject usually instantiated remotely by a connected client.
 Contains the sendCommand interface between the native robot-control
functions (eg. SerCom at the Koala) and Squeak-messages.
KoalaRobotController
 Inherits the RobotControllers functionality of AgoraObjects.
 Implements the sending of SerCom commands over a serial link between
the PC/104 and the Koala-chip through the sendSerComCommand
message, and returns the responses from the Koala-chip.
UML Diagram
Robot-Server package
Object – Basic Squeak Class
AgoraObject – by Johannes Jansson
AgoraController
RobotController
alm, port
Class: new
Class: startUp
Class: shutDown
init
startController
stopController
Class: new
init
startController
stopController
sendCommand: (string) ; boolean
KoalaRobotController
In Squeak all methods
(messages) are public and all
attributes are private.
Method Attributes in this font
Methods in this font
(method attribute) ; return value
serialPort, robotSerial
Class: new
startController
stopController
sendCommand: (string) ; string
sendSerComCommand: (string) ; string
The Robot-Client
RemoteClient
 The primary component of the client functionality.
 When started it uses the AgoraLinkManager to connect to an existing
Agora-server running on a specified address (default port is 40000).
 Instantiates a remote RobotController object on the server.
 Interfaces a series of general commands for robot-control.
 Destroys the RobotController and closes the TCP-port when stopped.
SerComRemoteClient
 Extends the functionality of the RemoteClient, using SerCom specific
control messages to implement many of its methods.
 Understands separate control-messages for the entire SerCom protocol.
 Implements some easy to use commands to control a compatible robot.
KoalaRemoteClient
 Inherits all of the SerCom functionality from SerComRemoteClient.
 Initializes itself with control-values specific for the Koala
UML Diagram
Robot-Client package
Object – Basic Squeak Class
SerComRemoteClient
actualMotorPositions, stepsPrDegree,
stepsPrCentimeter
halt , move: (int) , turn: (int)
moveStraight: (int) ; boolean
moveStraightCM: (int) ; boolean
setSpeedControllerMaxSpeed:andAcceler
ation: (int, int) ; boolean
In addition implements each of the 18
defined commands of the SerComprotocol as separate Squeakmessages.
Also re-implements relevant Controlmessages from class ’RemoteClient’ to
use SerCom for their tasks.
RemoteClient
alm, robot, cr, tolerance,
Class: new
Init , stopClient ,
stop ; boolean
startClientTo: (string)
startClientTo:atPort: (string, int)
getStepperPositions : boolean
setAndWaitForStepperPositionsLeft:
andRight: (int, int) ; boolean
is:differentFrom: (OrderedCollection,
OrderedCollection) ; boolean
setPositionTolerance: (int)
setSpeedControllerMaxSpeed:
andAcceleration: (int, int) ; boolean
turnDegrees: (int) ; boolean
zeroMotorCounter ; boolean
...
And many more for a total of 24 methods.
KoalaRemoteClient
Class: new
Init , startClientTo:atPort: (server, port)
Changes to the Agora-classes
The provided Agora software implementation by Johannes
Jansson did not work as required out of the box, so I had to
make the following changes to the code for it to be useable:
 Modified the AgoraTCPProtocol and AgoraSocket to support
the changed Socket implementation in Squeak 3.6
 Extended the AgoraLinkManager and AgoraTCPProtocol to
allow for connections to custom ports and servers.
 Corrected some small inconsistencies in the code.
Achivements



Created generic RobotServer and RobotClient
interfaces in Squeak, extendable to fit many kinds
of embedded devices and robots.
Made and is testing an implementation of the new
interfaces for a ’Koala’-robot made by K-Team,
extended with an PC/104 system.
Used the ”Agora Distributed Object architecture”
as a base for transparent message passing
between the RobotServer and RobotClient over a
TCP/IP network.
Evaluation






Had some difficulty adapting to the way of doing things in Squeak
when I was used to the language structure of C and Java.
Development and debugging in Squeak was amazingly fast and easy
once I got the hang of how things are done.
Squeak is an excellent environment for embedded systems.
Agora was a perfect base for interacting with robots in real-time.
Due to its development model, Squeak programs can only be
guaranteed to run on the version it was developed on, as the
implementation of base classes can be changed without warning.
The socket primitives has given me troubles during testing.
Ideas for future work
• Create a generic graphical interface for the
RemoteClient in Squeak.
• Develop methods to handle sensor-input and
video feeds at a higher and more intuitive level.
• Use several concurrent remote objects on the
Robot-Server to perform time-critical tasks like
collision detection and autonomous navigation.
More information
Online References:
Squeak Central
Smalltalk: The Pure Object Enviroment
K-Team Corporation
PC/104 Consortium
www.squeak.org
www.smalltalk.org
www.k-team.com
www.pc104.org
Books and papers:
The Agora Software Implementation, Johannes Jansson, 2003
Squeak: Object Oriented Design (...), Mark J. Guzdial, 2000
The End
Any Questions ?