コード例 #1
0
ファイル: friRemote.cpp プロジェクト: shangl/iros2016
  /** automatically do data exchange, if not otherwise specified */
  int friRemote::doPositionControl(float newJntPosition[LBR_MNJ], bool flagDataExchange)

{
	// Helper, if not properly initialized or the like...

	cmd.cmd.cmdFlags=FRI_CMD_JNTPOS;
	// Note:: If the interface is not in Command mode,
	// The commands have to be "mirrored" to get in sync
	// Note:: If the interface is not in Command mode,
	// The commands have to be "mirrored" to get in sync
	if ((getState() != FRI_STATE_CMD) || (!isPowerOn()))
	{
		for (int i = 0; i < LBR_MNJ; i++)
		{
			cmd.cmd.jntPos[i]=msr.data.cmdJntPos[i]+msr.data.cmdJntPosFriOffset[i];
		}
	}
	else
	{
		// compute new values here ...
		for (int i = 0; i < LBR_MNJ; i++)
			cmd.cmd.jntPos[i]=newJntPosition[i];
	}

	if (flagDataExchange)
	{
		return doDataExchange();
	}
	return 1;
}
コード例 #2
0
ファイル: ContactView.cpp プロジェクト: 4Ykw/keyhotee
void ContactView::onEdit()
{
  setAddingNewContact(false);   //editing  
  doDataExchange (false);
  keyEdit(true);   //and set focus on the first field
  ui->contact_pages->setCurrentIndex(info);
  ui->info_stack->setCurrentWidget(ui->info_edit);
}
コード例 #3
0
ファイル: friRemote.cpp プロジェクト: shangl/iros2016
/** automatically do data exchange, if not otherwise specified 
 if flagDataExchange is set to false, call doDataExchange() 
 or doReceiveData()/doSendData() on your own
 IN: newJntPosition   - joint positions
	 newJntStiff      - joint stiffness (Spring factor)
	 newJntDamp       - joint damping   (Damping factor)
	 newJntAddTorque  - additional torque 
       
 Note: If any of the pointers (newJntPosition, newJntStiff, newJntDamp, newJntAddTorque) is NULL, the 
	   value is ignored -> the respective  cmd.cmd.cmdFlags field is set properly
 Note: It is possible to change cmd.cmd.cmdFlags in monitor mode only !!
 */
int friRemote::doJntImpedanceControl(const float newJntPosition[LBR_MNJ], 
										const float newJntStiff[LBR_MNJ], 
										const float newJntDamp[LBR_MNJ], 
										const float newJntAddTorque[LBR_MNJ],
										bool flagDataExchange)

{
	// Helper, if not properly initialized or the like...
	cmd.cmd.cmdFlags=0;
	if (newJntPosition)
	{
		cmd.cmd.cmdFlags|=FRI_CMD_JNTPOS;
		// Note:: If the interface is not in Command mode,
		// The commands have to be "mirrored" to get in sync
		if ((getState() != FRI_STATE_CMD) || (!isPowerOn()))
		{
			for (int i = 0; i < LBR_MNJ; i++)
			{
				cmd.cmd.jntPos[i]=msr.data.cmdJntPos[i]+msr.data.cmdJntPosFriOffset[i];
			}
		}
		else
		{
			// compute new values here ...
			for (int i = 0; i < LBR_MNJ; i++)
				cmd.cmd.jntPos[i]=newJntPosition[i];
		}
	}
	if (newJntStiff)
	{
		cmd.cmd.cmdFlags|=FRI_CMD_JNTSTIFF;
		for (int i = 0; i < LBR_MNJ; i++)
			cmd.cmd.jntStiffness[i]=newJntStiff[i];
	}
	if (newJntDamp)
	{
		cmd.cmd.cmdFlags|=FRI_CMD_JNTDAMP;
		for (int i = 0; i < LBR_MNJ; i++)
			cmd.cmd.jntDamping[i]=newJntDamp[i];
	}
	if (newJntAddTorque)
	{
		cmd.cmd.cmdFlags|=FRI_CMD_JNTTRQ;
		for (int i = 0; i < LBR_MNJ; i++)
			cmd.cmd.addJntTrq[i]=newJntAddTorque[i];
	}

	if (flagDataExchange)
	{
		return doDataExchange();
	}
	return 1;
}
コード例 #4
0
ファイル: ContactView.cpp プロジェクト: 4Ykw/keyhotee
void ContactView::onCancel()
{
  setModyfied(false);
  doDataExchange (false);
  keyEdit(false);
  if (isAddingNewContact())
  {
    emit canceledNewContact();
  }
  else  //editing contact
  {    
  }
}
コード例 #5
0
ファイル: ContactView.cpp プロジェクト: HackFisher/keyhotee
void ContactView::onSave()
{
  try
  {
    if (doDataExchange (true))
    {
      if (_current_record)
      {
        //_current_contact.bit_id_hash = _current_record->name_hash;
        if (!_current_contact.public_key.valid() )
        {
          _current_contact.public_key = _current_record->active_key;
          FC_ASSERT(_current_contact.public_key.valid() );
        }
        // TODO: lookup block id / timestamp that registered this ID
        // _current_contact.known_since.setMSecsSinceEpoch( );
      }
      else if (!_current_record)  /// note: user is entering manual public key
      {
        elog("!current record??\n");
        /*
           if( _current_contact.known_since == QDateTime() )
         {
            _current_contact.known_since = QDateTime::currentDateTime();
         }
         */
        std::string enteredPKey = ui->public_key->text().toStdString();
        if (enteredPKey.empty() == false)
        {
          bool publicKeySemanticallyValid = false;
          assert(public_key_address::is_valid(enteredPKey, &publicKeySemanticallyValid));
          assert(publicKeySemanticallyValid);
          public_key_address key_address(enteredPKey);
          _current_contact.public_key = key_address.key;
        }
      }
      _current_contact.privacy_setting = bts::addressbook::secret_contact;
      int idxNewContact = _address_book->storeContact(_current_contact);

      keyEdit(false);
      emit savedNewContact(idxNewContact);
    }    
  }
  FC_RETHROW_EXCEPTIONS(warn, "onSave")
}
コード例 #6
0
ファイル: friRemote.cpp プロジェクト: shangl/iros2016
	/** automatically do data exchange, if not otherwise specified 
	if flagDataExchange is set to false, call doDataExchange() 
	or doReceiveData()/doSendData() on your own
	IN: newJntPosition   - joint positions
	newJntStiff      - joint stiffness (Spring factor)
	newJntDamp       - joint damping   (Damping factor)
	newJntAddTorque  - additional torque 

	Note: If any of the pointers (newJntPosition, newJntStiff, newJntDamp, newJntAddTorque) is NULL, the 
	value is ignored -> the respective  cmd.cmd.cmdFlags field is set properly
	Note: It is possible to change cmd.cmd.cmdFlags in monitor mode only !!
	*/
int friRemote::doCartesianImpedanceControl(const float newCartPosition[FRI_CART_FRM_DIM], 
										   const float newCartStiff[FRI_CART_VEC], 
										   const float newCartDamp[FRI_CART_VEC], 
										   const float newAddTcpFT[FRI_CART_VEC],
										   const float newJntNullspace[LBR_MNJ],  
										   bool flagDataExchange)
{

		// Helper, if not properly initialized or the like...
	cmd.cmd.cmdFlags=0;
	if ( newCartPosition )
	{
		cmd.cmd.cmdFlags|=FRI_CMD_CARTPOS;
		for ( int i = 0; i < FRI_CART_FRM_DIM; i++)
		{
			cmd.cmd.cartPos[i]=newCartPosition[i];

		}
	}
	if ( newCartStiff)
	{
		cmd.cmd.cmdFlags|=FRI_CMD_CARTSTIFF;
		for ( int i = 0; i < FRI_CART_VEC; i++)
		{
			cmd.cmd.cartStiffness[i]=newCartStiff[i];

		}

	}
	if ( newCartDamp)
	{
		cmd.cmd.cmdFlags|=FRI_CMD_CARTDAMP;
			;
		for ( int i = 0; i < FRI_CART_VEC; i++)
		{
			cmd.cmd.cartDamping[i]=newCartDamp[i];

		}
	}
	if ( newAddTcpFT)
	{
		cmd.cmd.cmdFlags|=FRI_CMD_TCPFT;
			;
		for ( int i = 0; i < FRI_CART_VEC; i++)
		{
			cmd.cmd.addTcpFT[i]=newAddTcpFT[i];

		}
	}

	if (newJntNullspace)
	{
		cmd.cmd.cmdFlags|=FRI_CMD_JNTPOS;
		// Note:: If the interface is not in Command mode,
		// The commands have to be "mirrored" to get in sync
		
			// compute new values here ...
			for (int i = 0; i < LBR_MNJ; i++)
				cmd.cmd.jntPos[i]=newJntNullspace[i];		
	}


if (flagDataExchange)
	{
		return doDataExchange();
	}
	return 1;
}
コード例 #7
0
ファイル: ContactView.cpp プロジェクト: 4Ykw/keyhotee
void ContactView::setContact(const Contact& current_contact)
{
    _current_contact = current_contact;
    doDataExchange (false);
}
コード例 #8
0
ファイル: ContactView.cpp プロジェクト: 4Ykw/keyhotee
void ContactView::addNewContact ()
{  
  doDataExchange (false);
  keyEdit(true);
}