MIRA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Visualization3DBasic< T > Class Template Referenceabstract

Inherit from this class if you want to implement a simple 3D visualization. More...

#include <visualization/Visualization3DBasic.h>

Inheritance diagram for Visualization3DBasic< T >:
Inheritance graph
[legend]

Public Types

enum  Flags {
  NORMAL = 0x0000, ANONYMOUS = 0x0001, HIDDEN = 0x0002, INVISIBLE_PUBLISHER_SUBSCRIBER = 0x0004,
  INTERNAL = 0x000A, INDEPENDENT_SUBSCRIBER_THREAD = 0x0010, INDEPENDENT_RPC_THREAD = 0x0020, NO_MAIN_THREAD = 0x0040
}
 Flags for creating an authority. More...
 
typedef std::multimap
< std::string, std::string > 
ChannelNameMapping
 
typedef std::map< std::string,
Status
ChannelStatusMap
 
typedef std::map< std::string,
Status
StatusMap
 

Public Member Functions

 Visualization3DBasic (const std::string channelDisplayName="Channel")
 Constructor taking a name of the visualized channel. More...
 
virtual ~Visualization3DBasic ()
 
template<typename Reflector >
void reflect (Reflector &r)
 
virtual void setupScene (IVisualization3DSite *site)
 Must be implemented in derived classes. More...
 
virtual void setupScene (Ogre::SceneManager *mgr, Ogre::SceneNode *node)=0
 Implement this method to setup the scene. More...
 
virtual Ogre::SceneNode * getNode ()
 Must be implemented in derived classes to return the scene node to which this visualization attaches its objects. More...
 
void setEnabled (bool enabled)
 Changes the enabled-state and therefore the visibility of this visualization. More...
 
virtual DataConnection getDataConnection ()
 Returns information about the direct data connection for this visualization. More...
 
virtual void init (IVisualizationSite *site)
 Is called by the visualization view when the visualization is attached. More...
 
virtual IVisualization3DSitegetSite ()
 Returns a pointer to the IVisualization3DSite interface that was set in the init() method. More...
 
virtual void processUpdate (Duration dt)
 Is called regularly by the VisualizationView to update the visualization. More...
 
bool isEnabled () const
 Returns true, if this visualization is enabled and visible. More...
 
const std::string & getName () const
 Returns the associated name of this visualization. More...
 
void setName (const std::string &name)
 Sets the name of this visualization. More...
 
void setupDataConnectionChannel (const std::string &channelID)
 Sets up the data connection channel property (if any) with the specified channel id. More...
 
virtual AuthoritygetAuthority ()
 Return the authority as reference. More...
 
Class const & getClass () const
 call the virtual internalGetClass(). More...
 
void enableSubscriberCallbacks (bool enable)
 Enables/disables subscriptions. More...
 
StatusManagergetStatusManager ()
 
StatusMap getStatusMap () const
 Gets the current status map containing all errors, warnings and bootup messages. More...
 
void setHeartbeatInterval (const Duration &interval)
 Set the watchdog interval. More...
 
Duration getHeartbeatInterval () const
 Return the watchdog interval. More...
 
void heartbeat ()
 When called for the first time heartbeat usage will be enabled. More...
 
bool hasHeartbeatTimeout () const
 Returns true if heartbeat usage is enabled (by first call to heartbeat()) and last heartbeat was more than heartbeat interval time ago. More...
 
void bootup (const std::string &message, const std::string &trText="")
 Signal that the module is booting up. More...
 
void bootupFinished ()
 Signal that the module has finished booting up (There can still be errors but booting up is finished) More...
 
void recoverFinished ()
 Signal that the module has finished recovering (There can still be errors but recovering is finished) More...
 
void recover (const std::string &message, const std::string &trText="")
 Signal that the module is recovering. More...
 
void ok (const std::string &category="")
 Signal that a category contains no more errors. More...
 
bool warning (const std::string &category, const std::string &message, const std::string &trText="")
 Signal a warning in a category. More...
 
bool error (const std::string &category, const std::string &message, const std::string &trText="")
 Signal an error in a category. More...
 
bool setStatus (Status::StatusMode mode, const std::string &category, const std::string &message, const std::string &trText="")
 Set the status of a given category. More...
 
Status::StatusMode getStatus () const
 Get the status mode defined by the status of the watchdog (if used) and the bootup, error and warning methods. More...
 
Session Management and Runtime Control.

These methods allow to change the running state of the Authority.

Moreover, some methods allow to configure the behavior of the Authority and the used threading model.

void checkin (const ResourceName &fullname, AuthorityRuntimePtr runtime=AuthorityRuntimePtr())
 Checks in and therefore makes the authority valid by providing a namespace and a name that are given as fully qualified resource name. More...
 
void checkin (const ResourceName &ns, const std::string &name, AuthorityRuntimePtr runtime=AuthorityRuntimePtr())
 Checks in and therefore makes the authority valid by providing a namespace and a name. More...
 
void checkin (Authority &iParent, const ResourceName &ns, const std::string &name)
 Checks in the authority as sub-authority of parent. More...
 
void checkin (Authority &iParent, const std::string &name)
 Checks in the authority as sub-authority of parent. More...
 
void checkout ()
 Checks out and therefore invalidates the authority. More...
 
bool isValid () const
 Returns true, if this Authority was initialized and is checked in, otherwise false. More...
 
void validate () const
 Check if authority is checked in and therefore valid. More...
 
AuthorityRuntimePtr getRuntime ()
 Returns a shared_ptr to the runtime that this authority uses. More...
 
std::set< Authority * > getChildren ()
 Returns a set with all children / sub-authorities. More...
 
void addImmediateHandler (DiagnosticRunnablePtr runnable)
 Adds a runnable that is invoked immediately. More...
 
template<typename F >
void addImmediateHandlerFunction (F &&fn)
 Adds a handler function that is invoked immediately. More...
 
void addFinalizeHandler (DiagnosticRunnablePtr runnable)
 Adds a runnable that is executed ONCE just before the thread terminates. More...
 
template<typename F >
void addFinalizeHandlerFunction (F &&fn)
 Adds a function that is executed ONCE just before the thread terminates. More...
 
TimerPtr createTimer (Duration period, TimerCallback callback, bool oneshot=false)
 Creates and adds a timer that gets called cyclic in a given period (if oneshot is false) and calls the given callback on every invocation. More...
 
TimerPtr createTimer (Duration period, Duration tolerance, TimerCallback callback, bool oneshot=false)
 Creates and adds a timer that gets called cyclic in a given period (if oneshot is false) and calls the given callback on every invocation. More...
 
template<typename Class >
TimerPtr createTimer (Duration period, void(Class::*f)(const Timer &), Class *obj, bool oneshot=false)
 Provided for convenience. See above createTimer method for more details. More...
 
template<typename Class >
TimerPtr createTimer (Duration period, void(Class::*f)(const Timer &), bool oneshot=false)
 Provided for convenience. See above createTimer method for more details. More...
 
template<typename Class >
TimerPtr createTimer (Duration period, Duration tolerance, void(Class::*f)(const Timer &), Class *obj, bool oneshot=false)
 Provided for convenience. See above createTimer method for more details. More...
 
template<typename Class >
TimerPtr createTimer (Duration period, Duration tolerance, void(Class::*f)(const Timer &), bool oneshot=false)
 Provided for convenience. See above createTimer method for more details. More...
 
TimerPtr createTimer (Time time, TimerCallback callback)
 Creates a timer that calls callback exactly once at the given time. More...
 
template<typename Class >
TimerPtr createTimer (Time time, void(Class::*f)(const Timer &), Class *obj)
 Provided for convenience. See above createTimer method for more details. More...
 
template<typename Class >
TimerPtr createTimer (Time time, void(Class::*f)(const Timer &))
 Provided for convenience. See above createTimer method for more details. More...
 
void removeTimer (TimerPtr timer)
 Removes the given timer (timer callback will not be called again and timer will not be rescheduled). More...
 
virtual void start ()
 Starts/Resumes the main dispatcher thread if it is not yet started since the authority was created and checked in manually. More...
 
virtual void stop ()
 Stops/Pauses the main dispatcher thread. More...
 
bool spin (const Duration &maxWait=Duration::infinity())
 Executes a single step of the main dispatcher of this authority. More...
 
virtual bool hasUnrecoverableFailure () const
 Returns true, if there was a failure while processing the immediate handlers. More...
 
virtual bool isStarted () const
 Returns true, if the authority was started (by calling start()). More...
 
virtual bool isRunning () const
 Return if the authority's main dispatcher is running. More...
 
Channel Communication Access.

The following methods gain access to the channels for communication and allow to control the subscriptions of the Authority

std::string resolveName (const std::string &name) const
 Resolve a given name by taking the namespace of the authority into account. More...
 
std::string resolveServiceName (const std::string &name) const
 Resolves the given name of the service by taking the namespace of the authority into account. More...
 
template<typename T >
Channel< T > publish (const std::string &channelID)
 Publishes a channel with the given id and marks the authority as a publisher of this channel. More...
 
template<typename T >
Channel< T > publish (const std::string &channelID, const Typename &type)
 Same as publish(channelID). More...
 
void unpublish (const std::string &channelID)
 Unpublish a channel with the given channel id. More...
 
