Adding Fields to the Custom Detailed Data Display in MobileEyes

From MobileRobots Research and Academic Customer Support

Jump to: navigation, search

MobileEyes will display a small table of values at the bottom of the map if you turn on View->Details and View->Custom Details.

These values are obtained from a server that has created an ArServerInfoStrings object. ArServerInfoStrings obtains the data from an ArStringInfoGroup object (a pointer to which is available via Aria::getInfoGroup()), typically from the global ArStringInfoGroup maintained by the global static Aria class. For example:

ArServerInfoStrings stringInfoServer(&serverBase);  // serverBase is the ArServerBase object

/* Now create a connection used by stringInfoServer to build its list of data fields as 
   they are later added to the global Aria ArStringInfoGroup: 
 */
Aria::getInfoGroup()->addAddStringCallback(stringInfoServer.getAddStringFunctor());  


ArStringInfoGroup obtains updated data by invoking a functor provided to it when adding a field. Use the ArStringInfo::addStringInt() method to provide a functor that returns an int, which is then converted to a string and placed in the table as an updated field value. Use the other "addString" methods to add functors returning different data types.


/* First create a new functor object that returns an int, which invokes the const 
   method getMotorPacCount() on the ArRobot object "robot":
 */
ArRetFunctor<int> *f = new ArConstRetFunctorC<int, ArRobot>(&robot, &ArRobot::getMotorPacCount)

/* Then add a new field to the global ArStringInfoGroup. 
   It will also be added to ArServerInfoStrings and be provided to clients.
 */
Aria::getInfoGroup()->addStringInt(
     "Motor Packet Count",         // name of the data field
     10,                           // a size (width) hint to use in displaying this data field
     f                             // The functor created above
);


See the API Reference documentation for ArStringInfoGroup and ArServerInfoStrings for details.

For a full example, see the serverDemo ArNetworking example, or any one of the ARNL servers (arnlServer, sonarnlServer or mogsServer).

Personal tools