marxbotsensors.cpp
42 m_marxbotResource = actualResourceNameForMultirobot(ConfigurationHelper::getString(params, prefix + "marxbot", m_marxbotResource));
43 m_neuronsIteratorResource = actualResourceNameForMultirobot(ConfigurationHelper::getString(params, prefix + "neuronsIterator", m_neuronsIteratorResource));
72 d.describeString("marxbot").def("robot").help("The name of the resource associated with the MarXbot robot to use (default is \"robot\")");
73 d.describeString("neuronsIterator").def("neuronsIterator").help("The name of the resource associated with the neural network iterator (default is \"neuronsIterator\")");
89 MarXbotProximityIRSensor::MarXbotProximityIRSensor(ConfigurationParameters& params, QString prefix) :
93 m_activeSensors(ConfigurationHelper::getBoolVector(params, prefix + "activeSensors", "111111111111111111111111")),
97 ConfigurationHelper::throwUserConfigError(prefix + "activeSensors", params.getValue(prefix + "activeSensors"), "The parameter must be a list of exactly 24 elements either equal to 1 or to 0 (do not use any space to separate elements, just put them directly one after the other)");
126 Descriptor d = addTypeDescription(type, "The infrared proximity sensors of the MarXbot robot", "The infrared proximity sensors of the MarXbot robot. These are the very short range IR sensors all around the base");
127 d.describeString("activeSensors").def("111111111111111111111111").help("Which IR sensors of the robot are actually enabled", "This is a string of exactly 24 elements. Each element can be either \"0\" or \"1\" to respectively disable/enable the corresponding proximity IR sensor. The first sensor is the one on the left side of the robot and the others follow counterclockwise (i.e. left, back, right, front)");
141 m_neuronsIterator->setInput(applyNoise(m_robot->proximityIRSensorController()->activation(i), 0.0, 1.0));
152 void MarXbotProximityIRSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
187 MarXbotGroundBottomIRSensor::MarXbotGroundBottomIRSensor(ConfigurationParameters& params, QString prefix) :
219 Descriptor d = addTypeDescription(type, "The infrared ground bottom sensors of the MarXbot robot", "The infrared ground bottom sensors of the MarXbot robot. These are the four ground sensors below the robot battery pack.");
220 d.describeBool("invertActivation").def(false).help("If true inverts the activation of the sensors", "If true the sensor is activated with 0.0 above white and with 1.0 above black, if false the opposite holds. The default value is false");
234 const wVector sensorPosition = m_robot->matrix().transformVector(m_robot->groundBottomIRSensorController()->sensors()[i].getPosition());
251 void MarXbotGroundBottomIRSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
279 MarXbotGroundAroundIRSensor::MarXbotGroundAroundIRSensor(ConfigurationParameters& params, QString prefix) :
309 Descriptor d = addTypeDescription(type, "The infrared ground around sensors of the MarXbot robot", "The infrared ground around sensors of the MarXbot robot. These are the eight ground sensors below the base of the robot (just above the wheels).");
323 const wVector sensorPosition = m_robot->matrix().transformVector(m_robot->groundAroundIRSensorController()->sensors()[i].getPosition());
336 void MarXbotGroundAroundIRSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
364 MarXbotLinearCameraSensor::MarXbotLinearCameraSensor(ConfigurationParameters& params, QString prefix) :
372 m_usedColorChannels((m_useRedChannel ? 1 : 0) + (m_useGreenChannel ? 1 : 0) + (m_useBlueChannel ? 1 : 0)),
380 ConfigurationHelper::throwUserConfigError(prefix + "numReceptors", params.getValue(prefix + "numReceptors"), "The parameter must be an integer greater or equal to 1");
383 ConfigurationHelper::throwUserConfigError(prefix + "aperture", params.getValue(prefix + "aperture"), "The parameter must be a real number between 0 and 360");
415 Descriptor d = addTypeDescription(type, "The linear camera sensor of the MarXbot robot", "This is a 360° linear camera");
416 d.describeInt("numReceptors").def(8).limits(1, MaxInteger).help("The number of receptors of the sensor", "Each receptor returns three values, one for each of the three colors (red, green, blue). This means that the size returned by this sensor is 3 * numReceptors (default is 8)");
417 d.describeBool("useRedChannel").def(true).help("Whether the red component of the perceived objects should be used or not (default true)");
418 d.describeBool("useGreenChannel").def(true).help("Whether the green component of the perceived objects should be used or not (default true)");
419 d.describeBool("useBlueChannel").def(true).help("Whether the blue component of the perceived objects should be used or not (default true)");
420 d.describeReal("aperture").def(360.0f).limits(0.0f, 360.0f).help("The aperture of the camera in degrees", "The real MarXbot has an omnidirectional camera, so you can use here any value up to 360 degrees (default is 360)");
421 d.describeReal("maxDistance").def(+Infinity).limits(0.0f, +Infinity).help("The distance above which objects are not seen by the camera in meters");
460 void MarXbotLinearCameraSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
484 m_camera = new LinearCamera(m_robot, mtr, toRad(m_aperture), m_numReceptors, m_maxDistance, Qt::black);
512 MarXbotLinearCameraSensorNew::MarXbotLinearCameraSensorNew(ConfigurationParameters& params, QString prefix) :
520 m_usedColorChannels((m_useRedChannel ? 1 : 0) + (m_useGreenChannel ? 1 : 0) + (m_useBlueChannel ? 1 : 0)),
532 ConfigurationHelper::throwUserConfigError(prefix + "numReceptors", params.getValue(prefix + "numReceptors"), "The parameter must be an integer greater or equal to 1");
535 ConfigurationHelper::throwUserConfigError(prefix + "aperture", params.getValue(prefix + "aperture"), "The parameter must be a real number between 0 and 360");
539 if (!params.getValue(prefix + "numReceptors").isEmpty() || !params.getValue(prefix + "aperture").isEmpty()) {
540 ConfigurationHelper::throwUserConfigError(prefix + "receptorsRanges", params.getValue(prefix + "receptorsRanges"), "You must not specify the receptorsRanges parameter if either aperture or numReceptors has been specified");
547 ConfigurationHelper::throwUserConfigError(prefix + "receptorsRanges", params.getValue(prefix + "receptorsRanges"), "The receptorsRanges parameter must be a comma separated list of simple intervals");
589 Descriptor d = addTypeDescription(type, "The linear camera sensor of the MarXbot robot (new implementation)", "This is a 360° linear camera");
590 d.describeInt("numReceptors").def(8).limits(1, MaxInteger).help("The number of receptors of the sensor", "Each receptor returns three values, one for each of the three colors (red, green, blue). This means that the size returned by this sensor is 3 * numReceptors (default is 8)");
591 d.describeReal("aperture").def(360.0f).limits(0.0f, 360.0f).help("The aperture of the camera in degrees", "The real MarXbot has an omnidirectional camera, so you can use here any value up to 360 degrees (default is 360)");
592 d.describeReal("maxDistance").def(+Infinity).limits(0.0f, +Infinity).help("The distance above which objects are not seen by the camera in meters");
593 d.describeString("receptorsRanges").def("").help("The range for each receptor", "This parameter is a comma separated list of ranges (in the form [start, end]), each range being the aperture of a single receptor. The number of receptors is equal to the number of ranges. The start and end angles of the range are in degrees. Note that if you specify this parameter you must not specify the aperture neither the numReceptors parameters.");
594 d.describeBool("useRedChannel").def(true).help("Whether the red component of the perceived objects should be used or not (default true)");
595 d.describeBool("useGreenChannel").def(true).help("Whether the green component of the perceived objects should be used or not (default true)");
596 d.describeBool("useBlueChannel").def(true).help("Whether the blue component of the perceived objects should be used or not (default true)");
635 void MarXbotLinearCameraSensorNew::resourceChanged(QString resourceName, ResourceChangeType changeType)
660 m_camera = new LinearCameraNew::LinearCamera(m_robot, mtr, toRad(m_aperture), m_numReceptors, m_maxDistance, Qt::black);
662 m_camera = new LinearCameraNew::LinearCamera(m_robot, mtr, m_receptorsRanges, m_maxDistance, Qt::black);
730 TractionSensorGraphic(WObject *object, const wVector& offset, real radius, real scale = 1.0, real maxLength = 1.0, real minLength = 0.0, QString name = "unamed") :
795 const wVector vectorToDraw = wVector(limitComponent(vector.x, xLimited), limitComponent(vector.y, yLimited), vector.z).scale(m_scale);
800 drawArrow(xComponent, m_radius / 2.0, m_maxTipLength / 2.0, (xLimited ? Qt::red : Qt::cyan), renderer, gw);
801 drawArrow(yComponent, m_radius / 2.0, m_maxTipLength / 2.0, (yLimited ? Qt::red : Qt::cyan), renderer, gw);
823 void drawArrow(wVector vector, real radius, real maxTipLength, QColor col, RenderWObject* renderer, QGLContext* gw)
837 RenderWObjectContainer::drawCylinder(axis, axis.scale(0.5 * bodyLength), bodyLength, radius, color());
847 const wVector tipDisplacement = (bodyLength < 0.0) ? wVector(0.0, 0.0, 0.0) : axis.scale(bodyLength);
959 ConfigurationHelper::throwUserConfigError(prefix + "maxForce", params.getValue(prefix + "maxForce"), "The parameter must be a positive real number");
962 ConfigurationHelper::throwUserConfigError(prefix + "minForce", params.getValue(prefix + "minForce"), "The parameter must be a positive real number");
980 params.createParameter(prefix, "drawSensor", m_drawSensor ? QString("true") : QString("false"));
989 Descriptor d = addTypeDescription(type, "The traction sensors of the MarXbot robot", "The traction sensors of the MarXbot robot. It is placed between the base and the turret. Note that this sensor only works when the robot is in dynamic mode");
990 d.describeReal("maxForce").def(1.0f).limits(0.0f, +Infinity).help("The maximum possible value of the force", "This is the value of the force on one axis over which the corresponding neuron is activated with 1");
991 d.describeReal("minForce").def(0.0f).limits(0.0f, +Infinity).help("The minimum possible value of the force", "This is the value of the force on one axis under which the corresponding neuron is activated with 0");
992 d.describeBool("drawSensor").def(true).help("Whether to draw the sensor", "If true the sensor is graphically represented by an arrow in the direction of the current traction");
1047 void MarXbotTractionSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1066 m_graphics = new TractionSensorGraphic(m_robot, offset, 0.005f, 0.1f / m_maxForce, m_maxForce, m_minForce, "Traction sensor");
1083 MarXbotSampledProximityIRSensor::MarXbotSampledProximityIRSensor(ConfigurationParameters& params, QString prefix) :
1088 m_activeSensors(ConfigurationHelper::getBoolVector(params, prefix + "activeSensors", "111111111111111111111111")),
1096 ConfigurationHelper::throwUserConfigError(prefix + "activeSensors", params.getValue(prefix + "activeSensors"), "The parameter must be a list of exactly 24 elements either equal to 1 or to 0 (do not use any space to separate elements, just put them directly one after the other)");
1099 if ((m_averageNum != 0) && (m_averageNum != 2) && (m_averageNum != 3) && (m_averageNum != 4) && (m_averageNum != 6)) {
1100 ConfigurationHelper::throwUserConfigError(prefix + "averageNum", params.getValue(prefix + "averageNum"), "The parameter can only be 0, 2, 3, 4 or 6");
1105 ConfigurationHelper::throwUserConfigError(prefix + "roundSamples", m_roundSamples.filename(), "The file has samples for the wrong number of sensors, expected 24, got " + QString::number(m_roundSamples.numIR()));
1108 ConfigurationHelper::throwUserConfigError(prefix + "smallSamples", m_smallSamples.filename(), "The file has samples for the wrong number of sensors, expected 24, got " + QString::number(m_smallSamples.numIR()));
1111 ConfigurationHelper::throwUserConfigError(prefix + "wallSamples", m_wallSamples.filename(), "The file has samples for the wrong number of sensors, expected 8, got " + QString::number(m_wallSamples.numIR()));
1147 Descriptor d = addTypeDescription(type, "The sampled proximity infrared sensors of the MarXbot", "This is the sampled version of the proximity infrared sensors of the MarXbot. This sensor only works with objects created using the Arena");
1148 d.describeString("activeSensors").def("111111111111111111111111").help("Which IR sensors of the robot are actually enabled", "This is a string of exactly 24 elements. Each element can be either \"0\" or \"1\" to respectively disable/enable the corresponding proximity IR sensor. The first sensor is the one on the left side of the robot and the others follow counterclockwise (i.e. left, back, right, front)");
1149 d.describeInt("averageNum").def(0).limits(0, 6).help("How many sensors should be averaged", "This can only be 0, 2, 3, 4 or 6. If 2, for each couple of consecutive sensors the average is returned, if 3 for each triplet of consecutive sensors the average is returned and so on. If this is zero, no average is computed and the activeSensors parameter is used. The default value is 0");
1150 d.describeString("roundSamples").def("round.sam").help("The name of the file with samples for big round objects");
1151 d.describeString("smallSamples").def("small.sam").help("The name of the file with samples for small round objects");
1152 d.describeString("wallSamples").def("wall.sam").help("The name of the file with samples for walls");
1169 // Cycling through the list of objects. We first need to get the current position and orientation of the robot
1173 // Computing angle and distance. We don't need to remove the robot to which this sensor belongs because
1179 if (!obj->computeDistanceAndOrientationFromRobot(*(m_arena->getRobotWrapper(m_marxbotResource)), distance, angle)) {
1197 //Logger::warning("The sampled infrared sensor only works with Small Cylinders, Big Cylinders, Walls and other Robots");
1202 for (QVector<real>::iterator it = activations.begin(); it != activations.end(); ++it, ++actIt) {
1240 void MarXbotSampledProximityIRSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1268 m_neuronsIterator->setGraphicProperties(QString("ir%1-%2").arg(i).arg(i + m_averageNum - 1), 0.0, 1.0, Qt::red);
1280 MarXbotAttachmentDeviceSensor::MarXbotAttachmentDeviceSensor(ConfigurationParameters& params, QString prefix) :
1287 m_enableOtherAttached(ConfigurationHelper::getBool(params, prefix + "enableOtherAttached", true)),
1288 m_numInputs((m_enablePosition ? 2 : 0) + (m_enableStatus ? 1 : 0) + (m_enableAttached ? 1 : 0) + (m_enableOtherAttached ? 1 : 0))
1307 params.createParameter(prefix, "enableOtherAttached", (m_enableOtherAttached ? "true" : "false"));
1316 Descriptor d = addTypeDescription(type, "The sensor providing the attachment device proprioception", "This sensor provides information about the current status of the attachment device. It provides several inputs (which can be disabled using parameters). The position of the gripper is provided using two neurons (the sin() and the cos() of the angle) to alleviate the problem of 0° and 360° being the same angle with opposite activations.");
1317 d.describeBool("enablePosition").def(true).help("Whether inputs with the position of the attachment device should be enabled or not (default: true)");
1318 d.describeBool("enableStatus").def(true).help("Whether the input with the status of the attachment device should be enabled or not (default: true)");
1319 d.describeBool("enableAttached").def(true).help("Whether the input telling if this robot is attached to another robot should be enabled or not (default: true)");
1320 d.describeBool("enableOtherAttached").def(true).help("Whether the input telling if another robot is attached to this robot should be enabled or not (default: true)");
1332 const MarXbotAttachmentDeviceMotorController *const ctrl = m_robot->attachmentDeviceController();
1380 void MarXbotAttachmentDeviceSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1453 MarXbotWheelSpeedsSensor::MarXbotWheelSpeedsSensor(ConfigurationParameters& params, QString prefix) :
1460 ConfigurationHelper::throwUserConfigError(prefix + "mode", params.getValue(prefix + "mode"), "The parameter must be one of \"Absolute\" or \"Delta\" (case insensitive)");
1485 Descriptor d = addTypeDescription(type, "The sensor reporting the actual velocity of the wheels of the MarXbot", "This sensor have three modalities, see the mode parameter");
1486 d.describeEnum("mode").def("Absolute").values(QStringList() << "Absolute" << "Delta").help("The modality of the sensor", "The possible modalities are: \"Absolute\" meaning that the senors returns the current velocity of the wheels (scaled between -1 and 1) and \"Delta\", meaning that the sensor returns the absolute value of the difference between the desired velocity and the current velocity. The default value is \"Absolute\"");
1544 void MarXbotWheelSpeedsSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1587 MarXbotLaserFrontDistanceSensor::MarXbotLaserFrontDistanceSensor(ConfigurationParameters& params, QString prefix) :
1602 ConfigurationHelper::throwUserConfigError(prefix + "maxDistance", params.getValue(prefix + "maxDistance"), "The parameter must be a positive real number");
1604 ConfigurationHelper::throwUserConfigError(prefix + "aperture", params.getValue(prefix + "aperture"), "The parameter must be a positive real number smaller than 360");
1624 params.createParameter(prefix, "drawSensors", m_drawSensors ? QString("true") : QString("false"));
1626 params.createParameter(prefix, "drawRaysRange", m_drawRaysRange ? QString("true") : QString("false"));
1635 Descriptor d = addTypeDescription(type, "A frontal distance sensor for long distances", "This is a simple distance sensor in the frontal part of the robot with three rays, at -30��, 0�� and 30�� with respect to the frontal part of the robot. This could be implemented on the real robot using the laser scanner.");
1636 d.describeReal("maxDistance").def(1.0).limits(0.0f, +Infinity).help("The maximum distance of the sensors");
1637 d.describeReal("aperture").def(60.0).limits(0.0f, 360.0f).help("The sensor aperture in degrees");
1639 d.describeBool("drawRays").def(false).help("When drawing the sensor, whether to draw the rays or not");
1640 d.describeBool("drawRaysRange").def(false).help("When drawing the rays, whether to draw the real range or not");
1659 m_neuronsIterator->setInput(applyNoise(1.0 - m_sensorLeft->getRayCastHit().distance, 0.0, 1.0));
1661 m_neuronsIterator->setInput(applyNoise(1.0 - m_sensorCenter->getRayCastHit().distance, 0.0, 1.0));
1663 m_neuronsIterator->setInput(applyNoise(1.0 - m_sensorRight->getRayCastHit().distance, 0.0, 1.0));
1672 void MarXbotLaserFrontDistanceSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1690 centralMtr.w_pos = wVector(0.0, -PhyMarXbot::bodyr, PhyMarXbot::basez + PhyMarXbot::trackradius * 2.0f + PhyMarXbot::treaddepth);
1719 MarXbotLaserOmniDistanceSensor::MarXbotLaserOmniDistanceSensor(ConfigurationParameters& params, QString prefix) :
1737 ConfigurationHelper::throwUserConfigError(prefix + "maxDistance", params.getValue(prefix + "maxDistance"), "The parameter must be a positive real number");
1759 params.createParameter(prefix, "drawSensors", m_drawSensors ? QString("true") : QString("false"));
1761 params.createParameter(prefix, "drawRaysRange", m_drawRaysRange ? QString("true") : QString("false"));
1762 params.createParameter(prefix, "averageSensors", m_avgSensors? QString("true") : QString("false"));
1771 Descriptor d = addTypeDescription(type, "An omnidirection distance sensor for long distances", "This is a simple distance sensor in the frontal and rear part of the robot with six rays, each 60° starting in the frontal part of the robot. This could be implemented on the real robot using the laser scanner.");
1772 d.describeReal("maxDistance").def(1.0).limits(0.0f, +Infinity).help("The maximum distance of the sensors");
1774 d.describeBool("drawRays").def(false).help("When drawing the sensor, whether to draw the rays or not");
1775 d.describeBool("drawRaysRange").def(false).help("When drawing the rays, whether to draw the real range or not");
1811 m_neuronsIterator->setInput(applyNoise(1.0 - m_sensorLeft->getRayCastHit().distance, 0.0, 1.0));
1813 m_neuronsIterator->setInput(applyNoise(1.0 - m_sensorCenter->getRayCastHit().distance, 0.0, 1.0));
1815 m_neuronsIterator->setInput(applyNoise(1.0 - m_sensorRight->getRayCastHit().distance, 0.0, 1.0));
1817 m_neuronsIterator->setInput(applyNoise(1.0 - m_sensorRearLeft->getRayCastHit().distance, 0.0, 1.0));
1819 m_neuronsIterator->setInput(applyNoise(1.0 - m_sensorRear->getRayCastHit().distance, 0.0, 1.0));
1821 m_neuronsIterator->setInput(applyNoise(1.0 - m_sensorRearRight->getRayCastHit().distance, 0.0, 1.0));
1834 void MarXbotLaserOmniDistanceSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1856 centralMtr.w_pos = wVector(0.0, 0.0, PhyMarXbot::basez + PhyMarXbot::trackradius * 2.0f + PhyMarXbot::treaddepth);
1857 m_sensorCenter = new SingleIR(m_robot, centralMtr, PhyMarXbot::bodyr+0.008f, m_maxDistance, 0.0f, 1);
1865 m_sensorRearLeft = new SingleIR(m_robot, mtr, PhyMarXbot::bodyr+0.005f, m_maxDistance, 0.0f, 1);
1873 m_sensorRearRight = new SingleIR(m_robot, mtr, PhyMarXbot::bodyr+0.005f, m_maxDistance, 0.0f, 1);
void usableResources(QStringList resources)
FARSA_UTIL_TEMPLATE real toRad(real x)
FARSA_UTIL_TEMPLATE float linearMap(float x, float min=-10, float max=10, float outMin=-1, float outMax=1)
virtual void setSensorActive(int i, bool active)
double applyNoise(double v, double minValue, double maxValue) const
Adds noise to the value.
Definition: neuroninterfaces.cpp:96
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:213
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:1615
static wMatrix identity()
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:246
MarXbotTractionSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:949
static void drawCylinder(wVector axis, wVector centre, float len, float radius, QColor c=Qt::green)
static void describe(QString type)
Describes all the parameters for this sensor.
Definition: marxbotsensors.cpp:65
wMatrix tm
const RayCastHit & getRayCastHit() const
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:393
const real m_radius
The radius of the arrow. The length depends on the vector intensity.
Definition: marxbotsensors.cpp:899
MarXbotAttachmentDeviceMotorController * attachmentDeviceController()
QString actualResourceNameForMultirobot(QString resourceName) const
Returns the actual resource name to use.
Definition: neuroninterfaces.cpp:185
static wMatrix grammSchmidt(const wVector &dir)
void setUseColorTextureOfOwner(bool b)
static QString getString(ConfigurationParameters ¶ms, QString paramPath, QString def=QString())
void addUsableResource(QString resource)
World * world()
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:1629
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:971
MarXbotLaserFrontDistanceSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:1587
bool otherAttachedToUs() const
void setGraphicalProperties(bool drawSensor, bool drawRay=false, bool drawRealRay=false)
QColor color() const
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:567
static const double Infinity
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:1310
real distance
MarXbotLaserOmniDistanceSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:1719
WObject *const m_object
The object to which this representation is attached.
Definition: marxbotsensors.cpp:893
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:120
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:1826
const WheeledRobot2DWrapper * getRobotWrapper(QString robotName) const
Returns a pointer to the wrapper of a robot given the robot resource name.
Definition: arena.cpp:217
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:1489
QString m_marxbotResource
The name of the resource associated with the MarXbot robot.
Definition: marxbotsensors.h:111
void attachToObject(WObject *object, bool makeOwner=false, const wMatrix &displacement=wMatrix::identity())
virtual bool nextNeuron()=0
Go to the next neuron of the current block.
void setTexture(QString textureName)
virtual bool setCurrentBlock(QString blockName)=0
Set the current blocks of neurons to iterate.
SimulatedIRGroundSensorController * groundBottomIRSensorController()
TractionSensorController * tractionSensorController()
const QVector< SingleIR > & sensors() const
virtual void shareResourcesWith(ResourcesUser *buddy)
MarXbotLinearCameraSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:364
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:1539
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:1751
void setColor(QColor c)
static void describe(QString type)
Describe all the parameter for configuring the Sensor.
Definition: neuroninterfaces.cpp:148
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:1042
void setVector(const wVector vector)
Sets the vector to draw. The vector must be in the object frame of reference.
Definition: marxbotsensors.cpp:766
static wMatrix roll(real ang)
static wMatrix pitch(real ang)
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:600
virtual void resourceChanged(QString name, ResourceChangeType changeType)
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:1667
static void throwUserConfigError(QString paramName, QString paramValue, QString description)
The graphical representation of the MarXbot traction sensor.
Definition: marxbotsensors.cpp:703
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:583
void drawArrow(wVector vector, real radius, real maxTipLength, QColor col, RenderWObject *renderer, QGLContext *gw)
Draws an arrow.
Definition: marxbotsensors.cpp:823
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:630
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:1323
MarXbotProximityIRSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:89
virtual void render(RenderWObject *renderer, QGLContext *gw)
Performs the actual drawing.
Definition: marxbotsensors.cpp:782
const QColor & colorForReceptor(int i) const
Returns the color perceived by the i-th receptor.
Definition: sensors.h:268
const wMatrix & matrix() const
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:147
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:1779
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:1235
void setEnabled(bool b)
const QVector< PhyObject2DWrapper * > & getObjects() const
Returns the list of 2D objects.
Definition: arena.h:136
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:1375
Status getStatus() const
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:455
unsigned int numIR() const
Returns the number of IR sensors as read from the file.
Definition: sensors.h:879
void setEnabled(bool b)
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:1155
void getSpeeds(QVector< double > &speeds) const
void update()
void FARSA_UTIL_TEMPLATE throwUserRuntimeError(QString reason)
void getSpeedLimits(QVector< double > &minSpeeds, QVector< double > &maxSpeeds) const
static void info(QString msg)
MarXbotAttachmentDeviceSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:1280
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:312
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves the parameters of the sensor into the ConfigurationParameters object.
Definition: marxbotsensors.cpp:54
static Mode stringToMode(QString mode)
Converts the given string to a modality.
Definition: marxbotsensors.cpp:1438
MarXbotSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:36
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:130
A class wrapping a PhyObject to add methods suitable for wheeled robots simulations.
Definition: wheeledexperimenthelper.h:51
real limitComponent(real v, bool &limited)
Limits the component to be between m_minLength and m_maxLength.
Definition: marxbotsensors.cpp:876
void resetNeededResourcesCheck()
Resets the check on needed resources so that the next call to checkAllNeededResourcesExist() will per...
Definition: neuroninterfaces.cpp:180
bool startObjectParameters(QString groupPath, QString typeName, ParameterSettable *object)
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:1765
wVector traction() const
void getDesiredSpeeds(QVector< double > &speeds) const
double getPosition() const
const real m_maxTipLength
The maximum length of the tip of the vector.
Definition: marxbotsensors.cpp:928
static Descriptor addTypeDescription(QString type, QString shortHelp, QString longHelp=QString(""))
QString getValue(QString path, bool alsoMatchParents=false) const
unsigned int getActivation(unsigned int i, real dist, real ang) const
Returns the activation of the given sensor at the given distance and angle.
Definition: sensors.cpp:1373
QString m_neuronsIteratorResource
The name of th resource associated with the neural network iterator.
Definition: marxbotsensors.h:117
float real
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:223
RenderWObjectContainer * container()
SimulatedIRProximitySensorController * proximityIRSensorController()
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:425
static wMatrix yaw(real ang)
virtual void setInput(double value)=0
Set the input of the current neuron.
void enableAttachmentDevice(bool enable)
static QString modeToString(Mode mode)
Returns the string representation of the given modality.
Definition: marxbotsensors.cpp:1423
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:983
MarXbotLinearCameraSensorNew(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:512
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:303
static QVector< SimpleInterval > vectorOfSimpleIntervalsFromString(QString s, bool *ok=NULL)
TractionSensorGraphic(WObject *object, const wVector &offset, real radius, real scale=1.0, real maxLength=1.0, real minLength=0.0, QString name="unamed")
Constructor.
Definition: marxbotsensors.cpp:730
MarXbotSampledProximityIRSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:1083
MarXbotWheelSpeedsSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:1453
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:1297
static const int MaxInteger
QString name() const
FARSA_UTIL_TEMPLATE const T min(const T &t1, const U &t2)
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:294
virtual bool computeDistanceAndOrientationFromRobot(const WheeledRobot2DWrapper &robot, double &distance, double &angle) const =0
Computes the distance and orientation of this object respect to the given robot.
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:1479
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) ...
MarXbotGroundBottomIRSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:187
double activation(int i) const
bool attachedToRobot() const
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:1141
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:1643
virtual void resourceChanged(QString resourceName, ResourceChangeType changeType)
The function called when a resource used here is changed.
Definition: marxbotsensors.cpp:76
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:203
const QColor & colorForReceptor(int i) const
Returns the color perceived by the i-th receptor.
Definition: sensors.h:544
void save(ConfigurationParameters ¶ms, QString prefix)
Save the parameters into the ConfigurationParameters.
Definition: neuroninterfaces.cpp:134
void checkAllNeededResourcesExist()
Checks whether all resources we need are existing and throws an exception if they aren't...
Definition: neuroninterfaces.cpp:165
wVector transformVector(const wVector &v) const
virtual void update()
Performs the sensor update. This also modifies the activation of input neurons.
Definition: marxbotsensors.cpp:995
static void describe(QString type)
Generates a description of this class and its parameters.
Definition: marxbotsensors.cpp:409
SimulatedIRGroundSensorController * groundAroundIRSensorController()
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:1469
void createParameter(QString groupPath, QString parameter)
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:1123
const QString & filename() const
Returns the name of the file from which samples are loaded.
Definition: sensors.h:869
void setupColorTexture(QGLContext *, RenderWObject *obj)
virtual void save(ConfigurationParameters ¶ms, QString prefix)
Saves current parameters into the given ConfigurationParameters object.
Definition: marxbotsensors.cpp:106
virtual int size()
Returns the number of neurons required by this sensor.
Definition: marxbotsensors.cpp:331
ResourceChangeType
MarXbotGroundAroundIRSensor(ConfigurationParameters ¶ms, QString prefix)
Constructor.
Definition: marxbotsensors.cpp:279
WheelMotorController * wheelsController()