template<typename T >
Channel< T > subscribe (const std::string &channelID, const Duration &storageDuration=Duration::seconds(0))
 Subscribes authority to a given channel. More...
 
template<typename T >
Channel< T > subscribe (const std::string &channelID, boost::function< void(ChannelRead< T >)> fn, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Subscribes authority to a given channel and adds callback function fn. More...
 
template<typename T >
Channel< T > subscribe (const std::string &channelID, boost::function< void(ChannelRead< T >)> fn, bool independentThread)
 Provided for convenience. See above subscribe method for more details. More...
 
template<typename T , typename Class >
Channel< T > subscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > subscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, bool independentThread)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > subscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Provided for simplified registration of a member function of a class as callback. More...
 
template<typename T , typename Class >
Channel< T > subscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), bool independentThread)
 Provided for simplified registration of a member function as callback. More...
 
template<typename T >
Channel< T > publishAndSubscribe (const std::string &channelID, const Duration &storageDuration=Duration::seconds(0))
 Publishes a channel with the given id and marks the authority as a publisher of this channel. More...
 
template<typename T >
Channel< T > publishAndSubscribe (const std::string &channelID, boost::function< void(ChannelRead< T >)> fn, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Publishes a channel with the given id and marks the authority as a publisher of this channel. More...
 
template<typename T >
Channel< T > publishAndSubscribe (const std::string &channelID, boost::function< void(ChannelRead< T >)> fn, bool independentThread)
 Provided for convenience. See above publishAndSubscribe method for more details. More...
 
template<typename T , typename Class >
Channel< T > publishAndSubscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > publishAndSubscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, bool independentThread)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > publishAndSubscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Provided for simplified registration of a member function of a class as callback. More...
 
template<typename T , typename Class >
Channel< T > publishAndSubscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), bool independentThread)
 Provided for simplified registration of a member function as callback. More...
 
template<typename T >
Channel< T > subscribeInterval (const std::string &channelID, boost::function< void(ChannelReadInterval< T >)> fn, const Duration &storageDuration, bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 Subscribes authority to a given channel. More...
 
template<typename T , typename Class >
Channel< T > subscribeInterval (const std::string &channelID, void(Class::*f)(ChannelReadInterval< T >), Class *obj, const Duration &storageDuration, bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 
template<typename T , typename Class >
Channel< T > subscribeInterval (const std::string &channelID, void(Class::*f)(ChannelReadInterval< T >), const Duration &storageDuration, bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > subscribeIntervalByElements (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 Provided for simplified registration of a member function taking a simple ChannelRead as parameter. More...
 
template<typename T >
Channel< T > subscribeIntervalByElements (const std::string &channelID, boost::function< void(ChannelRead< T >)>, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 General case accepting boost function instead of member function for subscribing to an interval with only a ChannelRead function given. More...
 
template<typename T , typename Class >
Channel< T > subscribeIntervalByElements (const std::string &channelID, void(Class::*f)(ChannelRead< T >), const Duration &storageDuration=Duration::seconds(0), bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 Simplified notation automatically taking authority object as this argument. More...
 
template<typename T >
ChannelRead< T > waitForData (Channel< T > channel, Duration timeout=Duration::infinity()) const
 Waits until data in the specified channel becomes available. More...
 
template<typename T >
void unsubscribe (const std::string &channelID)
 Unsubscribe from a given channel. More...
 
template<typename T >
Channel< T > getChannel (const std::string &channelID)
 Returns channel object that can be used to obtain read and write access on the channel. More...
 
bool isSubscribedOn (const std::string &channelID) const
 Returns if this authority is subscribed to a channel with the given channel id. More...
 
 MIRA_DEPRECATED ("Please use isSubscribedOn() instead", bool hasSubscribedOn(const std::string &channelID) const)
 
bool hasPublished (const std::string &channelID) const
 Returns if this authority has published a channel with the given channel id. More...
 
bool doesChannelExist (const std::string &channelID) const
 Returns if a channel with the given channel id exists. More...
 
bool waitForChannel (const std::string &channelID, const Duration &timeout=Duration::infinity()) const
 Waits until a channel with the given channel id becomes available. More...
 
Access to Transform Framework.

The following methods allow to use the transformation framework.

bool isTransformAvailable (const std::string &targetID, const std::string &sourceID) const
 Checks if a transform from source frame to target frame is available. More...
 
bool isTransformAvailable (const std::string &targetID, const std::string &sourceID, const std::string &fixedID) const
 Checks if a transform from source frame to target frame via fixed frame is available. More...
 
bool waitForTransform (const std::string &targetID, const std::string &sourceID, Duration timeout=Duration::invalid()) const
 Waits until a transform from source frame to target frame is available. More...
 
bool waitForTransform (const std::string &targetID, const std::string &sourceID, const std::string &fixedID, Duration timeout=Duration::invalid()) const
 Waits until a transform from source frame to target frame via fixed frame is available. More...
 
template<typename Transform , typename Filter >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, boost::function< void(Transform, Time)> fn, Filter &&filter)
 Subscribes to a transformation between the given target and source frame. More...
 
template<typename Transform , typename Filter , typename Class >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, void(Class::*f)(Transform, Time), Class *obj, Filter &&filter)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename Transform , typename Filter , typename Class >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, void(Class::*f)(Transform, Time), Filter &&filter)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename Transform >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, boost::function< void(Transform, Time)> fn)
 Subscribes to a transformation between the given target and source frame. More...
 
template<typename Transform , typename Class >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, void(Class::*f)(Transform, Time), Class *obj)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename Transform , typename Class >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, void(Class::*f)(Transform, Time))
 Provided for simplified registration of a member function as callback function. More...
 
template<typename Transform , typename Filter >
Transform getTransform (const std::string &targetID, const std::string &sourceID, const Time &time, Filter &&filter) const
 Get a transformation from source to target frame at a given time stamp. More...
 
template<typename Transform >
Transform getTransform (const std::string &targetID, const std::string &sourceID, const Time &time=Time()) const
 
template<typename Transform , typename Filter >
Transform getTransform (const std::string &targetID, const Time &targetTime, const std::string &sourceID, const Time &sourceTime, const std::string &fixedID, Filter &&filter) const
 Get a transformation from source to target via fixed frame at the given time stamps. More...
 
template<typename Transform >
Transform getTransform (const std::string &targetID, const Time &targetTime, const std::string &sourceID, const Time &sourceTime, const std::string &fixedID) const
 
template<typename Transform , typename Filter >
Transform getTransform (const TransformDesc &desc, const Time &time, Filter &&filter) const
 Get a transformation at a given time using the prepared transform chain and a given filter. More...
 
template<typename Transform >
Transform getTransform (const TransformDesc &desc, const Time &time=Time()) const
 
template<typename Transform , typename Filter >
Transform getTransform (const TransformDesc &desc, const Time &targetTime, const Time &sourceTime, Filter &&filter) const
 Get a transformation at the given times using the prepared transform chain and a given filter. More...
 
template<typename Transform >
Transform getTransform (const TransformDesc &desc, const Time &targetTime, const Time &sourceTime) const
 
FrameworkTransformerNodegetTransformNode (const std::string &frameID) const
 Get a transformation node for the given frame. More...
 
TransformDesc prepareTransform (const std::string &targetID, const std::string &sourceID) const
 Prepares a transformation chain from a source node to a target node. More...
 
TransformDesc prepareTransform (const std::string &targetID, const std::string &sourceID, const std::string &fixedID) const
 Prepares a transformation chain from a source node to a target node via fixed node. More...
 
template<typename Transform >
void publishTransform (const std::string &frameID, const Transform &transform, const Time &time) const
 Publish a transformation for a given frame. More...
 
template<typename Transform , typename Filter >
void publishTransformIndirect (const std::string &frameID, const std::string &targetID, const std::string &sourceID, const Transform &transform, const Time &time, Filter &&filter) const
 Publish a transformation (frameID) indirect by specifying a direct transform between two nodes (sourceID and targetID). More...
 
template<typename Transform >
void publishTransformIndirect (const std::string &frameID, const std::string &targetID, const std::string &sourceID, const Transform &transform, const Time &time)
 
void addTransformLink (const std::string &childID, const std::string &parentID) const
 Add a transformation link between the given child and parent. More...
 
void addTransformLink (const std::string &childID, const std::string &parentID, FrameworkTransformerNode::Type type) const
 Add a transformation link between the given child and parent, specifying the type of the transformation. More...
 
Remote Procedure Calls.

The following methods allow to register and use remote procedure calls.

template<typename Service >
void publishService (const std::string &name, Service &iService, RPCHandlerPtr handler=RPCHandlerPtr())
 Publish a service to register RPC functions at the RPC manager. More...
 
template<typename Service >
void publishService (Service &iService, RPCHandlerPtr handler=RPCHandlerPtr())
 Publish a service to register RPC functions at the RPC manager. More...
 
void unpublishService ()
 Unpublish this service by unregistering the service with the id of the authority from the RPC manager. More...
 
void unpublishService (const std::string &name)
 Unpublish a service with a given name by unregistering the service with the name from the RPC manager. More...
 
 BOOST_PP_REPEAT (BOOST_PP_INC(RPC_METHODS_MAX_PARAMS), RPCGEN_CALLSERVICE, nil)
 
