icubmotors.cpp
42 icubResource = actualResourceNameForMultirobot(ConfigurationHelper::getString(params, prefix + "icub", icubResource));
43 neuronsIteratorResource = actualResourceNameForMultirobot(ConfigurationHelper::getString(params, prefix + "neuronsIterator", neuronsIteratorResource));
72 d.describeString("icub").def("robot").help("the name of the resource associated with the iCub 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\")");
110 Descriptor d = addTypeDescription( type, "An example of Motor implementation that randomly set a position of the arm using configurePosture" );
111 d.describeEnum( "arm" ).def( "right" ).values( QStringList()<<"right"<<"left" ).props( IsMandatory ).help( "The arm to move" );
183 iCubArmPosToPostureMotor::iCubArmPosToPostureMotor( ConfigurationParameters& params, QString prefix ) :
206 Descriptor d = addTypeDescription( type, "Move the arm in the position using the configurePosture method. The movement of this motor is instantaneuos, it only require one step. And hence, any physics is ignored. Use this motor only in kinematic mode of the iCub." );
207 d.describeEnum( "arm" ).def( "right" ).values( QStringList()<<"right"<<"left" ).props( IsMandatory ).help( "The arm to move" );
208 d.describeBool( "full" ).def( "true" ).help( "If full is false only the first 4 DoF will be moved; if full is true all 7 DoF of the arm (including the wrist) will be moved" );
236 void iCubArmPosToPostureMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
263 iCubTorsoPosToPostureMotor::iCubTorsoPosToPostureMotor( ConfigurationParameters& params, QString prefix ) :
294 Descriptor d = addTypeDescription( type, "Move the torso in the position using the configurePosture method. The movement of this motor is instantaneuos, it only require one step. And hence, any physics is ignored. Use this motor only in kinematic mode of the iCub." );
295 d.describeBool( "disableYaw" ).def(false).help( "Disable the movement of the first joint of the Torso corresponding to the yaw rotation" );
296 d.describeBool( "disableRoll" ).def(false).help( "Disable the movement of the second joint of the Torso corresponding to the roll rotation" );
297 d.describeBool( "disablePitch" ).def(false).help( "Disable the movement of the third joint of the Torso corresponding to the pitch rotation" );
330 void iCubTorsoPosToPostureMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
352 iCubArmMusclesMotor::iCubArmMusclesMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
377 Descriptor d = addTypeDescription( type, "Muscular control of the right/left arm, 2 muscles for each joint" );
378 d.describeEnum( "arm" ).def( "right" ).values( QStringList()<<"right"<<"left" ).props( IsMandatory ).help( "The arm to move" );
405 void iCubArmMusclesMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
447 evonetIt->setGraphicProperties(label + QString("A") + QString::number(i) + QString("'"), 0.0, 1.0, Qt::red );
449 evonetIt->setGraphicProperties(label + QString("A") + QString::number(i) + QString("\""), 0.0, 1.0, Qt::red );
460 iCubHandMusclesMotor::iCubHandMusclesMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
485 Descriptor d = addTypeDescription( type, "Muscular control of the right/left hand, 2 muscles for each joint" );
486 d.describeEnum( "hand" ).def( "right" ).values( QStringList()<<"right"<<"left" ).props( IsMandatory ).help( "The hand to move" );
513 void iCubHandMusclesMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
555 evonetIt->setGraphicProperties(label + QString("F") + QString::number(i) + QString("'"), 0.0, 1.0, Qt::red );
557 evonetIt->setGraphicProperties(label + QString("F") + QString::number(i) + QString("\""), 0.0, 1.0, Qt::red );
568 iCubTorsoMusclesMotor::iCubTorsoMusclesMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
591 Descriptor d = addTypeDescription( type, "Muscular control of the Torso, 2 muscles for each joint" );
621 void iCubTorsoMusclesMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
658 evonetIt->setGraphicProperties( QString("T") + QString::number(i) + QString("'"), 0.0, 1.0, Qt::red );
660 evonetIt->setGraphicProperties( QString("T") + QString::number(i) + QString("\""), 0.0, 1.0, Qt::red );
671 iCubHeadMusclesMotor::iCubHeadMusclesMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
695 Descriptor d = addTypeDescription( type, "Muscular control of the head, 2 muscles for each joint" );
726 void iCubHeadMusclesMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
758 evonetIt->setGraphicProperties( QString("N") + QString::number(i) + QString("'"), 0.0, 1.0, Qt::red );
760 evonetIt->setGraphicProperties( QString("N") + QString::number(i) + QString("\""), 0.0, 1.0, Qt::red );
773 m_proportionalController(ConfigurationHelper::getDouble(params, prefix + "k", 0.3f), ConfigurationHelper::getDouble(params, prefix + "maxVelocity", 20.0f))
799 Descriptor d = addTypeDescription(type, "The base class for iCub motors that are controlled by target posture and move the robot with velocity commands");
800 d.describeReal("k").def(0.3f).limits(0.0f, +Infinity).help("The gain of the proportional controller", "This is the gain of the proportional controller converting position displacement (desired position minus current position) to a velocity to apply to the joints. The default is 0.3");
801 d.describeReal("maxVelocity").def(20.0f).limits(0.0f, +Infinity).help("The absolute value of the maximum velocity for joints", "This is the absolute value of the maximum velocity applied to a joint by the proportional controller (i.e. the velocity applied to joints are always in the range [+maxvel, -maxvel]). The default is 20");
804 iCubArmPosToVelMotor::iCubArmPosToVelMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
825 Descriptor d = addTypeDescription( type, "Position mapped in velocity control of the right/left arm" );
826 d.describeEnum( "arm" ).def( "right" ).values( QStringList()<<"right"<<"left" ).props( IsMandatory ).help( "The arm to move" );
856 void iCubArmPosToVelMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
881 evonetIt->setGraphicProperties(label+ QString("A")+QString::number(i), 0.0, 1.0, Qt::red ); //ex Ap2V
890 iCubTorsoPosToVelMotor::iCubTorsoPosToVelMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
922 d.describeBool( "disableYaw" ).def(false).help( "Disable the movement of the first joint of the Torso corresponding to the yaw rotation" );
923 d.describeBool( "disableRoll" ).def(false).help( "Disable the movement of the second joint of the Torso corresponding to the roll rotation" );
924 d.describeBool( "disablePitch" ).def(false).help( "Disable the movement of the third joint of the Torso corresponding to the pitch rotation" );
957 void iCubTorsoPosToVelMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
980 iCubHeadPosToVelMotor::iCubHeadPosToVelMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
1019 d.describeBool("disableNeckPitch").def(false).help("Disables the #0 joint of the head: Neck Pitch");
1020 d.describeBool("disableNeckRoll").def(false).help("Disables the #1 joint of the head: Neck Roll");
1021 d.describeBool("disableNeckYaw").def(false).help("Disables the #2 joint of the head: Neck Yaw");
1022 d.describeBool("disableEyesTilt").def(false).help("Disables the #3 joint of the head: Eyes tilt");
1023 d.describeBool("disableEyesVersion").def(false).help("Disables the #4 joint of the head: Eyes version");
1024 d.describeBool("disableEyesVergence").def(false).help("Disables the #5 joint of the head: Eyes vergence");
1054 icubMotors->velocityMove(i, proportionalController().velocityForJoint(desiredPosture, actual));
1070 void iCubHeadPosToVelMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
1093 iCubConfigurableHandPosToVelMotor::iCubConfigurableHandPosToVelMotor(ConfigurationParameters& params, QString prefix) :
1103 // Reading the fingers joints configuration. The configuration format is like this: joint1,joint2/joint5,joint6,joint3/joint4.
1104 // In this case we have three groups of joints: (joint1 and joint2), (joint5, joint6 and joint3) and (joint4). Joints in the
1105 // same group are controlled together. This parameter is compulsory, if it is not present, the program throws an exception.
1106 // The joint names are: Aperture, Thumb1, Thumb2, Thumb3, Index1, Index2, Middle1, Middle2, Others (case insensitive)
1110 ConfigurationHelper::throwUserConfigError(paramName, "", "the parameter is compulsory but is not present in the configuration");
1150 ConfigurationHelper::throwUserConfigError(paramName, str, "unknown joint name (" + jointName + ")");
1213 Descriptor d = addTypeDescription(type, "Hand motor", "A motor for the iCub hand. This allows to specify which joints should be controlled together (see the jointsGroups parameter)");
1214 d.describeEnum("hand").def("right").values(QStringList() << "right" << "left").props(IsMandatory).help("The hand to use", "The hand whose distance from the object should be returned. Choose between \"right\" and \"left\"");
1215 d.describeString("jointsGroups").def("Aperture, Thumb1, Thumb2, Thumb3, Index1, Index2, Middle1, Middle2, Others").props(IsMandatory).help("The parameter which specifies the joint configuration", "This parameter allows specifying which joints should be controlled together. The format is like this: joint1,joint2/joint5,joint6,joint3/joint4. In this case we have three groups of joints: (joint1 and joint2), (joint5, joint6 and joint3) and (joint4). Joints in the same group are controlled together, while joints that are not listed in any group are not controlled. This parameter is compulsory, if it is not present, the program throws an exception. The allowed joint names are: Aperture, Thumb1, Thumb2, Thumb3, Index1, Index2, Middle1, Middle2, Others (case insensitive)");
1216 d.describeReal("maxClosure").def(1.0).limits(0.0, 1.0).help("The limit to joint movement", "This parameter allows limiting joint excursion to a portion of the original one. If set to 1.0 all joints move within their limits, otherwise their upper limit is set to maxClosure portion of the original upper limit. This applies to all controlled joints. A value of 0.0 disables all joint movements");
1231 // The network output value is multiplied by m_maxClosure so that the maximum closure of fingers can be
1242 const double desiredPosture = linearMap(out, 0.0, 1.0, min, max); // normalize the neuron output with respect to the joint range
1244 m_armController->velocityMove(m_jointsGroups[i][j], proportionalController().velocityForJoint(desiredPosture, actual));
1254 void iCubConfigurableHandPosToVelMotor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1287 iCubHeadVelocityMotor::iCubHeadVelocityMotor(ConfigurationParameters& params, QString prefix) :
1308 Descriptor d = addTypeDescription(type, "Head velocity motor", "The motor to move the head of the icub in velocity. This controls two degrees of freedom: pan (head joint 2) and tilt (head joint 0)");
1325 evonetIt->nextNeuron(); // Removed to avoid a warning from NeuronsIterator //remotion works only for the last sensor
1342 void iCubHeadVelocityMotor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1363 iCubArmVelocityMotor::iCubArmVelocityMotor( ConfigurationParameters& params, QString prefix ) :
1389 d.describeEnum( "arm" ).def( "right" ).values( QStringList()<<"right"<<"left" ).props( IsMandatory ).help( "The arm to move" );
1390 d.describeBool( "full" ).def( "true" ).help( "If full is false only the first 4 DoF will be moved; if full is true all 7 DoF of the arm (including the wrist) will be moved" );
1391 d.describeReal( "maxVelocity").def(50.0).limits(0,100).help( "The maximum velocity allowed." );
1416 void iCubArmVelocityMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
1443 iCubTorsoVelocityMotor::iCubTorsoVelocityMotor( ConfigurationParameters& params, QString prefix ) :
1477 d.describeBool( "disableYaw" ).def(false).help( "Disable the movement of the first joint of the Torso corresponding to the yaw rotation" );
1478 d.describeBool( "disableRoll" ).def(false).help( "Disable the movement of the second joint of the Torso corresponding to the roll rotation" );
1479 d.describeBool( "disablePitch" ).def(false).help( "Disable the movement of the third joint of the Torso corresponding to the pitch rotation" );
1480 d.describeReal( "maxVelocity").def(50.0).limits(0,100).help( "The maximum velocity allowed." );
1506 void iCubTorsoVelocityMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {