Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

propertyservice::mobilerobot::MobileRobotServer Class Reference

#include <MobileRobotServer.h>

Inheritance diagram for propertyservice::mobilerobot::MobileRobotServer:

propertyservice::PropertyServer propertyservice::PropertyControl List of all members.

Detailed Description

MobileRobotServer is a property server for mobile robots.

It provides default implementations for the setProperty and getProperty methods and parses property names according to the standard specification for mobile robots.

Global Properties
Property Nameread/
write
data typeExplanation
typerstringThe type of the server. Always "robot" for mobile robots.
namerstringThe name of the robot, i.e. "Pioneer"
versionrstringThe version of the robot server software.
propertiesrList<string>A list of known properties.

Mobile Robot Properties
Property Nameread/
write
data typeExplanation
velocity.translation
.rotation
rw
rw</br>
double
double
The translational and rotational speed of a robot. Translation speed is expressed in m/s, and rotational speed in rad/s. Both velocities can also be set using a object of type RobotVelocity as the property value.
position.relative
.absolute
.reset
w
rw
w
RobotPosition
RobotPosition
The robot's position can be set in either absolute or relative mode. In absolute mode, the coordinates are expressed in meters and the rotation angle in radians. In relative mode, coordinates are treated as differences to the current position. The internal coordinate system can be reset using the position.reset property. Relative position is always (0,0,0).

Sensor Properties
Property Nameread/
write
data typeExplanation
alias.location
.measurement
.count
rw
r
r
SensorLocation
double
int
The location and measurement of a sensor referenced by "alias" can be read, and in some cases the location can also be set. The number of sensors that can be referenced using "alias" can be read using the alias.count property.

Sensors are registed to a MobileRobotServer using an alias, e.g. "sonar", "bumper" etc. If multiple sensors are registered under the same alias, "alias.count" returns the number of registered sensors. Sensor properties can be set and read using a quite flexible notation: "alias[.numbers].property". If the number is omitted, 0 is used as a default. The number tells the server to set or read the numberth sensor. Examples:

 sonar.count
 sonar.0.measurement (same as sonar.location)
 bumper.0.location
 sonar.0-7.measurement
 bumper.0,2,4,6.measurement
 radar.0,2-4,9.location
 


Public Methods

 MobileRobotServer () throw (ORBException&)
 Initialize a mobile robot server with default values.

 MobileRobotServer (CORBA::ORB_ptr orb) throw (ORBException&)
 Initialize a mobile robot server with a previously created orb.

 MobileRobotServer (std::string host, std::string name) throw (ORBException&)
 Initialize a mobile robot server and bind it to a name in a naming service.

virtual ~MobileRobotServer ()
virtual void setProperty (const util::List< std::string > &nameParts, util::Blob< char > value) throw (PropertyException&)
 Default implementation for setProperty as inherited from PropertyServer.

virtual void setProperty (const util::List< std::string > &nameParts, const util::List< Sensor * > &sensors, util::Blob< char > value)
 Set a value in multiple sensors.

virtual util::Blob< char > * getProperty (const util::List< std::string > &nameParts) throw (PropertyException&)
 Default implementation for getProperty as inherited from PropertyServer.

virtual util::Blob< char > * getProperty (const util::List< std::string > &nameParts, const util::List< Sensor * > &sensors)
 Get a value from multiple sensors.

virtual std::string getName () const=0
 Get the name of the robot, e.g.

virtual std::string getVersion () const=0
 Get the version of the software, e.g.

virtual util::List< std::string > getProperties ()
 Get a list of recognized properties.

virtual RobotVelocity getVelocity ()=0
 Get the current velocity of the robot.

virtual void setVelocity (RobotVelocity velocity)=0
 Set the velocity of the robot.

virtual RobotPosition getPosition ()=0
 Get the current position of the robot in world coordinates.

virtual void setAbsolutePosition (RobotPosition position)=0
 Set the target position of the robot in world coordinates.

virtual void setRelativePosition (RobotPosition position)=0
 Set the target position of the robot relative to its current coordinates.

virtual void resetPosition (RobotPosition position)=0
 Reset the robot's internal world coordinates to the given values.

void registerSensor (Sensor *sensor, std::string alias)
 Register a sensor.

void unregisterSensor (Sensor *sensor, std::string alias)
 Unregister a sensor that was previously registered under the indicated alias.


Protected Methods

util::List< int > extractIndices (std::string encoded)
 Convert a notation like '1-3,5,9-11' to a list of integers (1,2,3,4,9,10,11).

util::List< Sensor * > extractSensors (const util::List< std::string > &nameParts, util::List< std::string > &propertyNames) throw (PropertyException&)
 Convert a sensor request to a list of pointers to the requested sensors.


Protected Attributes

util::Hashtable< std::string,
util::List< Sensor * > > 
_tblSensors
 Table of sensors.


Constructor & Destructor Documentation

propertyservice::mobilerobot::MobileRobotServer::MobileRobotServer std::string    host,
std::string    name
throw (ORBException&) [inline]
 

Initialize a mobile robot server and bind it to a name in a naming service.

Parameters:
host  the host name (and port) of the naming service
name  the name of the server at the host


Member Function Documentation

virtual std::string propertyservice::mobilerobot::MobileRobotServer::getName   const [pure virtual]
 

Get the name of the robot, e.g.

"Pioneer".

List< std::string > propertyservice::mobilerobot::MobileRobotServer::getProperties   [virtual]
 

Get a list of recognized properties.

The default implementation returns the standard property names. (Global and for all registered sensors.)

Blob< char > * propertyservice::mobilerobot::MobileRobotServer::getProperty const util::List< std::string > &    nameParts,
const util::List< Sensor * > &    sensors
[virtual]
 

Get a value from multiple sensors.

The default implementation recognizes the properties "location" and "measurement", which are passed to requested sensors.

Parameters:
nameParts  the property value that changes, split into parts using '.' as a separator. If "sonar.0.measurement" is requested, nameParts will contain "measurement"
sensors  the sensors that are affected
Returns:
the property values serialized into a blob

Blob< char > * propertyservice::mobilerobot::MobileRobotServer::getProperty const util::List< std::string > &    nameParts throw (PropertyException&) [virtual]
 

Default implementation for getProperty as inherited from PropertyServer.

This method parses the given property name parts, and recognizes the standard property names. It also passes sensor requests to getProperty(const List<string>&,const List<Sensor*>&). Subclasses may add whatever properties are needed by overriding this method. If the default behaviour is still needed, one may call MobileRobotServer::getProperty from the overridden method.

Parameters:
nameParts  the property name split into parts
Returns:
the serialized property value(s) in a blob

Implements propertyservice::PropertyServer.

virtual std::string propertyservice::mobilerobot::MobileRobotServer::getVersion   const [pure virtual]
 

Get the version of the software, e.g.

"1.2".

void propertyservice::mobilerobot::MobileRobotServer::registerSensor Sensor   sensor,
std::string    alias
 

Register a sensor.

MobileRobotServer automatically parses requests to registered sensors. Example:

 Sonar* sonar = new Sonar;
 server.registerSensor(sonar,"sonar");
 

In this case, sonar's getMeasurement() method is called whenever a client requests a property "sonar".

Parameters:
sensor  the sensor to be registered
alias  an alias for the sensor, e.g. "sonar"

void propertyservice::mobilerobot::MobileRobotServer::setProperty const util::List< std::string > &    nameParts,
const util::List< Sensor * > &    sensors,
util::Blob< char >    value
[virtual]
 

Set a value in multiple sensors.

The default implementation recognizes the property "location", which is passed to requested sensors.

Parameters:
nameParts  the property value that changes, split into parts using '.' as a separator. If "sonar.0.location" is requested, nameParts will contain "location"
sensors  the sensors that are affected
value  the new value for the given property

void propertyservice::mobilerobot::MobileRobotServer::setProperty const util::List< std::string > &    nameParts,
util::Blob< char >    value
throw (PropertyException&) [virtual]
 

Default implementation for setProperty as inherited from PropertyServer.

This method parses the given property name parts, and recognizes the standard property names. It also passes sensor requests to setProperty(const List<string>&,const List<Sensor*>&,Blob<char>). Subclasses may add whatever properties are needed by overriding this method. If the default behaviour is still needed, one may call MobileRobotServer::setProperty from the overridden method.

Parameters:
nameParts  the property name split into parts
value  the new value for the property

Implements propertyservice::PropertyServer.

void propertyservice::mobilerobot::MobileRobotServer::unregisterSensor Sensor   sensor,
std::string    alias
 

Unregister a sensor that was previously registered under the indicated alias.

Parameters:
sensor  the sensor to be unregistered
alias  the alias of the sensor, e.g. "sonar"


Member Data Documentation

util::Hashtable<std::string,util::List<Sensor*> > propertyservice::mobilerobot::MobileRobotServer::_tblSensors [protected]
 

Table of sensors.

Do not modify if you don't know what you are doing.


The documentation for this class was generated from the following files:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.