template<typename R , typename P1 , ... , typename Pn >
RPCFuture< R > callService (const std::string &service, const std::string &method, P1 p1,..., Pn pn) const
 Performs an RPC call. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const json::Value &jsonRequest) const
 Invokes a JSON RPC call. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const std::string &jsonString) const
 Provided for convenience. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const std::string &service, const std::string &method, const json::Value &params=json::Value()) const
 Invokes a JSON RPC call, on the specified service and method with the given params by generating a JSON RPC 2.0 conform json request. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const std::string &service, const std::string &method, const std::string &params) const
 Provided for convenience. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const RPCCallDefinition &rpc) const
 Provided for convenience. More...
 
bool existsService (const std::string &name) const
 Returns true, if a service with the given name exists, otherwise false. More...
 
bool implementsInterface (const std::string &name, const std::string &interface) const
 Returns true, if a service with the given name implements the given interface, otherwise false. More...
 
bool waitForService (const std::string &name, Duration timeout=Duration::invalid()) const
 Waits until a service with the specified name becomes available. More...
 
std::string waitForServiceInterface (const std::string &interface, Duration timeout=Duration::invalid()) const
 Waits until a service with the specified interface becomes available. More...
 
std::list< std::string > queryServicesForInterface (const std::string &interface) const
 Returns a string list with the names of all registered services, that implement the specified interface. More...
 
void registerCallbackForInterface (const std::string &interface, ServiceInterfaceHandler::Callback cb)
 Registers a callback that is called whenever a service registers the given interface, which is specified as first parameter. More...
 
template<typename Class >
void registerCallbackForInterface (const std::string &interface, void(Class::*f)(const std::string &, const std::string &), Class *obj)
 Same as above but providing a function and class pointer instead of a boost function. More...
 
Implementation of AbstractAuthority
virtual StatusManager::StatusMap getStatusMap ()
 Return a status map that contains the status of the authority as well as all registered submodules. More...
 
virtual boost::shared_ptr
< PropertyNode
getProperties ()
 Returns the main property node of this Authority. More...
 
virtual std::set< std::string > getPublishedChannels ()
 Returns all published channels by this authority (and its sub-authorities) More...
 
virtual std::set< std::string > getSubscribedChannels ()
 Returns all subscribed channels by this authority (and its sub-authorities) More...
 
virtual std::set< std::string > getServiceInterfaces ()
 Returns all service interfaces provided by this authority. More...
 
virtual ChannelNameMapping getPublishedChannelNames ()
 Returns all published channels (pair of global and local names) by this authority (and its sub-authorities) More...
 
virtual ChannelNameMapping getSubscribedChannelNames ()
 Returns all subscribed channels (pair of global and local names) by this authority (and its sub-authorities) More...
 
virtual ChannelStatusMap getSubscribedChannelStatus ()
 Returns status for all subscribed channels (ok, no publisher, no data, ...) by this authority (and its sub-authorities) More...
 
Detailed Information Retrieval

These methods allow to obtain detailed information on the Authority.

std::string getNamespace () const
 Return the resolved namespace of the authority. More...
 
std::string getGlobalName () const
 Return the fully qualified global name (includes namespace) This method returns the name without the trailing UUID added if the authority is anonymous. More...
 
std::string getGlobalID () const
 Return the fully qualified global id (includes namespace) More...
 
std::string getID () const
 Return the id of the authority. More...
 
const AuthorityDescriptiongetDescription () const
 Return the description of this authority. More...
 

Static Public Member Functions

static PseudoClass const & CLASS ()
 

Protected Types

enum  OptionalMode { NOT_REQUIRED, REQUIRED }
 
typedef std::map< std::string,
RWAccessFlags
RWAccessMap
 
typedef std::list
< AbstractChannelSubscriberPtr
SubscribePtrList
 

Protected Member Functions

virtual void update (Duration dt)
 This method can be implemented in the derived Visualization classes. More...
 
void dataChangedCallback (ChannelRead< T > data)
 
void channelChangedCallback ()
 
virtual void channelChanged ()
 Overwrite this method to get notified when the connected channel changes. More...
 
virtual void dataChanged (ChannelRead< T > data)
 Overwrite this method to listen on channel callbacks. More...
 
virtual void onDataChanged (ChannelRead< T > data)
 
virtual void onUpdate (Duration dt)
 Provided for backward compatibility. More...
 
template<typename T , typename Reflector >
void channelProperty (Reflector &r, const std::string &name, ChannelProperty< T > &channel, const std::string &comment, OptionalMode optional=REQUIRED)
 Special property-method that should be called within the reflect method to specify a ChannelProperty. More...
 
virtual Class const & internalGetClass () const =0
 
template<typename T >
Channel< T > toProxy (ConcreteChannel< T > *channel)
 
void setChannelReadAccess (const std::string &channelID)
 
void setChannelWriteAccess (const std::string &channelID)
 
void removeChannelReadAccess (const std::string &channelID)
 
void removeChannelWriteAccess (const std::string &channelID)
 
void insertChannelNameMapping (AbstractAuthority::ChannelNameMapping &map, const std::string &local, const std::string &global)
 
void eraseChannelNameMapping (AbstractAuthority::ChannelNameMapping &map, const std::string &local, const std::string &global)
 
void remotePublishService (const std::string &service) const
 
PropertyTree getPropertiesRPC ()
 
void setProperty (const std::string &property, const std::string &value)
 
std::string getProperty (const std::string &property) const
 
void setPropertyJSON (const std::string &property, const json::Value &value)
 
json::Value getPropertyJSON (const std::string &property) const
 

Protected Attributes

ChannelProperty< T > mDataChannel
 
std::string mChannelDisplayName
 
std::string mDataFrameID
 
Time mDataTimestamp
 
Ogre::SceneNode * mNode
 
AuthorityDescription mDescription
 
boost::optional< StatusmBootUpStatus
 
boost::optional< StatusmRecoverStatus
 
Duration mHeartbeatInterval
 
boost::optional< TimemLastHeartbeat
 
StatusMap mStatusMap
 
std::string mName
 

Detailed Description

template<typename T>
class mira::Visualization3DBasic< T >

Inherit from this class if you want to implement a simple 3D visualization.

The template parameter specifies what type of data your class visualizes. The class already creates a scene node for you and updates the transformation of the node according to the frame id of the data. All you need to implement is the setupScene method. For more complex visualizations please use the Visualization3D directly.

Examples:
tutorials/Point3BasicVisualization.C.

Member Typedef Documentation

typedef std::map<std::string, RWAccessFlags> RWAccessMap
protectedinherited
typedef std::list<AbstractChannelSubscriberPtr> SubscribePtrList
protectedinherited
typedef std::multimap<std::string, std::string> ChannelNameMapping
inherited
typedef std::map<std::string, Status> ChannelStatusMap
inherited
typedef std::map<std::string, Status> StatusMap
inherited

Member Enumeration Documentation

enum OptionalMode
protectedinherited
Enumerator
NOT_REQUIRED 
REQUIRED 
enum Flags
inherited

Flags for creating an authority.

Enumerator
NORMAL 

Normally authorities must have a unique name.

ANONYMOUS 

However sometimes more than one instance is created of an authority where the name does not matter and could be generated automatically.

This flag provides automatically id generation based on uuids.

HIDDEN 

For Authorities that are not shown by default to the user.

Will get the MIRA_HIDDEN_AUTHORITY_PREFIX as name prefix.

INVISIBLE_PUBLISHER_SUBSCRIBER 

Authorities with this flag set are invisible subscribers and publishers for channels e.g.

they will not count as official publishers for channels which is used for remote framework connections. When a remote framework connects it will receive a list of all local published channels excluding the ones from invisible publishers.

INTERNAL 

Authorities with this flag set are automatically HIDDEN and are invisible to remote frameworks (internal to the local framework).

INDEPENDENT_SUBSCRIBER_THREAD 

Instructs the authority to use a separate and independent thread for handling subscriber callbacks.

By default the authority uses the same thread for handling

  • subscriber callbacks,
  • RPC calls
  • cyclic processes in order to relieve the user from the need to synchronize his/her threads. You can use a separate subscriber thread if you know that you will block inside of your cyclic process method or your RPC methods but need to react quickly and independently on subscriber callbacks.
INDEPENDENT_RPC_THREAD 

Instructs the authority to use a separate and independent thread for handling RPC requests.

By default the authority uses the same thread for handling

  • subscriber callbacks
  • RPC calls
  • cyclic processes in order to relieve the user from the need to synchronize his/her threads. You can use a separate RPC thread if you know that you will block inside of your subscriber callbacks or your cyclic process method but don't want to affect the RPC calls to your authority.
NO_MAIN_THREAD 

Does not start a thread for processing the main dispatcher, instead the user needs to call the spin() method periodically.

Constructor & Destructor Documentation

Visualization3DBasic ( const std::string  channelDisplayName = "Channel")
inline

Constructor taking a name of the visualized channel.

virtual ~Visualization3DBasic ( )
inlinevirtual

Member Function Documentation

void reflect ( Reflector &  r)
inline
virtual void setupScene ( IVisualization3DSite site)
inlinevirtual

Must be implemented in derived classes.

