kheperasensors.cpp
40 m_kheperaResource = actualResourceNameForMultirobot(ConfigurationHelper::getString(params, prefix + "khepera", m_kheperaResource));
41 m_neuronsIteratorResource = actualResourceNameForMultirobot(ConfigurationHelper::getString(params, prefix + "neuronsIterator", m_neuronsIteratorResource));
70 d.describeString("khepera").def("robot").help("the name of the resource associated with the khepera robot to use (default is \"robot\")");
71 d.describeString("neuronsIterator").def("neuronsIterator").help("the name of the resource associated with the neural network iterator (default is \"neuronsIterator\")");
87 KheperaProximityIRSensor::KheperaProximityIRSensor(ConfigurationParameters& params, QString prefix) :
114 Descriptor d = addTypeDescription(type, "The infrared proximity sensors of the Khepera robot", "The infrared proximity sensors of the Khepera II robot. These are the very short range IR sensors all around the base");
127 m_neuronsIterator->setInput(applyNoise(m_robot->proximityIRSensorController()->activation(i), 0.0, 1.0));
136 void KheperaProximityIRSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
162 KheperaSampledProximityIRSensor::KheperaSampledProximityIRSensor(ConfigurationParameters& params, QString prefix) :
167 m_activeSensors(ConfigurationHelper::getBoolVector(params, prefix + "activeSensors", "111111111111111111111111")),
174 ConfigurationHelper::throwUserConfigError(prefix + "activeSensors", params.getValue(prefix + "activeSensors"), "The parameter must be a list of exactly 8 elements either equal to 1 or to 0 (do not use any space to separate elements, just put them directly one after the other)");
179 ConfigurationHelper::throwUserConfigError(prefix + "roundSamples", m_roundSamples.filename(), "The file has samples for the wrong number of sensors, expected 8, got " + QString::number(m_roundSamples.numIR()));
182 ConfigurationHelper::throwUserConfigError(prefix + "smallSamples", m_smallSamples.filename(), "The file has samples for the wrong number of sensors, expected 8, got " + QString::number(m_smallSamples.numIR()));
185 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()));
220 Descriptor d = addTypeDescription(type, "The sampled proximity infrared sensors of the Khepera", "This is the sampled version of the proximity infrared sensors of the Khepera. This sensor only works with objects created using the Arena");
221 d.describeString("activeSensors").def("11111111").help("Which IR sensors of the robot are actually enabled", "This is a string of exactly 8 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)");
222 d.describeString("roundSamples").def("round.sam").help("The name of the file with samples for big round objects");
223 d.describeString("smallSamples").def("small.sam").help("The name of the file with samples for small round objects");
224 d.describeString("wallSamples").def("wall.sam").help("The name of the file with samples for walls");
241 // Cycling through the list of objects. We first need to get the current position and orientation of the robot
245 // Computing angle and distance. We don't need to remove the robot to which this sensor belongs because
251 if (!obj->computeDistanceAndOrientationFromRobot(*(m_arena->getRobotWrapper(m_kheperaResource)), distance, angle)) {
271 //Logger::warning("The sampled infrared sensor only works with Small Cylinders, Big Cylinders, Walls and other Robots");
296 void KheperaSampledProximityIRSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
329 KheperaSampledLightSensor::KheperaSampledLightSensor(ConfigurationParameters& params, QString prefix) :
334 m_activeSensors(ConfigurationHelper::getBoolVector(params, prefix + "activeSensors", "11111111")),
339 ConfigurationHelper::throwUserConfigError(prefix + "activeSensors", params.getValue(prefix + "activeSensors"), "The parameter must be a list of exactly 8 elements either equal to 1 or to 0 (do not use any space to separate elements, just put them directly one after the other)");
344 ConfigurationHelper::throwUserConfigError(prefix + "lightSamples", m_lightSamples.filename(), "The file has samples for the wrong number of sensors, expected 8, got " + QString::number(m_lightSamples.numIR()));
377 Descriptor d = addTypeDescription(type, "The sampled light sensors of the Khepera", "This is the sampled version of the light sensors of the Khepera. This sensor only works with objects created using the Arena");
378 d.describeString("activeSensors").def("11111111").help("Which light sensors of the robot are actually enabled", "This is a string of exactly 8 elements. Each element can be either \"0\" or \"1\" to respectively disable/enable the corresponding light 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)");
379 d.describeString("lightSamples").def("light.sam").help("The name of the file with samples for light sensors");
396 // Cycling through the list of objects. We first need to get the current position and orientation of the robot
410 if (!obj->computeDistanceAndOrientationFromRobot(*(m_arena->getRobotWrapper(m_kheperaResource)), distance, angle)) {
438 void KheperaSampledLightSensor::resourceChanged(QString resourceName, ResourceChangeType changeType)
500 Descriptor d = addTypeDescription(type, "The ground sensor of the khepera robot", "The ground sensors of the khepera robot. It is an infrared sensor that can be mounted on the bottom part of the robot.");
588 KheperaWheelSpeedsSensor::KheperaWheelSpeedsSensor(ConfigurationParameters& params, QString prefix) :
595 ConfigurationHelper::throwUserConfigError(prefix + "mode", params.getValue(prefix + "mode"), "The parameter must be one of \"Absolute\" or \"Delta\" (case insensitive)");
620 Descriptor d = addTypeDescription(type, "The sensor reporting the actual velocity of the wheels of the Khepera", "This sensor have three modalities, see the mode parameter");
621 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\"");