marxbotmotors.cpp
36 m_marxbotResource = actualResourceNameForMultirobot(ConfigurationHelper::getString(params, prefix + "marxbot", m_marxbotResource));
37 m_neuronsIteratorResource = actualResourceNameForMultirobot(ConfigurationHelper::getString(params, prefix + "neuronsIterator", m_neuronsIteratorResource));
66 d.describeString("marxbot").def("robot").help("The name of the resource associated with the MarXbot robot to use (default is \"robot\")");
67 d.describeString("neuronsIterator").def("neuronsIterator").help("The name of the resource associated with the neural network iterator (default is \"neuronsIterator\")");
83 MarXbotWheelVelocityMotor::MarXbotWheelVelocityMotor(ConfigurationParameters& params, QString prefix) :
110 Descriptor d = addTypeDescription(type, "The motor controlling the velocity of the wheels of the MarXbot robot");
128 // Computing desired wheel velocities. When appying noise we don't check boundaries, so robots could go a bit faster than their maximum speed
130 const double v1 = (maxSpeed1 - minSpeed1) * applyNoise(m_neuronsIterator->getOutput(), 0.0, -1.0) + minSpeed1;
132 const double v2 = (maxSpeed2 - minSpeed2) * applyNoise(m_neuronsIterator->getOutput(), 0.0, -1.0) + minSpeed2;
143 void MarXbotWheelVelocityMotor::resourceChanged(QString resourceName, ResourceChangeType changeType)
192 Descriptor d = addTypeDescription(type, "The motor controlling the velocity of the wheels of the MarXbot robot");
213 const double vel = (maxSpeed1 - minSpeed1) * applyNoise(m_neuronsIterator->getOutput(), 0.0, -1.0) + minSpeed1;
217 // the delta parameter determine how sharply the direction change (a delta=2 or 3 would lead to smooter orientation change than delta=1)
240 void MarXbotWheelVelOrient::resourceChanged(QString resourceName, ResourceChangeType changeType)
266 m_onColor(ConfigurationHelper::getString(params, prefix + "onColor", "+00FF00").replace("+", "#")), // We have to do this because # is for comments in .ini files
267 m_offColor(ConfigurationHelper::getString(params, prefix + "offColor", "+0000FF").replace("+", "#")), // We have to do this because # is for comments in .ini files
272 ConfigurationHelper::throwUserConfigError(prefix + "offThreshold", params.getValue(prefix + "offThreshold"), "The offThreshold must be less than the onThreshold");
275 ConfigurationHelper::throwUserConfigError(prefix + "onColor", params.getValue(prefix + "onColor"), "The onColor value is not a valid color");
278 ConfigurationHelper::throwUserConfigError(prefix + "offColor", params.getValue(prefix + "offColor"), "The offColor value is not a valid color");
306 d.describeString("onColor").def("+00FF00").help("The \"on\" color of the robot.", "This is a string. Its format can be: +RGB, +RRGGBB, +RRRGGGBBB, +RRRRGGGGBBBB (each of R, G, and B is a single hex digit) or a name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium (see http://www.w3.org/TR/SVG/types.html#ColorKeywords). The default value is \"+00FF00\"");
307 d.describeString("offColor").def("+0000FF").help("The \"off\" color of the robot.", "This is a string. Its format can be: +RGB, +RRGGBB, +RRRGGGBBB, +RRRRGGGGBBBB (each of R, G, and B is a single hex digit) or a name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium (see http://www.w3.org/TR/SVG/types.html#ColorKeywords). The default value is \"+0000FF\"");
308 d.describeReal("onThreshold").def(0.8f).limits(0.0f, 1.0f).help("The value above which the color is switched to the \"on\" color", "This is the threshold above which the color of the robot is set to the one defined by the onColor parameter. The default value is 0.8");
309 d.describeReal("offThreshold").def(0.2f).limits(0.0f, 1.0f).help("The value below which the color is switched to the \"off\" color", "This is the threshold below which the color of the robot is set to the one defined by the offColor parameter. The default value is 0.2");
360 MarXbotAttachmentDeviceMotor::MarXbotAttachmentDeviceMotor(ConfigurationParameters& params, QString prefix) :
364 m_typeOfClosure(typeOfClosureFromString(ConfigurationHelper::getString(params, prefix + "typeOfClosure", "onlyClose"))),
370 ConfigurationHelper::throwUserConfigError(prefix + "typeOfClosure", params.getValue(prefix + "typeOfClosure"), "The typeOfClosure value is not valid");
373 ConfigurationHelper::throwUserConfigError(prefix + "noMotionRange", params.getValue(prefix + "noMotionRange"), "The noMotionRange value must be between 0.0 and 1.0");
398 Descriptor d = addTypeDescription(type, "The motor controlling the attachment device of the MarXbot");
399 d.describeEnum("typeOfClosure").def("onlyClose").values(QStringList() << "onlyClose" << "onlyHalfClose" << "both").help("How the attachment device is closed", "this parameter controls how the attachement device is closed. Possible values are: \"onlyClose\", \"onlyHalfClose\" and \"both\" (default is \"onlyClose\")");
400 d.describeReal("noMotionRange").def(0.3f).limits(0.0f, 1.0f).help("The dimension of the range corresponding to no movement", "This parameter defines how big is the range of activation which corresponds to no movement of the attachement device. If, for example, the value is 0.4, it means that activations from 0.3 to 0.7 cause no movement of the attachment device (default is 0.3)");
432 MarXbotAttachmentDeviceMotorController::Status status = MarXbotAttachmentDeviceMotorController::Open;
464 void MarXbotAttachmentDeviceMotor::resourceChanged(QString resourceName, ResourceChangeType changeType)
491 MarXbotAttachmentDeviceMotor::TypeOfClosure MarXbotAttachmentDeviceMotor::typeOfClosureFromString(QString value)
506 QString MarXbotAttachmentDeviceMotor::typeOfClosureToString(MarXbotAttachmentDeviceMotor::TypeOfClosure value)
void usableResources(QStringList resources)
MarXbotWheelVelOrient(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotmotors.cpp:165
double applyNoise(double v, double minValue, double maxValue) const
Adds noise to the value.
Definition: neuroninterfaces.cpp:96
double getMaxVelocity() const
MarXbotAttachmentDeviceMotorController * attachmentDeviceController()
static QString getString(ConfigurationParameters ¶ms, QString paramPath, QString def=QString())
void save(ConfigurationParameters ¶ms, QString prefix)
Save the parameters into the ConfigurationParameters.
Definition: neuroninterfaces.cpp:201
MarXbotWheelVelocityMotor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotmotors.cpp:83
MarXbotColorMotor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotmotors.cpp:262
void setDesiredVelocity(double vel)
void setSpeeds(QVector< double > speeds)
static void describe(QString type)
Describes all the parameters for this sensor.
Definition: marxbotmotors.cpp:59
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotmotors.cpp:177
void checkAllNeededResourcesExist()
Checks whether all resources we need are existing and throws an exception if they aren't...
Definition: neuroninterfaces.cpp:231
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotmotors.cpp:287
void resetNeededResourcesCheck()
Resets the check on needed resources so that the next call to checkAllNeededResourcesExist() will per...
Definition: neuroninterfaces.cpp:246
virtual bool nextNeuron()=0
Go to the next neuron of the current block.
virtual bool setCurrentBlock(QString blockName)=0
Set the current blocks of neurons to iterate.
void setColor(QColor c)
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotmotors.cpp:95
virtual int size()
Returns the number of neurons required by this motor.
Definition: marxbotmotors.cpp:332
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves the parameters of the sensor into the ConfigurationParameters object.
Definition: marxbotmotors.cpp:48
virtual void resourceChanged(QString name, ResourceChangeType changeType)
static void throwUserConfigError(QString paramName, QString paramValue, QString description)
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotmotors.cpp:104
void setEnabled(bool b)
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotmotors.cpp:382
void getSpeedLimits(QVector< double > &minSpeeds, QVector< double > &maxSpeeds) const
static void info(QString msg)
virtual int size()
Returns the number of neurons required by this motor.
Definition: marxbotmotors.cpp:459
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotmotors.cpp:186
bool startObjectParameters(QString groupPath, QString typeName, ParameterSettable *object)
virtual int size()
Returns the number of neurons required by this motor.
Definition: marxbotmotors.cpp:138
MarXbotMotor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotmotors.cpp:30
static Descriptor addTypeDescription(QString type, QString shortHelp, QString longHelp=QString(""))
QString getValue(QString path, bool alsoMatchParents=false) const
QString m_marxbotResource
The name of the resource associated with the MarXbot robot.
Definition: marxbotmotors.h:105
QString actualResourceNameForMultirobot(QString resourceName) const
Returns the actual resource name to use.
Definition: neuroninterfaces.cpp:251
void setDesiredStatus(Status status)
MarXbotAttachmentDeviceMotor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotmotors.cpp:360
virtual void resourceChanged(QString resourceName, ResourceChangeType changeType)
The function called when a resource used here is changed.
Definition: marxbotmotors.cpp:70
float real
void enableAttachmentDevice(bool enable)
QString m_neuronsIteratorResource
The name of th resource associated with the neural network iterator.
Definition: marxbotmotors.h:111
virtual void setGraphicProperties(QString label, double minValue, double maxValue, QColor color)=0
Set the graphic properties for the current neuron (in case it will be visualized on a GUI) ...
virtual int size()
Returns the number of neurons required by this motor.
Definition: marxbotmotors.cpp:235
static void describe(QString type)
Describe all the parameter for configuring the Motor.
Definition: neuroninterfaces.cpp:214
void createParameter(QString groupPath, QString parameter)
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotmotors.cpp:300
ResourceChangeType
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotmotors.cpp:393
WheelMotorController * wheelsController()