Is called within the visualization's init() method. You can use this method to create your scene and scene objects. The passed IVisualization3DSite interface is the same that is returned by getSite().

Implements Visualization3D.

virtual void setupScene ( Ogre::SceneManager *  mgr,
Ogre::SceneNode *  node 
)
pure virtual

Implement this method to setup the scene.

The node is already created by this class and is a child node of the root scene node.

virtual Ogre::SceneNode* getNode ( )
inlinevirtual

Must be implemented in derived classes to return the scene node to which this visualization attaches its objects.

Implements Visualization3D.

void setEnabled ( bool  enabled)
inlinevirtual

Changes the enabled-state and therefore the visibility of this visualization.

Derived classes should overwrite this method to hide and show the visualization as desired. When overwriting this method you should always call the method of the base class.

Reimplemented from Visualization.

virtual DataConnection getDataConnection ( )
inlinevirtual

Returns information about the direct data connection for this visualization.

This information is used to support drag'n drop of channels into a visualization window to find the correct visualization for that data. Moreover, it is used in the tape player preview, etc. If your visualization should support these features you must implement this method by returning a valid DataConnection structure. By default an empty DataConnection structure is returned.

Reimplemented from Visualization.

virtual void update ( Duration  dt)
inlineprotectedvirtual

This method can be implemented in the derived Visualization classes.

See processUpdate()

Reimplemented from Visualization.

void dataChangedCallback ( ChannelRead< T >  data)
inlineprotected
void channelChangedCallback ( )
inlineprotected
virtual void channelChanged ( )
inlineprotectedvirtual

Overwrite this method to get notified when the connected channel changes.

virtual void dataChanged ( ChannelRead< T >  data)
inlineprotectedvirtual

Overwrite this method to listen on channel callbacks.

virtual void onDataChanged ( ChannelRead< T >  data)
inlineprotectedvirtual
Deprecated:
. Only for backward compatibility
virtual void init ( IVisualizationSite site)
virtualinherited

Is called by the visualization view when the visualization is attached.

The default implementation stores the pointer to the IVisualization3DSite interface that can be retrieved using the getSite() method for later use. Moreover, it calls the setupScene() method. You should never need to overwrite this method in derived classes. Use the setupScene() method instead. However, if you overwrite this method you SHOULD call this default implementation.

The passed interface must be of the type IVisualization3DSite.

Implements Visualization.

virtual IVisualization3DSite* getSite ( )
virtualinherited

Returns a pointer to the IVisualization3DSite interface that was set in the init() method.

Or returns NULL, if init() was not yet called.

Implements Visualization.

virtual void processUpdate ( Duration  dt)
virtualinherited

Is called regularly by the VisualizationView to update the visualization.

The time span since the last call of update is passed as parameter. It calls update() that can be overwritten in derived classes

bool isEnabled ( ) const
inlineinherited

Returns true, if this visualization is enabled and visible.

const std::string& getName ( void  ) const
inlineinherited

Returns the associated name of this visualization.

void setName ( const std::string &  name)
inlineinherited

Sets the name of this visualization.

virtual void onUpdate ( Duration  dt)
inlineprotectedvirtualinherited

Provided for backward compatibility.

Deprecated:
Please overwrite the update() method instead!
void setupDataConnectionChannel ( const std::string &  channelID)
inlineinherited

Sets up the data connection channel property (if any) with the specified channel id.

The property is added automatically to the channel property update set. Which is used for regular update of the properties. This method is for internal use, and called by VisualizationView upon a drag'n'drop action.

void channelProperty ( Reflector &  r,
const std::string &  name,
ChannelProperty< T > &  channel,
const std::string &  comment,
OptionalMode  optional = REQUIRED 
)
inlineprotectedinherited

Special property-method that should be called within the reflect method to specify a ChannelProperty.

E.g.:

template <typename Reflector>
void reflect(Reflector& r)
{
channelProperty(r, "MyChannel", myChannelProperty, "This is a comment to my channel");
}
virtual Authority& getAuthority ( )
virtualinherited

Return the authority as reference.

Implements IAuthorityProvider.

Class const& getClass ( ) const
inlineinherited

call the virtual internalGetClass().

static PseudoClass const& CLASS ( )
inlinestaticinherited
virtual Class const& internalGetClass ( ) const
protectedpure virtualinherited
void checkin ( const ResourceName fullname,
AuthorityRuntimePtr  runtime = AuthorityRuntimePtr() 
)
inherited

Checks in and therefore makes the authority valid by providing a namespace and a name that are given as fully qualified resource name.

Precondition
The authority must not be checked in.
Postcondition
The authority will be valid and checked in.
Parameters
[in]fullnameThe fully qualified name of the authority, including the namespace.
[in]runtimeThe runtime the authority should use. If not specified the authority will create its own runtime.
Exceptions
XInvalidParameterIf another authority with the same name exists or if the specified namespace/name is invalid.
void checkin ( const ResourceName ns,
const std::string &  name,
AuthorityRuntimePtr  runtime = AuthorityRuntimePtr() 
)
inherited

Checks in and therefore makes the authority valid by providing a namespace and a name.

This is essentially the same as the above method, but allows to specify namespace and name separately.

Precondition
The authority must not be checked in.
Postcondition
The authority will be valid and checked in.
Parameters
[in]nsThe namespace the authority will reside in
[in]nameThe name of the authority
[in]runtimeThe runtime the authority should use. If not specified the authority will create its own runtime.
Exceptions
XInvalidParameterIf another authority with the same name exists or if the specified namespace/name is invalid.
void checkin ( Authority iParent,
const ResourceName ns,
const std::string &  name 
)
inherited

Checks in the authority as sub-authority of parent.

Hence, this authority will share some of the parents settings and runtime threads.

Precondition
The authority must not be checked in.
Postcondition
The authority will be valid and checked in.
Parameters
[in]iParentThe parent authority
[in]nsThe namespace the authority will reside in
[in]nameThe name of the authority
Exceptions
XInvalidParameterIf another authority with the same name exists or if the specified namespace/name is invalid.
void checkin ( Authority iParent,
const std::string &  name 
)
inherited

Checks in the authority as sub-authority of parent.

Hence, this authority will share some of the parents settings (namespace, etc) and runtime threads.

Precondition
The authority must not be checked in.
Postcondition
The authority will be valid and checked in.
Parameters
[in]iParentThe parent authority
[in]nameThe name of the authority
Exceptions
XInvalidParameterIf another authority with the same name exists or if the specified namespace/name is invalid.
void checkout ( )
inherited

Checks out and therefore invalidates the authority.

Precondition
The authority must be checked in and valid
Postcondition
Authority is checked out. Every attempt to use the authority object again will throw an exception.
bool isValid ( ) const
inlineinherited

Returns true, if this Authority was initialized and is checked in, otherwise false.

void validate ( ) const
inlineinherited

Check if authority is checked in and therefore valid.

Exceptions
XInvalidConfigif not checked in
AuthorityRuntimePtr getRuntime ( )
inlineinherited

Returns a shared_ptr to the runtime that this authority uses.

The returned pointer never is nullptr if this Authority was checked in successfully. The returned runtime may be shared between different Authorities.

std::set<Authority*> getChildren ( )
inlineinherited

Returns a set with all children / sub-authorities.

void addImmediateHandler ( DiagnosticRunnablePtr  runnable)
inherited

Adds a runnable that is invoked immediately.

After the handler is processed it will be removed from the list of registered handlers.

Precondition
The authority must be checked in and valid
void addImmediateHandlerFunction ( F &&  fn)
inherited

Adds a handler function that is invoked immediately.

After the handler is processed it will be removed from the list of registered handlers. Creates a Runnable internally.

Precondition
The authority must be checked in and valid
void addFinalizeHandler ( DiagnosticRunnablePtr  runnable)
inherited

Adds a runnable that is executed ONCE just before the thread terminates.

After the handler is processed it will be removed from the list of registered handlers.

Precondition
The authority must be checked in and valid
void addFinalizeHandlerFunction ( F &&  fn)
inherited

Adds a function that is executed ONCE just before the thread terminates.

Creates a Runnable internally. After the handler is processed it will be removed from the list of registered handlers.

Precondition
The authority must be checked in and valid
TimerPtr createTimer ( Duration  period,
TimerCallback  callback,
bool  oneshot = false 
)
inherited

Creates and adds a timer that gets called cyclic in a given period (if oneshot is false) and calls the given callback on every invocation.

Precondition
The authority must be checked in and valid
Parameters
[in]periodPeriod the timer is called in
[in]callbackFunction that gets called every time the timer fires.
[in]oneshotIf true callback is only called once.
Returns
pointer to created timer. Can be used for removeTimer().
TimerPtr createTimer ( Duration  period,
Duration  tolerance,
TimerCallback  callback,
bool  oneshot = false 
)
inherited

Creates and adds a timer that gets called cyclic in a given period (if oneshot is false) and calls the given callback on every invocation.

Additionally a warning is given when the call to the timer exceeds the scheduled invocation time about the specified tolerance.

Precondition
The authority must be checked in and valid
Parameters
[in]periodPeriod the timer is called in
[in]toleranceThe tolerance for exceeding the period.
[in]callbackFunction that gets called every time the timer fires.
[in]oneshotIf true callback is only called once.
Returns
pointer to created timer. Can be used for removeTimer().
TimerPtr createTimer ( Duration  period,
void(Class::*)(const Timer &)  f,
Class obj,
bool  oneshot = false 
)
inherited

