当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix4f::block方法代码示例

本文整理汇总了C++中eigen::Matrix4f::block方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4f::block方法的具体用法?C++ Matrix4f::block怎么用?C++ Matrix4f::block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eigen::Matrix4f的用法示例。


在下文中一共展示了Matrix4f::block方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: showResults

void PairwiseRegistrationDialog::showResults(const Eigen::Matrix4f &transformation, float rmsError, int corrNumber)
{
	std::stringstream temp;
	Eigen::Matrix4f T = transformation;
	temp.str("");
	temp << T;
	TTextEdit->setText(QString::fromStdString(temp.str()));
	Eigen::Matrix3f R = T.block(0,0,3,3);
	float c = (R * R.transpose()).diagonal().mean();
	c = qSqrt(c);
	cLineEdit->setText(QString::number(c));
	R /= c;
	temp.str("");
	temp << R;
	RTextEdit->setText(QString::fromStdString(temp.str()));
	Eigen::Vector3f t = T.block(0,3,3,1);
	temp.str("");
	temp << t;
	tLineEdit->setText(QString::fromStdString(temp.str()));
	Eigen::AngleAxisf angleAxis(R);
	angleLineEdit->setText( QString::number(angleAxis.angle()) );
	temp.str("");
	temp << angleAxis.axis();
	axisLineEdit->setText(QString::fromStdString(temp.str()));

	corrNumberLineEdit->setText(QString::number(corrNumber));
	errorLineEdit->setText(QString::number(rmsError));
}
开发者ID:Tonsty,项目名称:Registar,代码行数:28,代码来源:pairwiseregistrationdialog.cpp

示例2: RobotNodeActuator

SimoxMotionState::SimoxMotionState( VirtualRobot::SceneObjectPtr sceneObject)
    :btDefaultMotionState()
{
	this->sceneObject = sceneObject;
	initalGlobalPose.setIdentity();
	if (sceneObject)
	{
		initalGlobalPose = sceneObject->getGlobalPoseVisualization();
	}
    _transform.setIdentity();
	_graphicsTransfrom.setIdentity();
	_comOffset.setIdentity();
	Eigen::Vector3f com = sceneObject->getCoMLocal();
	RobotNodePtr rn = boost::dynamic_pointer_cast<RobotNode>(sceneObject);
	if (rn)
	{
		// we are operating on a RobotNode, so we need a RobtoNodeActuator to move it later on
		robotNodeActuator.reset(new RobotNodeActuator(rn));

		// localcom is given in coord sytsem of robotnode (== endpoint of internal transformation)
		// we need com in visualization coord system (== without postjointtransform)

		Eigen::Matrix4f t;
		t.setIdentity();
		t.block(0,3,3,1)=rn->getCoMGlobal();
		t = rn->getGlobalPoseVisualization().inverse() * t;
		com = t.block(0,3,3,1);
	}
	_setCOM(com);
	setGlobalPose(initalGlobalPose);
}
开发者ID:TheMarex,项目名称:simox,代码行数:31,代码来源:SimoxMotionState.cpp

示例3: updateCoM

void stabilityWindow::updateCoM()
{
    if (!comVisu || comVisu->getNumChildren() == 0)
    {
        return;
    }

    // Draw CoM
    Eigen::Matrix4f globalPoseCoM;
    globalPoseCoM.setIdentity();

    if (currentRobotNodeSet)
    {
        globalPoseCoM.block(0, 3, 3, 1) = currentRobotNodeSet->getCoM();
    }
    else if (robot)
    {
        globalPoseCoM.block(0, 3, 3, 1) = robot->getCoMGlobal();
    }

    SoMatrixTransform* m = dynamic_cast<SoMatrixTransform*>(comVisu->getChild(0));

    if (m)
    {
        SbMatrix ma(reinterpret_cast<SbMat*>(globalPoseCoM.data()));
        // mm -> m
        ma[3][0] *= 0.001f;
        ma[3][1] *= 0.001f;
        ma[3][2] *= 0.001f;
        m->matrix.setValue(ma);
    }

    // Draw CoM projection
    if (currentRobotNodeSet && comProjectionVisu && comProjectionVisu->getNumChildren() > 0)
    {
        globalPoseCoM(2, 3) = 0;
        m = dynamic_cast<SoMatrixTransform*>(comProjectionVisu->getChild(0));

        if (m)
        {
            SbMatrix ma(reinterpret_cast<SbMat*>(globalPoseCoM.data()));
            // mm -> m
            ma[3][0] *= 0.001f;
            ma[3][1] *= 0.001f;
            ma[3][2] *= 0.001f;
            m->matrix.setValue(ma);
        }
    }
}
开发者ID:gkalogiannis,项目名称:simox,代码行数:49,代码来源:stabilityWindow.cpp

