A class to add output neurons that can be used for custom operations. More...

Inheritance diagram for FakeMotor:

Public Member Functions

 FakeMotor (ConfigurationParameters &params, QString prefix)
 Constructor. More...
 
 ~FakeMotor ()
 Destructor. More...
 
virtual void save (ConfigurationParameters &params, QString prefix)
 Saves the parameters of the FakeMotor into the provided ConfigurationParameters object. More...
 
virtual void shareResourcesWith (ResourcesUser *other)
 The function to share resources. More...
 
virtual int size ()
 Returns the number of outputs. More...
 
virtual void update ()
 Updates the state of the Motor every time step. More...
 
- Public Member Functions inherited from Motor
 Motor (ConfigurationParameters &params, QString prefix)
 Constructor and Configure. More...
 
 ~Motor ()
 Destructor. More...
 
QString name ()
 Return the name of the Sensor. More...
 
void save (ConfigurationParameters &params, QString prefix)
 Save the parameters into the ConfigurationParameters. More...
 
void setName (QString name)
 Use this method for changing the name of the Sensor. More...
 
- Public Member Functions inherited from NoisyDevice
 NoisyDevice (ConfigurationParameters &params, QString prefix)
 Constructor and Configure. More...
 
 ~NoisyDevice ()
 Destructor. More...
 
- Public Member Functions inherited from ParameterSettableInConstructor
 ParameterSettableInConstructor (ConfigurationParameters &, QString)
 
- Public Member Functions inherited from ParameterSettable
void addObserver (RuntimeParameterObserver *obs)
 
getRuntimeParameter (QString paramName)
 
virtual ParameterSettableUIgetUIManager ()
 
virtual void postConfigureInitialization ()
 
void removeObserver (RuntimeParameterObserver *obs)
 
void setRuntimeParameter (QString paramName, T newvalue)
 
QString typeName () const
 
- Public Member Functions inherited from ConcurrentResourcesUser
void addUsableResource (QString resource)
 
void addUsableResources (QStringList resources)
 
void declareResource (QString name, T *resource, QString lockBuddy="")
 
void deleteResource (QString name)
 
T * getResource (QString name, bool *resourceExists=NULL)
 
bool hasResource (QString name) const
 
void removeAllUsableResources ()
 
void removeUsableResource (QString resource)
 
void removeUsableResources (QStringList resources)
 
void usableResources (QStringList resources)
 
bool usedResourcesExist (QStringList *nonExistingResources=NULL) const
 

Static Public Member Functions

static void describe (QString type)
 Describes all the parameter needed to configure this class. More...
 
- Static Public Member Functions inherited from Motor
static void describe (QString type)
 Describe all the parameter for configuring the Motor. More...
 
- Static Public Member Functions inherited from NoisyDevice
static void describe (QString type)
 Describe all the parameter for configuring the Sensor. More...
 
- Static Public Member Functions inherited from ParameterSettable
static void describe (QString type)
 
static QString fullParameterDescriptionPath (QString type, QString param)
 
static QString fullSubgroupDescriptionPath (QString type, QString sub)
 

Protected Member Functions

void resourceChanged (QString resourceName, ResourceChangeType changeType)
 The function called when a resource used here is changed. More...
 
- Protected Member Functions inherited from Motor
QString actualResourceNameForMultirobot (QString resourceName) const
 Returns the actual resource name to use. More...
 
void checkAllNeededResourcesExist ()
 Checks whether all resources we need are existing and throws an exception if they aren't. More...
 
void resetNeededResourcesCheck ()
 Resets the check on needed resources so that the next call to checkAllNeededResourcesExist() will perform the full check and not the quick one. More...
 
- Protected Member Functions inherited from NoisyDevice
double applyNoise (double v, double minValue, double maxValue) const
 Adds noise to the value. More...
 
- Protected Member Functions inherited from ParameterSettable
void notifyChangesToParam (QString paramName)
 
- Protected Member Functions inherited from ConcurrentResourcesUser
T * getResource ()
 
- Protected Member Functions inherited from ResourcesUser
 ResourcesUser (const ResourcesUser &other)
 
virtual void notifyResourceChange (ResourceHandler *resource, ResourceChangeType changeType)=0
 
ResourcesUseroperator= (const ResourcesUser &other)
 

Protected Attributes

ResourceVector< realm_additionalOutputs
 The vector with additional outputs. More...
 
const QString m_additionalOutputsResource
 The name of the resource associated with the vector of additional outputs. More...
 
NeuronsIteratorm_neuronsIterator
 The object to iterate over neurons of the neural network. More...
 
const QString m_neuronsIteratorResource
 The name of th resource associated with the neural network iterator. More...
 
- Protected Attributes inherited from ResourcesUser
ResourceCollectionHolder m_resources
 

Additional Inherited Members

- Public Types inherited from ParameterSettable
enum  Property
 
- Public Types inherited from ResourcesUser
typedef Resource::ResourceChangeType ResourceChangeType
 
- Public Types inherited from Resource
enum  ResourceChangeType
 
- Public Attributes inherited from ParameterSettable
 AllowMultiple
 
 Default
 
 IsList
 
 IsMandatory
 
- Static Public Attributes inherited from ParameterSettable
static const double Infinity
 
static const int MaxInteger
 
static const int MinInteger
 
- Static Protected Member Functions inherited from ParameterSettable
static Descriptor addTypeDescription (QString type, QString shortHelp, QString longHelp=QString(""))
 
