icubmotors.cpp
43 neuronsIteratorResource = 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 );
771 iCubArmPosToVelMotor::iCubArmPosToVelMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
792 Descriptor d = addTypeDescription( type, "Position mapped in velocity control of the right/left arm" );
793 d.describeEnum( "arm" ).def( "right" ).values( QStringList()<<"right"<<"left" ).props( IsMandatory ).help( "The arm to move" );
823 void iCubArmPosToVelMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
848 evonetIt->setGraphicProperties(label+ QString("A")+QString::number(i), 0.0, 1.0, Qt::red ); //ex Ap2V
857 iCubTorsoPosToVelMotor::iCubTorsoPosToVelMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
889 d.describeBool( "disableYaw" ).def(false).help( "Disable the movement of the first joint of the Torso corresponding to the yaw rotation" );
890 d.describeBool( "disableRoll" ).def(false).help( "Disable the movement of the second joint of the Torso corresponding to the roll rotation" );
891 d.describeBool( "disablePitch" ).def(false).help( "Disable the movement of the third joint of the Torso corresponding to the pitch rotation" );
924 void iCubTorsoPosToVelMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
947 iCubHeadPosToVelMotor::iCubHeadPosToVelMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
994 d.describeBool("disableNeckPitch").def(false).help("Disables the #0 joint of the head: Neck Pitch");
995 d.describeBool("disableNeckRoll").def(false).help("Disables the #1 joint of the head: Neck Roll");
996 d.describeBool("disableNeckYaw").def(false).help("Disables the #2 joint of the head: Neck Yaw");
997 d.describeBool("disableEyesTilt").def(false).help("Disables the #3 joint of the head: Eyes tilt");
998 d.describeBool("disableEyesVersion").def(false).help("Disables the #4 joint of the head: Eyes version");
999 d.describeBool("disableEyesVergence").def(false).help("Disables the #5 joint of the head: Eyes vergence");
1000 d.describeReal("k").def(0.3).limits(0.0, +std::numeric_limits<double>::infinity()).help("The gain for the proportional controller", "This parameter is the gain for the proportional controller converting position displacement (desired position minus current position) to a velocity to apply to the joint");
1001 d.describeReal("maxvel").def(20.0).limits(0.0, +std::numeric_limits<double>::infinity()).help("The maximum velocity for joints", "This is the maximum allowed velocity that can be applied to a joint (absolute value). Velocities greater than this are truncated to +maxvel or -maxvel");
1048 void iCubHeadPosToVelMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
1071 iCubHandPosToVelMotor::iCubHandPosToVelMotor(farsa::ConfigurationParameters ¶ms, QString prefix):
1094 Descriptor d = addTypeDescription( type, "Position mapped in velocity control of the right or left Hand" );
1095 d.describeEnum( "hand" ).def( "right" ).values( QStringList()<<"right"<<"left" ).props( IsMandatory ).help( "The hand to move" );
1126 void iCubHandPosToVelMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
1152 evonetIt->setGraphicProperties(label+QString("F")+QString::number(i), 0.0, 1.0, Qt::red ); //ex HNp2v
1161 iCubHeadVelocityMotor::iCubHeadVelocityMotor(ConfigurationParameters& params, QString prefix) :
1182 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)");
1199 evonetIt->nextNeuron(); // Removed to avoid a warning from NeuronsIterator //remotion works only for the last sensor
1216 void iCubHeadVelocityMotor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1237 iCubConfigurableHandPosToVelMotor::iCubConfigurableHandPosToVelMotor(ConfigurationParameters& params, QString prefix) :
1247 // Reading the fingers joints configuration. The configuration format is like this: joint1,joint2/joint5,joint6,joint3/joint4.
1248 // In this case we have three groups of joints: (joint1 and joint2), (joint5, joint6 and joint3) and (joint4). Joints in the
1249 // same group are controlled together. This parameter is compulsory, if it is not present, the program throws an exception.
1250 // The joint names are: Aperture, Thumb1, Thumb2, Thumb3, Index1, Index2, Middle1, Middle2, Others (case insensitive)
1254 ConfigurationHelper::throwUserConfigError(paramName, "", "the parameter is compulsory but is not present in the configuration");
1294 ConfigurationHelper::throwUserConfigError(paramName, str, "unknown joint name (" + jointName + ")");
1363 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)");
1364 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\"");
1365 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)");
1366 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");
1367 d.describeReal("k").def(0.3).limits(0.0, +std::numeric_limits<double>::infinity()).help("The gain for the proportional controller", "This parameter is the gain for the proportional controller converting position displacement (desired position minus current position) to a velocity to apply to the joint");
1368 d.describeReal("maxvel").def(20.0).limits(0.0, +std::numeric_limits<double>::infinity()).help("The maximum velocity for joints", "This is the maximum allowed velocity that can be applied to a joint (absolute value). Velocities greater than this are truncated to +maxvel or -maxvel");
1383 // The network output value is multiplied by m_maxClosure so that the maximum closure of fingers can be
1394 const double desiredPosture = linearMap(out, 0.0, 1.0, min, max); // normalize the neuron output with respect to the joint range
1396 m_armController->velocityMove(m_jointsGroups[i][j], m_pcontrol.velocityForJoint(desiredPosture, actual));
1406 void iCubConfigurableHandPosToVelMotor::resourceChanged(QString resourceName, ResourceChangeType changeType)
1439 iCubArmVelocityMotor::iCubArmVelocityMotor( ConfigurationParameters& params, QString prefix ) :
1465 d.describeEnum( "arm" ).def( "right" ).values( QStringList()<<"right"<<"left" ).props( IsMandatory ).help( "The arm to move" );
1466 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" );
1467 d.describeReal( "maxVelocity").def(50.0).limits(0,100).help( "The maximum velocity allowed." );
1492 void iCubArmVelocityMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {
1519 iCubTorsoVelocityMotor::iCubTorsoVelocityMotor( ConfigurationParameters& params, QString prefix ) :
1553 d.describeBool( "disableYaw" ).def(false).help( "Disable the movement of the first joint of the Torso corresponding to the yaw rotation" );
1554 d.describeBool( "disableRoll" ).def(false).help( "Disable the movement of the second joint of the Torso corresponding to the roll rotation" );
1555 d.describeBool( "disablePitch" ).def(false).help( "Disable the movement of the third joint of the Torso corresponding to the pitch rotation" );
1556 d.describeReal( "maxVelocity").def(50.0).limits(0,100).help( "The maximum velocity allowed." );
1582 void iCubTorsoVelocityMotor::resourceChanged(QString resourceName, ResourceChangeType changeType) {