示例4:

Eigen::Matrix4f DynamicsRobot::getComGlobal( VirtualRobot::RobotNodePtr rn )
{
    Eigen::Matrix4f com = Eigen::Matrix4f::Identity();
    com.block(0,3,3,1) = rn->getCoMLocal();
    com = rn->getGlobalPoseVisualization()*com;
    return com;
}
开发者ID:TheMarex,项目名称:simox,代码行数:7,代码来源:DynamicsRobot.cpp

示例5: malloc

void GraphOptimizer_G2O::addEdge(const int fromIdx,
                                 const int toIdx,
                                 Eigen::Matrix4f& relativePose,
                                 Eigen::Matrix<double,6,6>& informationMatrix)
{
    #if ENABLE_DEBUG_G2O
    char* fileName = (char*) malloc(100);
    std::sprintf(fileName,"../results/matrices/edge_%i_to_%i.txt",fromIdx,toIdx);
    Miscellaneous::saveMatrix(relativePose,fileName);
    delete fileName;
    #endif

    //Transform Eigen::Matrix4f into 3D traslation and rotation for g2o
    g2o::Vector3d t(relativePose(0,3),relativePose(1,3),relativePose(2,3));
    g2o::Quaterniond q;
    Eigen::Matrix3d rot = relativePose.block(0,0,3,3).cast<double>();
    q = rot;


    g2o::SE3Quat transf(q,t);	// relative transformation

    g2o::EdgeSE3* edge = new g2o::EdgeSE3;
    edge->vertices()[0] = optimizer.vertex(fromIdx);
    edge->vertices()[1] = optimizer.vertex(toIdx);
    edge->setMeasurement(transf);
    edge->setInformation(informationMatrix);

    optimizer.addEdge(edge);
}
开发者ID:smallprograms,项目名称:CustomICP_rgb,代码行数:29,代码来源:GraphOptimizer_G2O.cpp

示例6: comTargetMovedX

void stabilityWindow::comTargetMovedX(int value)
{
	if(!currentRobotNodeSet)
		return;

	Eigen::Matrix4f T;
	T.setIdentity();

	m_CoMTarget(0) = value;
	T.block(0, 3, 2, 1) = m_CoMTarget;

	if(comTargetVisu && comTargetVisu->getNumChildren() > 0)
	{
		SoMatrixTransform *m = dynamic_cast<SoMatrixTransform *>(comTargetVisu->getChild(0));
		if(m)
		{
			SbMatrix ma(reinterpret_cast<SbMat*>(T.data()));
            // mm -> m
            ma[3][0] *= 0.001f;
            ma[3][1] *= 0.001f;
            ma[3][2] *= 0.001f;
			m->matrix.setValue(ma);
		}
	}

	performCoMIK();
}
开发者ID:ajshort,项目名称:simox,代码行数:27,代码来源:stabilityWindow.cpp

示例7: _setCOM

void SimoxMotionState::_setCOM( const Eigen::Vector3f& com )
{
	this->com = com;
	Eigen::Matrix4f comM = Eigen::Matrix4f::Identity();
	comM.block(0,3,3,1) = -com;
	_comOffset = BulletEngine::getPoseBullet(comM);
}
开发者ID:TheMarex,项目名称:simox,代码行数:7,代码来源:SimoxMotionState.cpp

示例8: getInverseCameraMatrix

Eigen::Matrix4f getInverseCameraMatrix( Eigen::Matrix4f &cameraPose )
{
    auto rotation = cameraPose.block(0, 0, 3, 3);
    auto translation = cameraPose.block(0, 3, 4, 1);

    auto rotationInv = (Eigen::Matrix4f)rotation.inverse();
    auto translationInv = -rotationInv * translation;

    Eigen::Matrix4f cameraPoseInv;
    cameraPoseInv << rotationInv(0,0) ,rotationInv(0,1) ,rotationInv(0,2)   ,translationInv(0)
            ,rotationInv(1,0) ,rotationInv(1,1) ,rotationInv(1,2)   ,translationInv(1)
            ,rotationInv(2,0) ,rotationInv(2,1) ,rotationInv(2,2)   ,translationInv(2)
            ,0                ,0                ,0                  ,1 ;

    return cameraPoseInv;
}
开发者ID:S3BASTI3N,项目名称:ComputerVision2PCL,代码行数:16,代码来源:main.cpp

示例9: updateEEFPose

 bool ApproachMovementGenerator::updateEEFPose(const Eigen::Vector3f& deltaPosition)
 {
     Eigen::Matrix4f deltaPose;
     deltaPose.setIdentity();
     deltaPose.block(0, 3, 3, 1) = deltaPosition;
     return updateEEFPose(deltaPose);
 }
开发者ID:dtbinh,项目名称:Simox,代码行数:7,代码来源:ApproachMovementGenerator.cpp

示例10: updateEEFPose

bool GraspPlannerEvaluatorWindow::updateEEFPose(const Eigen::Vector3f& deltaPosition)
{
	Eigen::Matrix4f deltaPose;
	deltaPose.setIdentity();
	deltaPose.block(0, 3, 3, 1) = deltaPosition;
	return updateEEFPose(deltaPose);
}
开发者ID:gkalogiannis,项目名称:simox,代码行数:7,代码来源:GraspPlannerEvaluatorWindow.cpp

示例11: pertubateStepObject

void GraspPlannerEvaluatorWindow::pertubateStepObject()
{
	Eigen::Vector3f rotPertub;
	rotPertub.setRandom(3).normalize();
	Eigen::Vector3f translPertub;
	translPertub.setRandom(3).normalize();

	Eigen::Matrix4f deltaPose;
	deltaPose.setIdentity();

        translPertub(0) =  UI.doubleSpinBoxPertDistanceX->value();
        translPertub(1) =  UI.doubleSpinBoxPertDistanceY->value();
        translPertub(2) =  UI.doubleSpinBoxPertDistanceZ->value();

        // rotPertub(0) =  UI.doubleSpinBoxPertAngleX->value();
        // rotPertub(1) =  UI.doubleSpinBoxPertAngleY->value();
        /* rotPertub(2) =  UI.doubleSpinBoxPertAngleZ->value(); */

        
        //deltaPose.block(0,0,3,3) = rodriguesFormula(rotPertub, UI.doubleSpinBoxPertAngle->value());
	// deltaPose.block(0,0,3,3) = rotPertub;
        deltaPose.block(0,3,3,1) = translPertub;

	std::cout << "DeltaPose:\n" << deltaPose << std::endl;
	std::cout << "Pose:\n" << object->getGlobalPose() << std::endl;
	std::cout << "FinalPose:\n" << (deltaPose*object->getGlobalPose()) << std::endl;
	object->setGlobalPose(deltaPose*object->getGlobalPose());
}
开发者ID:gkalogiannis,项目名称:simox,代码行数:28,代码来源:GraspPlannerEvaluatorWindow.cpp

示例12: updateComVisu

void SimDynamicsWindow::updateComVisu()
{
    if (!robot)
    {
        return;
    }

    std::vector<RobotNodePtr> n = robot->getRobotNodes();
    std::map< VirtualRobot::RobotNodePtr, SoSeparator* >::iterator i = comVisuMap.begin();

    while (i != comVisuMap.end())
    {
        SoSeparator* sep = i->second;
        SoMatrixTransform* m = dynamic_cast<SoMatrixTransform*>(sep->getChild(0));

        if (m)
        {
            Eigen::Matrix4f ma = dynamicsRobot->getComGlobal(i->first);
            ma.block(0, 3, 3, 1) *= 0.001f;
            m->matrix.setValue(CoinVisualizationFactory::getSbMatrix(ma));
        }

        i++;
    }
}
开发者ID:gkalogiannis,项目名称:simox,代码行数:25,代码来源:simDynamicsWindow.cpp

示例13: isOdometryContinuousMotion

    bool isOdometryContinuousMotion(Eigen::Matrix4f &prevPose, Eigen::Matrix4f &currPose, float thresDist = 0.1)
    {
        Eigen::Matrix4f relativePose = prevPose.inverse() * currPose;
        if( relativePose.block(0,3,3,1).norm() > thresDist )
            return false;

        return true;
    }
开发者ID:EduFdez,项目名称:rgbd360,代码行数:8,代码来源:KFsphere_SLAM.cpp

示例14: estimateRigidTransformationSVD

/**
 * estimateRigidTransformationSVD
 */
void RigidTransformationRANSAC::estimateRigidTransformationSVD(
      const std::vector<Eigen::Vector3f > &srcPts,
      const std::vector<int> &srcIndices,
      const std::vector<Eigen::Vector3f > &tgtPts,
      const std::vector<int> &tgtIndices,
      Eigen::Matrix4f &transform)
{
  Eigen::Vector3f srcCentroid, tgtCentroid;

  // compute the centroids of source, target
  ComputeCentroid (srcPts, srcIndices, srcCentroid);
  ComputeCentroid (tgtPts, tgtIndices, tgtCentroid);

  // Subtract the centroids from source, target
  Eigen::MatrixXf srcPtsDemean;
  DemeanPoints(srcPts, srcIndices, srcCentroid, srcPtsDemean);

  Eigen::MatrixXf tgtPtsDemean;
  DemeanPoints(tgtPts, tgtIndices, tgtCentroid, tgtPtsDemean);

  // Assemble the correlation matrix H = source * target'
  Eigen::Matrix3f H = (srcPtsDemean * tgtPtsDemean.transpose ()).topLeftCorner<3, 3>();

  // Singular Value Decomposition
  Eigen::JacobiSVD<Eigen::Matrix3f> svd (H, Eigen::ComputeFullU | Eigen::ComputeFullV);
  Eigen::Matrix3f u = svd.matrixU ();
  Eigen::Matrix3f v = svd.matrixV ();

  // Compute R = V * U'
  if (u.determinant () * v.determinant () < 0)
  {
    for (int x = 0; x < 3; ++x)
      v (x, 2) *= -1;
  }

  // Return the transformation
  Eigen::Matrix3f R = v * u.transpose ();
  Eigen::Vector3f t = tgtCentroid - R * srcCentroid;

  // set rotation
  transform.block(0,0,3,3) = R;
  // set translation
  transform.block(0,3,3,1) = t;
  transform.block(3, 0, 1, 3).setZero();  
  transform(3,3) = 1.;
}
开发者ID:ToMadoRe,项目名称:v4r,代码行数:49,代码来源:RigidTransformationRANSAC.cpp

示例15: computeWalkingTrajectory

void HierarchicalWalkingIK::computeWalkingTrajectory(const Eigen::Matrix3Xf& comTrajectory,
                                                     const Eigen::Matrix6Xf& rightFootTrajectory,
                                                     const Eigen::Matrix6Xf& leftFootTrajectory,
                                                     std::vector<Eigen::Matrix3f>& rootOrientation,
                                                     Eigen::MatrixXf& trajectory)
{
    int rows = outputNodeSet->getSize();

    trajectory.resize(rows, rightFootTrajectory.cols());
    rootOrientation.resize(rightFootTrajectory.cols());

    Eigen::Vector3f com = colModelNodeSet->getCoM();

    Eigen::VectorXf configuration;
    int N = trajectory.cols();

    Eigen::Matrix4f leftFootPose  = Eigen::Matrix4f::Identity();
    Eigen::Matrix4f rightFootPose = Eigen::Matrix4f::Identity();
    Eigen::Matrix4f chestPose     = chest->getGlobalPose();
    Eigen::Matrix4f pelvisPose    = pelvis->getGlobalPose();

    for (int i = 0; i < N; i++)
    {
        VirtualRobot::MathTools::posrpy2eigen4f(1000 * leftFootTrajectory.block(0, i, 3, 1),  leftFootTrajectory.block(3, i, 3, 1),  leftFootPose);
        VirtualRobot::MathTools::posrpy2eigen4f(1000 * rightFootTrajectory.block(0, i, 3, 1), rightFootTrajectory.block(3, i, 3, 1), rightFootPose);

        // FIXME the orientation of the chest and chest is specific to armar 4
        // since the x-Axsis points in walking direction
        Eigen::Vector3f xAxisChest = (leftFootPose.block(0, 1, 3, 1) + rightFootPose.block(0, 1, 3, 1))/2;
        xAxisChest.normalize();
        chestPose.block(0, 0, 3, 3) = Bipedal::poseFromXAxis(xAxisChest);
        pelvisPose.block(0, 0, 3, 3) = Bipedal::poseFromYAxis(-xAxisChest);

        std::cout << "Frame #" << i << ", ";
        robot->setGlobalPose(leftFootPose);
        computeStepConfiguration(1000 * comTrajectory.col(i),
                                 rightFootPose,
                                 chestPose,
                                 pelvisPose,
                                 configuration);

        trajectory.col(i) = configuration;
        rootOrientation[i] = leftFootPose.block(0, 0, 3, 3);
    }
}
开发者ID:TheMarex,项目名称:libbipedal,代码行数:45,代码来源:HierarchicalWalkingIK.cpp


注:本文中的eigen::Matrix4f::block方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。