Provided for convenience. See above createTimer method for more details.

TimerPtr createTimer ( Duration  period,
void(Class::*)(const Timer &)  f,
bool  oneshot = false 
)
inherited

Provided for convenience. See above createTimer method for more details.

TimerPtr createTimer ( Duration  period,
Duration  tolerance,
void(Class::*)(const Timer &)  f,
Class obj,
bool  oneshot = false 
)
inherited

Provided for convenience. See above createTimer method for more details.

TimerPtr createTimer ( Duration  period,
Duration  tolerance,
void(Class::*)(const Timer &)  f,
bool  oneshot = false 
)
inherited

Provided for convenience. See above createTimer method for more details.

TimerPtr createTimer ( Time  time,
TimerCallback  callback 
)
inherited

Creates a timer that calls callback exactly once at the given time.

Precondition
The authority must be checked in and valid
Parameters
[in]timeTime when the callback should be called.
[in]callbackFunction that gets called at the given time.
Returns
pointer to created timer. Can be used for removeTimer().
TimerPtr createTimer ( Time  time,
void(Class::*)(const Timer &)  f,
Class obj 
)
inherited

Provided for convenience. See above createTimer method for more details.

TimerPtr createTimer ( Time  time,
void(Class::*)(const Timer &)  f 
)
inherited

Provided for convenience. See above createTimer method for more details.

void removeTimer ( TimerPtr  timer)
inherited

Removes the given timer (timer callback will not be called again and timer will not be rescheduled).

Calling start on a removed timer will not start it again.

virtual void start ( )
virtualinherited

Starts/Resumes the main dispatcher thread if it is not yet started since the authority was created and checked in manually.

Starts also dispatcher threads for rpc service calls.

Precondition
The authority must be checked in and valid

Implements AbstractAuthority.

Reimplemented in Unit, MicroUnit, and QtUnit.

virtual void stop ( )
virtualinherited

Stops/Pauses the main dispatcher thread.

To continue call start.

Precondition
The authority must be checked in and valid

Implements AbstractAuthority.

Reimplemented in Unit, and MicroUnit.

bool spin ( const Duration maxWait = Duration::infinity())
inherited

Executes a single step of the main dispatcher of this authority.

If this authority does not own the AuthorityRuntime with the main dispatcher, this method does nothing. The method returns true, if the caller should continue to call spin() periodically. If false is returned, spin() should not be called any longer.

Usually the spin() method waits for events and signals of the dispatcher, you can specify the max. time that is spent in the call using the maxWait parameter. If this parameter is set to 0, spin() will not block at all. If it is set to Duration::infinity (the default), it will wait until the next signal or event or stop request.

virtual bool hasUnrecoverableFailure ( ) const
virtualinherited

Returns true, if there was a failure while processing the immediate handlers.

This is an unrecoverable failure that will disallow the further execution of the authority.

Precondition
The authority must be checked in and valid

Implements AbstractAuthority.

virtual bool isStarted ( ) const
virtualinherited

Returns true, if the authority was started (by calling start()).

It will return false, if the authority was not yet started or is stopped.

Implements AbstractAuthority.

virtual bool isRunning ( ) const
virtualinherited

Return if the authority's main dispatcher is running.

Precondition
The authority must be checked in and valid

Implements AbstractAuthority.

void enableSubscriberCallbacks ( bool  enable)
inherited

Enables/disables subscriptions.

If enabled, subscribed callbacks will be called upon changes in the channels. If false, callbacks will not be called.

std::string resolveName ( const std::string &  name) const
inherited

Resolve a given name by taking the namespace of the authority into account.

Precondition
The authority must be checked in and valid
Parameters
[in]nameto be resolved
Returns
resolved name
std::string resolveServiceName ( const std::string &  name) const
inherited

Resolves the given name of the service by taking the namespace of the authority into account.

This method does essentially the same as resolveName() but takes a possible "#buildin" suffix into account.

Precondition
The authority must be checked in and valid
Parameters
[in]nameto be resolved
Returns
resolved name
Channel<T> publish ( const std::string &  channelID)
inlineinherited

Publishes a channel with the given id and marks the authority as a publisher of this channel.

If the channel does not exist it will be created.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe channel id
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access according to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().
Channel<T> publish ( const std::string &  channelID,
const Typename type 
)
inherited

Same as publish(channelID).

Use this for untyped channels Channel<void> to specify a typename.

void unpublish ( const std::string &  channelID)
inherited

Unpublish a channel with the given channel id.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidConfigif authority is not valid
Parameters
[in]channelIDThe channel id
Channel<T> subscribe ( const std::string &  channelID,
const Duration storageDuration = Duration::seconds(0) 
)
inherited

Subscribes authority to a given channel.

It returns a channel object that the caller can store to poll/read data from the channel. The channel is created if it does not exists.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]storageDurationThe requested duration of how long data is stored in the channel (history). Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the real storage duration D can be computed by D = (maxSlots-1) * T.
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access accordig to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().
Channel<T> subscribe ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  fn,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inherited

Subscribes authority to a given channel and adds callback function fn.

At least one thread is created per authority for the callbacks. If independentThread is false the main thread for this authority is used for the channel callback. If independentThread is true an independent thread for this channel is created for the authority.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]fnThe callback function that is called whenever the data on the channel changes.
[in]storageDurationThe requested duration of how long data is stored in the channel (history). Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the maximum storage duration maxD can be computed by maxD = (maxSlots-1) * T.
[in]independentThreadIf true, an independent thread is created for this channel callback
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access according to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().
Channel<T> subscribe ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  fn,
bool  independentThread 
)
inherited

Provided for convenience. See above subscribe method for more details.

Channel<T> subscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

Channel<T> subscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
bool  independentThread 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

Channel<T> subscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inlineinherited

Provided for simplified registration of a member function of a class as callback.

Example:

class MyClass
{
public:
void initialize()
{
authority.subscribe<int>("MyChannel", &MyClass::myChannelCallback);
}
void myChannelCallback(ChannelRead<int> data);
};
See Also
Authority::subscribe() for details.
Channel<T> subscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
bool  independentThread 
)
inlineinherited

Provided for simplified registration of a member function as callback.

See Also
Authority::subscribe() for details.
Channel<T> publishAndSubscribe ( const std::string &  channelID,
const Duration storageDuration = Duration::seconds(0) 
)
inherited

Publishes a channel with the given id and marks the authority as a publisher of this channel.

Also subscribes authority to the channel. It returns a channel object that the caller can store to poll/read and write data from/to the channel. The channel is created if it does not exists.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]storageDurationThe requested duration of how long data is stored in the channel (history). Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the real storage duration D can be computed by D = (maxSlots-1) * T.
Returns
A Channel object that the caller can store to have fast access to the channel data
Channel<T> publishAndSubscribe ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  fn,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inherited

Publishes a channel with the given id and marks the authority as a publisher of this channel.

Also subscribes authority to the channel and adds callback function fn. At least one thread is created per authority for the callbacks. If independentThread is false the main thread for this authority is used for the channel callback. If independentThread is true an independent thread for this channel is created for the authority.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]fnThe callback function that is called whenever the data on the channel changes.
[in]storageDurationThe requested duration of how long data is stored in the channel (history). Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the maximum storage duration maxD can be computed by maxD = (maxSlots-1) * T.
[in]independentThreadIf true, an independent thread is created for this channel callback
Returns
A Channel object that the caller can store to have fast access to the channel data.
Channel<T> publishAndSubscribe ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  fn,
bool  independentThread 
)
inherited

Provided for convenience. See above publishAndSubscribe method for more details.

Channel<T> publishAndSubscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above publishAndSubscribe methods for more details.

Channel<T> publishAndSubscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
bool  independentThread 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above publishAndSubscribe methods for more details.

Channel<T> publishAndSubscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inlineinherited

Provided for simplified registration of a member function of a class as callback.

Example:

class MyClass
{
public:
void initialize()
{
authority.publishAndSubscribe<int>("MyChannel", &MyClass::myChannelCallback);
}
void myChannelCallback(ChannelRead<int> data);
};
See Also
Authority::publishAndSubscribe() for details.
Channel<T> publishAndSubscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
bool  independentThread 
)
inlineinherited

Provided for simplified registration of a member function as callback.

