void ModeloPersonaAHoap::AngulosBrazoDerecho(const modelobasicopersona& m, std::vector<double> & rarm_joint)
  {
    // ANGULOS HOMBRO
    const osg::Matrix& homb = m.jBrazoDer.trf->getMatrix();
	  
	  
    // RARM_JOINT[1] del hoap:
    rarm_joint[0] = atan2(-homb(2,2),homb(2,1));
    ONDEBUG(std::cout << "\nRARM_JOINT[1] = " << rarm_joint[0] * 180.0 / 3.14159265 << std::endl);
	  
    // RARM_JOINT[2] del hoap
    rarm_joint[1] = atan2(-homb(2,0),sqrt(homb(2,1)*homb(2,1) + homb(2,2)*homb(2,2)));
    ONDEBUG(std::cout << "RARM_JOINT[2] = " << rarm_joint[1] * 180.0 / 3.14159265 << std::endl);
	  
    // RARM_JOINT[3] del hoap
    rarm_joint[2] = atan2(homb(1,0),-homb(0,0));
    ONDEBUG(std::cout << "RARM_JOINT[3] = " << rarm_joint[2] * 180.0 / 3.14159265 << std::endl); 
	  
	  	  
    // TODO: Mirar si estamos cerca del gimbal lock
	  
    // ANGULOS CODO
    const osg::Matrix& cod = m.jAntebrazoDer.trf->getMatrix();

    // RARM_JOINT[4] del hoap
    rarm_joint[3] = atan2(cod(1,2),cod(1,1));
    ONDEBUG(std::cout << "RARM_JOINT[4] = " << rarm_joint[3] * 180.0 / 3.14159265 << std::endl);
	  
	  
  }
Exemplo n.º 2
0
/*!
  A function called \a functionName is added to this script.
  The name must match the regular expression
  \c{/^[A-Za-z_][A-Za-z_0-9]*$/}.

  The code for the function can be passed in the \a functionBody
  parameter. If \a functionBody was specified, its text will appear in
  the editor; if the \a functionBody is empty a new empty function
  will be created.

  This function returns TRUE on success (i.e. the \a functionName was
  valid); otherwise returns FALSE.
*/
bool QSScript::addFunction(const QString &functionName,
                           const QString &functionBody)
{
  static QString letters = QString::fromLatin1("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_");
  static QString numbers = QString::fromLatin1("0123456789");
  for (int i = 0; i < (int)functionName.length(); ++i) {
    if (i == 0 && letters.find(functionName[i]) == -1 ||
        letters.find(functionName[i]) == -1 && numbers.find(functionName[i]) == -1) {
#if defined(QT_CHECK_RANGE)
      qWarning("QSProject::addFunction: '%s' is not a valid function name",
               functionName.latin1());
#endif
      return FALSE;
    }
  }

  QString str = QString::fromLatin1("function %1()\n{\n%2\n}")
                .arg(functionName)
                .arg(functionBody);
#ifndef AQ_ENABLE_SCRIPTCACHE
  d->code += str;
#else
  QString cod(this->code());
  cod += str;
  d->code = aqSha1(cod);
  aqDiskCacheInsert(d->code, cod);
#endif
  emit codeChanged();
  return TRUE;
}
  void ModeloPersonaAHoap::AngulosBrazoIzquierdo(const modelobasicopersona& m, std::vector<double> & larm_joint)
  {
    //larm_joint.resize(4);

    // ANGULOS HOMBRO
    const osg::Matrix& homb = m.jBrazoIzq.trf->getMatrix();
	  
    // TODO: Mirar si estamos cerca de gimbal lock
	  
    // Si no lo estamos proceder con normalidad

    // OJO que las matrices de osg son:
    // 
    // |  R    0 |
    // |         |
    // |   T     |
    // |  t    1 |

    // LARM_JOINT[1] del hoap:
    larm_joint[0] = atan2(-homb(2,2),homb(2,1));
    ONDEBUG(std::cout << "\nLARM_JOINT[1] = " << larm_joint[0] * 180.0 / 3.14159265 << std::endl);

    // LARM_JOINT[2] del hoap
    larm_joint[1] = atan2(-homb(2,0),sqrt(homb(2,1)*homb(2,1) + homb(2,2)*homb(2,2)));
    ONDEBUG(std::cout << "LARM_JOINT[2] = " << larm_joint[1] * 180.0 / 3.14159265 << std::endl);
	  
    // LARM_JOINT[3] del hoap
    larm_joint[2] = atan2(homb(1,0),-homb(0,0));
    ONDEBUG(std::cout << "LARM_JOINT[3] = " << larm_joint[2] * 180.0 / 3.14159265 << std::endl); 
	  
	  
    // Si lo estamos llamar subrutina gimbal_lock
	  
	  	  
    // ANGULOS CODO
    const osg::Matrix& cod = m.jAntebrazoIzq.trf->getMatrix();
	  
    // LARM_JOINT[4] del hoap
    larm_joint[3] = atan2(cod(1,2),cod(1,1));
    ONDEBUG(std::cout << "LARM_JOINT[4] = " << larm_joint[3] * 180.0 / 3.14159265 << std::endl);
	  
  }
Exemplo n.º 4
0
int main(){
  char str[1000], codStr[1000];
  printf("Insira a string\n");
  scanf("%[A-Z a-z]", str);
  
  cod(str, codStr);
  
  printf("String codificada: %s\n",codStr);

  return 1;
}
Exemplo n.º 5
0
/*!
  Appends the code \a code to the code in this script.
  This function will emit codeChanged()
*/
void QSScript::addCode(const QString &code)
{
#ifndef AQ_ENABLE_SCRIPTCACHE
  d->code += code;
#else
  QString cod(this->code());
  cod += code;
  d->code = aqSha1(cod);
  aqDiskCacheInsert(d->code, cod);
#endif
  emit codeChanged();
}
// ---------------------------------------------------------------------------
// Load ECom plug-ins
// ---------------------------------------------------------------------------
//
void CBTUIPluginMan::LoadPluginsL()
	{
	TRACE_FUNC_ENTRY
	
	REComSession::ListImplementationsL( KCBtuiPluginInterfaceUid, iPluginInfoArray );
	TInt count = iPluginInfoArray.Count();
	TRACE_INFO( ( _L( "[BTUI]\t CBTUIPluginMan::LoadSettingPluginL() PluginArray count=%d" ), count) )

    iPluginArray.Reset();
	for ( TUint ii = 0 ; ii < count; ++ii )
		{
		CImplementationInformation* impl = iPluginInfoArray[ii];
		//Only append the plugins which datatype() is for HID devices. 
	    if(impl->DataType().Length())
	    	{
	    	TLex8 lex( impl->DataType() );
	    	TUint major = 0, minor = 0;
	    	TInt err1 = lex.Val(major, EHex);
	    	lex.SkipSpace();
	    	TInt err2 = lex.Val(minor, EHex);
	    	if( !err1 && !err2)
	    	    {
	    	    TRACE_INFO( ( _L( "[BTUI]\t CBTUIPluginMan::LoadSettingPluginL() MajorCOD=%d MinorCOD=%d" ), major, minor) )
 	            TBTDeviceClass cod(0x00, major, minor);
	    	                
	    	    CBtuiPluginInterface* plugin = NULL;
	    	    TRAPD( ret, plugin = CBtuiPluginInterface::NewL( impl->ImplementationUid() ) );
	    	    if( !ret )
	    	        {
	    	        CleanupStack::PushL(plugin);
	    	        
	    	        // Transfer the ownership to AppUi
	    	        iAppUi->AddViewL( (CAknView*)plugin ); 
	    	        plugin->SetCOD(cod);
	    	        iPluginArray.AppendL(plugin);
	    	        CleanupStack::Pop(plugin);              
	    	        }	    	        
	    	    }
	        }
		}
	
	TRACE_FUNC_EXIT
	}