static void setGraphicalEditor (QString type)
 

Detailed Description

A class to add output neurons that can be used for custom operations.

This class allows to add a given number of outputs to the controller and then provides a resource to access the value of the new neurons

In addition to all parameters defined by the parent class (Motor), this class also defines the following parameters:

  • additionalOutputs: the number of outputs that will be added to the controller (default 1)
  • neuronsIterator: the name of the resource associated with the neural network iterator (default is "neuronsIterator")
  • additionalOutputsResource: the name of the resource that can be used to access the additional outputs (default is "additionalOutputs")

The resources required by this Motor are:

  • name defined by the neuronsIterator parameter: the object to iterate over outputs of the controller

This motor also defines the following resources:

  • name defined by the additionalOutputsResource parameter: the name of the resource that can be used to access the additional outputs. This can be accessed as a farsa::ResourceVector<real>

Definition at line 60 of file motors.h.

Constructor & Destructor Documentation

FakeMotor ( ConfigurationParameters params,
QString  prefix 
)

Constructor.

Parameters
paramsthe ConfigurationParameters containing the parameters
prefixthe path prefix to the paramters for this Motor

Definition at line 34 of file motors.cpp.

References FakeMotor::m_additionalOutputs, FakeMotor::m_additionalOutputsResource, FakeMotor::m_neuronsIteratorResource, ResourceVector< class >::size(), and ConcurrentResourcesUser::usableResources().

~FakeMotor ( )

Destructor.

Definition at line 48 of file motors.cpp.

References ConcurrentResourcesUser::deleteResource(), and FakeMotor::m_additionalOutputsResource.

Member Function Documentation

void describe ( QString  type)
static

Describes all the parameter needed to configure this class.

Parameters
typea string representation for the name of this type

Definition at line 67 of file motors.cpp.

References ParameterSettable::addTypeDescription(), Motor::describe(), and ParameterSettable::IsMandatory.

void resourceChanged ( QString  resourceName,
ResourceChangeType  changeType 
)
protectedvirtual

The function called when a resource used here is changed.

Parameters
resourceNamethe name of the resource that has changed.
chageTypethe type of change the resource has gone through (whether it was created, modified or deleted)

Reimplemented from ConcurrentResourcesUser.

Definition at line 105 of file motors.cpp.

References Logger::info(), FakeMotor::m_additionalOutputsResource, FakeMotor::m_neuronsIterator, FakeMotor::m_neuronsIteratorResource, Motor::name(), NeuronsIterator::nextNeuron(), Motor::resetNeededResourcesCheck(), NeuronsIterator::setCurrentBlock(), NeuronsIterator::setGraphicProperties(), and FakeMotor::size().

void save ( ConfigurationParameters params,
QString  prefix 
)
virtual

Saves the parameters of the FakeMotor into the provided ConfigurationParameters object.

Parameters
paramsthe ConfigurationParameters where save the parameters
prefixthe path prefix for the parameters to save

Implements ParameterSettable.

Definition at line 58 of file motors.cpp.

References ConfigurationParameters::createParameter(), FakeMotor::m_additionalOutputs, FakeMotor::m_additionalOutputsResource, FakeMotor::m_neuronsIteratorResource, Motor::save(), ResourceVector< class >::size(), and ConfigurationParameters::startObjectParameters().

void shareResourcesWith ( ResourcesUser other)
virtual

The function to share resources.

The calling instance will lose the possibility to access the resources it had before this call

Parameters
otherthe instance with which resources will be shared. If NULL we lose the association with other objects and start with an empty resource set
Note
This is NOT thread safe (both this and the other instance should not be being accessed by other threads)

Reimplemented from ConcurrentResourcesUser.

Definition at line 96 of file motors.cpp.

References ConcurrentResourcesUser::declareResource(), FakeMotor::m_additionalOutputs, FakeMotor::m_additionalOutputsResource, and ConcurrentResourcesUser::shareResourcesWith().

int size ( )
virtual

Returns the number of outputs.

This returns the value set for the paramenter additionalOutputs

Implements Motor.

Definition at line 91 of file motors.cpp.

References FakeMotor::m_additionalOutputs, and ResourceVector< class >::size().

Referenced by FakeMotor::resourceChanged().

Member Data Documentation

ResourceVector<real> m_additionalOutputs
protected

The vector with additional outputs.

Definition at line 130 of file motors.h.

Referenced by FakeMotor::FakeMotor(), FakeMotor::save(), FakeMotor::shareResourcesWith(), FakeMotor::size(), and FakeMotor::update().

const QString m_additionalOutputsResource
protected

The name of the resource associated with the vector of additional outputs.

Definition at line 142 of file motors.h.

Referenced by FakeMotor::FakeMotor(), FakeMotor::resourceChanged(), FakeMotor::save(), FakeMotor::shareResourcesWith(), and FakeMotor::~FakeMotor().

NeuronsIterator* m_neuronsIterator
protected

The object to iterate over neurons of the neural network.

Definition at line 147 of file motors.h.

Referenced by FakeMotor::resourceChanged(), and FakeMotor::update().

const QString m_neuronsIteratorResource
protected

The name of th resource associated with the neural network iterator.

Definition at line 136 of file motors.h.

Referenced by FakeMotor::FakeMotor(), FakeMotor::resourceChanged(), and FakeMotor::save().


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