See Also
Authority::subscribe() for details.
Channel<T> subscribeInterval ( const std::string &  channelID,
boost::function< void(ChannelReadInterval< T >)>  fn,
const Duration storageDuration,
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

Subscribes authority to a given channel.

In contrast to the above subscribe methods this method subscribes a callback that takes a ChannelReadInterval as parameter. Instead of a single value, a whole interval of data is passed. The interval contains all values that were stored within the channel since the last callback. Hence, by using this subscribe mechanism you can make sure, that no data is missed.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]fnThe callback function that is called whenever the data in the interval on the channel changes.
[in]storageDurationThe requested duration of how long data is stored in the channel (history). This parameter is especially important for subscribing to intervals, as it must be larger than the delay that may occur within the callback to make sure that no data is lost. Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the real storage duration D can be computed by D = (maxSlots-1) * T.
[in]independentThreadIf true, an independent thread is created for this channel callback
[in]startAfterIgnore any channel slots at or before this timestamp. If this is before the subscription time, the first callback (triggered by the first subsequent channel update) will collect all past channel slots back to this timestamp.
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access according to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().
Channel<T> subscribeInterval ( const std::string &  channelID,
void(Class::*)(ChannelReadInterval< T >)  f,
Class obj,
const Duration storageDuration,
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited
Channel<T> subscribeInterval ( const std::string &  channelID,
void(Class::*)(ChannelReadInterval< T >)  f,
const Duration storageDuration,
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

Channel<T> subscribeIntervalByElements ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

Provided for simplified registration of a member function taking a simple ChannelRead as parameter.

This is useful especially when trying to get every single value (e.g. message passing), even if processing of a single value takes some longer.

Channel<T> subscribeIntervalByElements ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  ,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

General case accepting boost function instead of member function for subscribing to an interval with only a ChannelRead function given.

Channel<T> subscribeIntervalByElements ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

Simplified notation automatically taking authority object as this argument.

Same as respective subscribeInterval function taking ChannelReadInterval as parameter.

ChannelRead<T> waitForData ( Channel< T >  channel,
Duration  timeout = Duration::infinity() 
) const
inherited

Waits until data in the specified channel becomes available.

If a timeout it specified, the method times out if no data becomes available after the given time.

Precondition
The authority must be checked in and valid
The authority must be subscribed to the given channel
Parameters
[in]channelThe channel we are waiting for
[in]timeoutWait for this duration or forever if Duration::infinity() (default)
Returns
A valid ChannelRead, if data became available, or an invalid ChannelRead, if the method timed out or the thread was interrupted.
void unsubscribe ( const std::string &  channelID)
inherited

Unsubscribe from a given channel.

If subscribed with a callback function this function is no longer called. If independentThread was true when subscribing the independent thread for this channel is stopped.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidConfigif authority is not valid
Parameters
[in]channelIDThe id of the data channel to subscribe to
Note
If subscribed with an independent callback function don't call this method inside the callback function. It will block forever because this method will stop the callback thread.
Channel<T> getChannel ( const std::string &  channelID)
inherited

Returns channel object that can be used to obtain read and write access on the channel.

Precondition
The authority must be checked in and valid
The channel must exist and the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel types do not match.
XAccessViolationif the channel does not exist
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access according to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().
bool isSubscribedOn ( const std::string &  channelID) const
inherited

Returns if this authority is subscribed to a channel with the given channel id.

MIRA_DEPRECATED ( "Please use isSubscribedOn() instead"  ,
bool hasSubscribedOn(const std::string &channelID)  const 
)
inlineinherited
Parameters
const
Deprecated:
Please use isSubscribedOn() instead.
bool hasPublished ( const std::string &  channelID) const
inherited

Returns if this authority has published a channel with the given channel id.

bool doesChannelExist ( const std::string &  channelID) const
inherited

Returns if a channel with the given channel id exists.

bool waitForChannel ( const std::string &  channelID,
const Duration timeout = Duration::infinity() 
) const
inherited

Waits until a channel with the given channel id becomes available.

bool isTransformAvailable ( const std::string &  targetID,
const std::string &  sourceID 
) const
inherited

Checks if a transform from source frame to target frame is available.

This means a path in the transform tree exists from source to target and all nodes on that path contain data.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
Returns
true if transform is available, false otherwise
bool isTransformAvailable ( const std::string &  targetID,
const std::string &  sourceID,
const std::string &  fixedID 
) const
inherited

Checks if a transform from source frame to target frame via fixed frame is available.

This means a path in the transform tree exists from source to target via fixed and all nodes on that path contain data.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target, source or fixed node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fixedIDThe frame id of the fixed node
Returns
true if transform is available, false otherwise
bool waitForTransform ( const std::string &  targetID,
const std::string &  sourceID,
Duration  timeout = Duration::invalid() 
) const
inherited

Waits until a transform from source frame to target frame is available.

This means a path in the transform tree exists from source to target and all nodes on that path contain data.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
timeoutWait for this duration or forever if Duration::infinity() (default)
Returns
true if transform is available, false on timeout
bool waitForTransform ( const std::string &  targetID,
const std::string &  sourceID,
const std::string &  fixedID,
Duration  timeout = Duration::invalid() 
) const
inherited

Waits until a transform from source frame to target frame via fixed frame is available.

This means a path in the transform tree exists from source to target via fixed and all nodes on that path contain data.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target, source or fixed node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fixedIDThe frame id of the fixed node
timeoutWait for this duration or forever if Duration::infinity() (default)
Returns
true if transform is available, false on timeout
void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
boost::function< void(Transform, Time)>  fn,
Filter &&  filter 
)
inherited

Subscribes to a transformation between the given target and source frame.

Usually, the computation of the transformation between the target and source frame depends on multiple frames along the path between the 'target' and 'source' within the transformation tree. The installed callback function will be called whenever one of these frames and hence the transformation between the target and source frame changes. The latest transformation and the corresponding timestamp will be passed as parameter to the callback function. The transformation between target and source frame must exist, otherwise an XTransform exception is thrown. You can use waitForTransform to ensure that the transformation exists.

Precondition
The authority must be checked in and valid.
Exceptions
TransformerBase::XTransformIf the transformation between source and target does not exist.
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fnThe callback that is called when the transformation changes, the new transformation and the corresponding timestamp are passed as parameter.
filterThe filter used to interpolate between the transformations.
void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
void(Class::*)(Transform, Time f,
Class obj,
Filter &&  filter 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
void(Class::*)(Transform, Time f,
Filter &&  filter 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
boost::function< void(Transform, Time)>  fn 
)
inherited

Subscribes to a transformation between the given target and source frame.

Usually, the computation of the transformation between the target and source frame depends on multiple frames along the path between the 'target' and 'source' within the transformation tree. The installed callback function will be called whenever one of these frames and hence the transformation between the target and source frame changes. The latest transformation and the corresponding timestamp will be passed as parameter to the callback function. The transformation between target and source frame must exist, otherwise an XTransform exception is thrown. You can use waitForTransform to ensure that the transformation exists.

Precondition
The authority must be checked in and valid.
Exceptions
TransformerBase::XTransformIf the transformation between source and target does not exist.
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fnThe callback that is called when the transformation changes, the new transformation and the corresponding timestamp are passed as parameter.
void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
void(Class::*)(Transform, Time f,
Class obj 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
void(Class::*)(Transform, Time f 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

Transform getTransform ( const std::string &  targetID,
const std::string &  sourceID,
const Time time,
Filter &&  filter 
) const
inherited

Get a transformation from source to target frame at a given time stamp.

The specified filter is used. If time is "not_a_date_time" e.g. a default constructed Time(), the latest available transform is returned.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
timeThe time of the requested transform
filterThe filter used to interpolate between the transforms
Returns
The requested transformation
Transform getTransform ( const std::string &  targetID,
const std::string &  sourceID,
const Time time = Time() 
) const
inlineinherited
See Also
getTransform(const std::string&, const std::string&, const Time&, Filter&&) Here by default the NearestNeighborInterpolator is used for interpolation between transforms. If time is "not_a_date_time" (the default value), the latest available transform is returned.
Transform getTransform ( const std::string &  targetID,
const Time targetTime,
const std::string &  sourceID,
const Time sourceTime,
const std::string &  fixedID,
Filter &&  filter 
) const
inherited

Get a transformation from source to target via fixed frame at the given time stamps.

The specified filter is used. This method can be used to do time traveling. For example if one wants to know what was the position of the right arm two seconds ago relative to the position the left arm has now:

Time t = Time::now();
getTransform("LeftArmFrame", t,
"RightArmFrame", t-Duration::seconds(2),
"RobotFrame");

The "RobotFrame" is chosen as "fixed frame" since it is fixed over time relative to the arm positions and hence can be used as reference frame.

One can read the parameters of this function like: Give the transform from frame targetID at targetTime to frame sourceID at time sourceTime specifying the frame fixedID that does not change over time

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target, source or fixed node does not exist
Parameters
targetIDThe frame id of the target node
targetTimeThe time of the target transform
sourceIDThe frame id of the source node
sourceTimeThe time of the source transform
fixedIDThe frame id of the fixed node
filterThe filter used to interpolate between the transforms
Returns
The requested transformation
Transform getTransform ( const std::string &  targetID,
const Time targetTime,
const std::string &  sourceID,
const Time sourceTime,
const std::string &  fixedID 
) const
inlineinherited
See Also
getTransform(const std::string& targetID, const Time& targetTime, const std::string& sourceID, const Time& sourceTime, const std::string& fixedID, Filter&&) Here by default the NearestNeighborInterpolator is used for interpolation between transforms.
Transform getTransform ( const TransformDesc desc,
const Time time,
Filter &&  filter 
) const
inherited

Get a transformation at a given time using the prepared transform chain and a given filter.

If time is "not_a_date_time" e.g. a default constructed Time(), the latest available transform is returned.

Parameters
descThe prepared transform chain
timeThe time of the requested transform
filterThe filter used to interpolate between the transforms
Returns
The requested transformation
Transform getTransform ( const TransformDesc desc,
const Time time = Time() 
) const
inlineinherited
See Also
getTransform(const TransformDesc&, const Time&, Filter&&) Here by default the NearestNeighborInterpolator is used for interpolation between transforms. If time is "not_a_date_time" (the default value), the latest available transform is returned.
Transform getTransform ( const TransformDesc desc,
const Time targetTime,
const Time sourceTime,
Filter &&  filter 
) const
inherited

Get a transformation at the given times using the prepared transform chain and a given filter.

This method can be used to do time traveling. Together with prepareTransform(const std::string&, const std::string&, const std::string&) the same functionality can be achieved as by calling getTransform(const std::string&, const Time&, const std::string&, const Time&, const std::string&, Filter&&)

Parameters
descThe prepared transform chain
targetTimeThe time of requested target transform
sourceTimeThe time of requested source transform
filterThe filter used to interpolate between the transforms
Returns
The requested transformation
Transform getTransform ( const TransformDesc desc,
const Time targetTime,
const Time sourceTime 
) const
inlineinherited
See Also
getTransform(const TransformDesc&, const Time&, const Time&, Filter&&); Here by default the NearestNeighborInterpolator is used for interpolation between transforms.
FrameworkTransformerNode* getTransformNode ( const std::string &  frameID) const
inherited

Get a transformation node for the given frame.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif node does not exist
Parameters
frameIDThe frame id of the requested node.
Returns
A pointer to the node
TransformDesc prepareTransform ( const std::string &  targetID,
const std::string &  sourceID 
) const
inherited

Prepares a transformation chain from a source node to a target node.

The chain can later be used to obtain a transform using getTransform(const TransformDesc&, const Time& time, Filter&&); Preparing the transform chain only once can save performance when calculating the transform very often.

Note
It is important that after preparing the transform chain the topology must not change.
Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
Returns
The prepared chain
TransformDesc prepareTransform ( const std::string &  targetID,
const std::string &  sourceID,
const std::string &  fixedID 
) const
inherited

Prepares a transformation chain from a source node to a target node via fixed node.

The chain can later be used to obtain a transform using getTransform(const TransformDesc&, const Time&, const Time&, Filter&&); Together with the above mentioned method the same functionality as calling getTransform(const std::string&, const Time&, const std::string&, const Time&, const std::string&, Filter&&) can be achieved, but preparing the transform chain only once can save performance when calculating the transform very often.

Note
It is important that after preparing the transform chain the topology must not change.
Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fixedIDThe frame id of the fixed node
Returns
The prepared chain
void publishTransform ( const std::string &  frameID,
const Transform &  transform,
const Time time 
) const
inherited

Publish a transformation for a given frame.

Precondition
The authority must be checked in and valid
Parameters
[in]frameIDThe id of the frame
[in]transformEither a 2d or 3d transformation
[in]timeThe time of the transformation
void publishTransformIndirect ( const std::string &  frameID,
const std::string &  targetID,
const std::string &  sourceID,
const Transform &  transform,
const Time time,
Filter &&  filter 
) const
inherited

Publish a transformation (frameID) indirect by specifying a direct transform between two nodes (sourceID and targetID).

These two nodes are connected indirectly over the transformation (frameID) This is, the transformation (frameID) is inferred. In the case you know the direct 'transform' between 'targetID' and 'sourceID' you can use this method to publish the desired transform on the link 'frameID' at the specified 'time' and using the specified 'filter' for interpolation. In the following example there is a indirect link from sourceID to targetID via n1, n2, frameID and n3. The transform between source and target is known. The transform in frameID is inferred and published by calling this method.

n2 -------- n1 --- 'sourceID'
| .
| ??? . 'transform' (known)
| .
v v
'frameID' --- n3 --- 'targetID'
Precondition
The authority must be checked in and valid
Exceptions
XRuntimeif either the frame, target or source frames does not exist
Parameters
[in]frameIDThe id of the frame to publish indirectly
[in]targetIDThe frame id of the target node
[in]sourceIDThe frame id of the source node
[in]transformEither a 2d or 3d transformation
[in]timeThe time of the transformation
[in]filterThe filter used to interpolate between the transforms
void publishTransformIndirect ( const std::string &  frameID,
const std::string &  targetID,
const std::string &  sourceID,
const Transform &  transform,
const Time time 
)
inlineinherited
See Also
publishTransformIndirect(const std::string&, const std::string&, const std::string&, const Transform&, const Time&, Filter&&); Here by default the NearestNeighborInterpolator is used for interpolation between transforms.
void addTransformLink ( const std::string &  childID,
const std::string &  parentID 
) const
inherited

Add a transformation link between the given child and parent.

Creates child and/or parent if not existing.

Precondition
The authority must be checked in and valid
Parameters
[in]childIDThe frame id of the child
[in]parentIDThe frame id of the parent
void addTransformLink ( const std::string &  childID,
const std::string &  parentID,
FrameworkTransformerNode::Type  type 
) const
inherited

Add a transformation link between the given child and parent, specifying the type of the transformation.

Creates child and/or parent if not existing.

Precondition
The authority must be checked in and valid
Parameters
[in]childIDThe frame id of the child
[in]parentIDThe frame id of the parent
[in]typeLink type fixed/moving
void publishService ( const std::string &  name,
Service &  iService,
RPCHandlerPtr  handler = RPCHandlerPtr() 
)
inherited

Publish a service to register RPC functions at the RPC manager.

You can publish more than one service object with the same service name

Parameters
[in]nameThe name under which the service is registered. Please note that the name is resolved depending on the namespace the authority is located in.
[in]iServiceThe service object to register.
[in]handlerThe handler that is used for processing the RPC calls if null internal handler is used (default)
void publishService ( Service &  iService,
RPCHandlerPtr  handler = RPCHandlerPtr() 
)
inherited

Publish a service to register RPC functions at the RPC manager.

As name of the service the id of the authority is used.

Parameters
[in]iServiceThe service object to register.
[in]handlerThe handler that is used for processing the RPC calls if null internal handler is used (default)
void unpublishService ( )
inherited

Unpublish this service by unregistering the service with the id of the authority from the RPC manager.

void unpublishService ( const std::string &  name)
inherited

Unpublish a service with a given name by unregistering the service with the name from the RPC manager.

BOOST_PP_REPEAT ( BOOST_PP_INC(RPC_METHODS_MAX_PARAMS ,
RPCGEN_CALLSERVICE  ,
nil   
)
inherited
RPCFuture<R> callService ( const std::string &  service,
const std::string &  method,
P1  p1,
  ...,
Pn  pn 
) const
inherited

Performs an RPC call.

This method calls the specified RPC method of the specified service. Depending on the called method the parameters of the RPC call need to be specified as additional parameters. The result of the RPC call can be obtained via the RPCFuture that is returned by this method. The RPCFuture acts as a proxy for the result of the asynchronous RPC call. It can be used to block until the RPC call has finished and the result is available.

Parameters
serviceThe name of the service
methodThe method name of the requested call
p1First optional parameter see pn
pnVariable number of optional parameters. The number and type depends on the requested RPC method. Both will be checked by the receiver of the RPC call. If the parameter types do not match to the called RPC method, the server will return an error.
Returns
Returns an RPCFuture object. The type of the RPCFuture depends on the return type of the RPC method. It allows the caller to wait for the RPC call to finish and to retrieve the return value.

When calling this method the return type of the RPC method needs to be specified as template parameter.

Example:

RPCFuture<float> result = callService<float>("myservice", "mymethod", 123, 1.23f);
result.wait(); // wait for the result
float r = result.get(); // get the result value
RPCFuture<JSONRPCResponse> callServiceJSON ( const json::Value jsonRequest) const
inherited

Invokes a JSON RPC call.

jsonCall must follow the JSON RPC 2.0 protocol. It must contain:

  • "jsonrpc" with exactly the value "2.0"
  • "id" an id that can be anything (int, string, null) but should be an unique identifier
  • "method" a service-method combination of the service to call (e.g. "/MyService.myMethod")
  • "params" Optional. Required only for methods with parameters. An array containing the parameters of the method to call (e.g. [1, "Hello World"]).
    {
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "/ns/Service.setInt",
    "params" : [255]
    }
    Calls RPCManager::callJSON(const json::Value& jsonCall) internally.
    Returns
    Returns a future that will enclose the JSON RPC response containing the result of the call.
RPCFuture<JSONRPCResponse> callServiceJSON ( const std::string &  jsonString) const
inherited

Provided for convenience.

See callServiceJSON above. Calls RPCManager::callJSON(const std::string& jsonCall) internally.

Returns
Returns a future that will enclose the JSON RPC response containing the result of the call.
RPCFuture<JSONRPCResponse> callServiceJSON ( const std::string &  service,
const std::string &  method,
const json::Value params = json::Value() 
) const
inherited

Invokes a JSON RPC call, on the specified service and method with the given params by generating a JSON RPC 2.0 conform json request.

Call id will be automatically generated. Calls RPCManager::callJSON(const std::string& service, const std::string& method, const json::Value& params) internally (after resolving the service).

Parameters
[in]serviceThe service to call
[in]methodThe method on the service to call
[in]paramsThe parameters for the method to call (must be a json::Array or json null value (default))
Returns
Returns a future that will enclose the JSON RPC response containing the result of the call.
RPCFuture<JSONRPCResponse> callServiceJSON ( const std::string &  service,
const std::string &  method,
const std::string &  params 
) const
inherited

Provided for convenience.

See callServiceJSON above. Calls RPCManager::callJSON(const std::string& service, const std::string& method, const std::string& params) internally (after resolving the service).

Parameters
[in]serviceThe service to call
[in]methodThe method on the service to call
[in]paramsThe parameters of the method as comma separated strings (JSON, no enclosing [], empty string if no parameters)
Returns
Returns a future that will enclose the JSON RPC response containing the result of the call.
RPCFuture<JSONRPCResponse> callServiceJSON ( const RPCCallDefinition rpc) const
inherited

Provided for convenience.

See callServiceJSON above. Will extract parameters to call callServiceJSON(const std::string& service, const std::string& method, const std::string& params) internally (after resolving the service).

Returns
Returns a future that will enclose the JSON RPC response containing the result of the call.
bool existsService ( const std::string &  name) const
inherited

Returns true, if a service with the given name exists, otherwise false.

bool implementsInterface ( const std::string &  name,
const std::string &  interface 
) const
inherited

Returns true, if a service with the given name implements the given interface, otherwise false.

bool waitForService ( const std::string &  name,
Duration  timeout = Duration::invalid() 
) const
inherited

Waits until a service with the specified name becomes available.

If a timeout is specified, the method times out if no such service becomes available after the given time. Returns true, if the desired services became available, or false, if the method timed out or the thread was interrupted.

std::string waitForServiceInterface ( const std::string &  interface,
Duration  timeout = Duration::invalid() 
) const
inherited

Waits until a service with the specified interface becomes available.

If a timeout is specified, the method times out if no such service becomes available after the given time. Returns the name of the service, if the desired services became available, or an empty string, if the method timed out or the thread was interrupted.

std::list<std::string> queryServicesForInterface ( const std::string &  interface) const
inherited

Returns a string list with the names of all registered services, that implement the specified interface.

void registerCallbackForInterface ( const std::string &  interface,
ServiceInterfaceHandler::Callback  cb 
)
inherited

Registers a callback that is called whenever a service registers the given interface, which is specified as first parameter.

The callback method must take two parameters of the type std::string: method(const std::string& interface, const std::string& service); When the method is called, the name of the interface and the name of the service that is registering is passed. The callback is processed within the main dispatcher thread of the authority.

void registerCallbackForInterface ( const std::string &  interface,
void(Class::*)(const std::string &, const std::string &)  f,
Class obj 
)
inherited

Same as above but providing a function and class pointer instead of a boost function.

Provided for convenience.

StatusManager& getStatusManager ( )
inherited
virtual StatusManager::StatusMap getStatusMap ( )
virtualinherited

Return a status map that contains the status of the authority as well as all registered submodules.

Implements AbstractAuthority.

StatusMap getStatusMap ( ) const
inherited

Gets the current status map containing all errors, warnings and bootup messages.

virtual boost::shared_ptr<PropertyNode> getProperties ( )
virtualinherited

Returns the main property node of this Authority.

Implements AbstractAuthority.

Reimplemented in MicroUnit.

virtual std::set<std::string> getPublishedChannels ( )
virtualinherited

Returns all published channels by this authority (and its sub-authorities)

Implements AbstractAuthority.

virtual std::set<std::string> getSubscribedChannels ( )
virtualinherited

Returns all subscribed channels by this authority (and its sub-authorities)

Implements AbstractAuthority.

virtual std::set<std::string> getServiceInterfaces ( )
virtualinherited

Returns all service interfaces provided by this authority.

Implements AbstractAuthority.

virtual ChannelNameMapping getPublishedChannelNames ( )
virtualinherited

Returns all published channels (pair of global and local names) by this authority (and its sub-authorities)

Implements AbstractAuthority.

virtual ChannelNameMapping getSubscribedChannelNames ( )
virtualinherited

Returns all subscribed channels (pair of global and local names) by this authority (and its sub-authorities)

Implements AbstractAuthority.

virtual ChannelStatusMap getSubscribedChannelStatus ( )
virtualinherited

Returns status for all subscribed channels (ok, no publisher, no data, ...) by this authority (and its sub-authorities)

Implements AbstractAuthority.

Channel<T> toProxy ( ConcreteChannel< T > *  channel)
protectedinherited
void setChannelReadAccess ( const std::string &  channelID)
protectedinherited
void setChannelWriteAccess ( const std::string &  channelID)
protectedinherited
void removeChannelReadAccess ( const std::string &  channelID)
protectedinherited
void removeChannelWriteAccess ( const std::string &  channelID)
protectedinherited
void insertChannelNameMapping ( AbstractAuthority::ChannelNameMapping map,
const std::string &  local,
const std::string &  global 
)
protectedinherited
void eraseChannelNameMapping ( AbstractAuthority::ChannelNameMapping map,
const std::string &  local,
const std::string &  global 
)
protectedinherited
void remotePublishService ( const std::string &  service) const
protectedinherited
PropertyTree getPropertiesRPC ( )
protectedinherited
void setProperty ( const std::string &  property,
const std::string &  value 
)
protectedinherited
std::string getProperty ( const std::string &  property) const
protectedinherited
void setPropertyJSON ( const std::string &  property,
const json::Value value 
)
protectedinherited
json::Value getPropertyJSON ( const std::string &  property) const
protectedinherited
std::string getNamespace ( ) const
inlineinherited

Return the resolved namespace of the authority.

Returns
Namespace
std::string getGlobalName ( ) const
inlineinherited

Return the fully qualified global name (includes namespace) This method returns the name without the trailing UUID added if the authority is anonymous.

Use getGlobalID() to obtain the unique id of the authority.

Returns
Global Name
std::string getGlobalID ( ) const
inlineinherited

Return the fully qualified global id (includes namespace)

Returns
Global ID
std::string getID ( ) const
inlineinherited

Return the id of the authority.

Returns
ID
const AuthorityDescription& getDescription ( ) const
inlineinherited

Return the description of this authority.

void setHeartbeatInterval ( const Duration interval)
inlineinherited

Set the watchdog interval.

Duration getHeartbeatInterval ( ) const
inlineinherited

Return the watchdog interval.

void heartbeat ( )
inlineinherited

When called for the first time heartbeat usage will be enabled.

This resets the watchdog and signal that everything is working. If you call heartbeat in an interval < watchdog interval the status will be OK (if no other error is set) If a module blocks or fails and does not call heartbeat again until the watchdog interval passed the status will be ERROR

bool hasHeartbeatTimeout ( ) const
inlineinherited

Returns true if heartbeat usage is enabled (by first call to heartbeat()) and last heartbeat was more than heartbeat interval time ago.

void bootup ( const std::string &  message,
const std::string &  trText = "" 
)
inherited

Signal that the module is booting up.

Optional a message text and a text used for translation can be specified

void bootupFinished ( )
inherited

Signal that the module has finished booting up (There can still be errors but booting up is finished)

void recoverFinished ( )
inherited

Signal that the module has finished recovering (There can still be errors but recovering is finished)

void recover ( const std::string &  message,
const std::string &  trText = "" 
)
inherited

Signal that the module is recovering.

Optional a message text and a text used for translation can be specified

void ok ( const std::string &  category = "")
inherited

Signal that a category contains no more errors.

If no category is set all categories are cleared (except boot up).

bool warning ( const std::string &  category,
const std::string &  message,
const std::string &  trText = "" 
)
inherited

Signal a warning in a category.

A message and an optional text for translation can be given. Additionally, the message is written to the error log.

Returns
true if warning was set, false if a warning with same text was already set
bool error ( const std::string &  category,
const std::string &  message,
const std::string &  trText = "" 
)
inherited

Signal an error in a category.

A message and an optional text for translation can be given. Additionally, the error message is written to the error log.

Returns
true if error was set, false if a error with same text was already set
bool setStatus ( Status::StatusMode  mode,
const std::string &  category,
const std::string &  message,
const std::string &  trText = "" 
)
inherited

Set the status of a given category.

This method can be used to set the warning or error status of the specified category. a message and an optional text for translation can be given. This method essentially does the same as the above warning() and error() methods. In contrast to those two methods, this method does NOT write the error message to the error/warning log. Hence, it can be used to set the error and warning status silently. In all other cases the warning() and error() methods should be used, which are more convenient.

Returns
true if error was set, false if a error with same text was already set
Status::StatusMode getStatus ( ) const
inherited

Get the status mode defined by the status of the watchdog (if used) and the bootup, error and warning methods.

If the watchdog is used (watchdog is enabled when calling heartbeat() for the first time) this method tests if the latest reset of the watchdog was inside the specified watchdog interval. If not it will return ERROR.

Member Data Documentation

ChannelProperty<T> mDataChannel
protected
std::string mChannelDisplayName
protected
std::string mDataFrameID
protected
Time mDataTimestamp
protected
Ogre::SceneNode* mNode
protected
AuthorityDescription mDescription
protectedinherited
boost::optional<Status> mBootUpStatus
protectedinherited
boost::optional<Status> mRecoverStatus
protectedinherited
Duration mHeartbeatInterval
protectedinherited
boost::optional<Time> mLastHeartbeat
protectedinherited
StatusMap mStatusMap
protectedinherited
std::string mName
protectedinherited

The documentation for this class was generated from the following file: