本文整理汇总了C++中yarp::sig::Vector类的典型用法代码示例。如果您正苦于以下问题:C++ Vector类的具体用法?C++ Vector怎么用?C++ Vector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: yError
bool yarp::dev::FrameTransformClient::transformPose(const std::string &target_frame_id, const std::string &source_frame_id, const yarp::sig::Vector &input_pose, yarp::sig::Vector &transformed_pose)
{
if (input_pose.size() != 6)
{
yError() << "sorry.. only 6 dimensional vector (3 axes + roll pith and yaw) allowed, dear friend of mine..";
return false;
}
if (transformed_pose.size() != 6)
{
yWarning("FrameTransformClient::transformPose() performance warning: size transformed_pose should be 6, resizing");
transformed_pose.resize(6, 0.0);
}
yarp::sig::Matrix m(4, 4);
if (!getTransform(target_frame_id, source_frame_id, m))
{
yError() << "no transform found between source '" << target_frame_id << "' and target '" << source_frame_id << "'";
return false;
}
FrameTransform t;
t.transFromVec(input_pose[0], input_pose[1], input_pose[2]);
t.rotFromRPY(input_pose[3], input_pose[4], input_pose[5]);
t.fromMatrix(m * t.toMatrix());
transformed_pose[0] = t.translation.tX;
transformed_pose[1] = t.translation.tY;
transformed_pose[2] = t.translation.tZ;
yarp::sig::Vector rot;
rot = t.getRPYRot();
transformed_pose[3] = rot[0];
transformed_pose[4] = rot[1];
transformed_pose[5] = rot[2];
return true;
}
开发者ID:jgvictores,项目名称:yarp,代码行数:33,代码来源:FrameTransformClient.cpp
示例2: diff
/* Both ds and result should be of the same dimension */
bool TactileData::diff(TactileData &ds, yarp::sig::Vector &result, bool ifAbs)
{
double *data = this->data();
int size = this->size();
//check if dimensions of two DataSample match (though it will be always ;) )
if(ds.size() != size)
{
cout << "Dimensions do not match: " << ds.size() << " " << size << endl;
return false;
}
if(result.size() != size)
{
cout << "WARNING. Dimension of result vector is different. Reset it" << endl;
result.resize(size);
}
if(ifAbs)
{
for(int i = 0; i < size; i++)
{
result[i] = std::fabs(data[i] - ds[i]);
//result.push_back(this->data[i] - ds[i]);
}
}
else
{
for(int i = 0; i < size; i++)
{
result[i] = data[i] - ds[i];
//result.push_back(this->data[i] - ds[i]);
}
}
return true;
}
开发者ID:jizecn,项目名称:my_humanoid_robot,代码行数:36,代码来源:TactileData.cpp
示例3: toiDynTree
bool toiDynTree(const yarp::sig::Vector& yarpVector, VectorDynSize& iDynTreeVector)
{
iDynTreeVector.resize(yarpVector.size());
memcpy(iDynTreeVector.data(),yarpVector.data(),yarpVector.size()*sizeof(double));
return true;
}
开发者ID:mrkjankovic,项目名称:idyntree,代码行数:7,代码来源:YARPConversions.cpp
示例4: YarptoiDynTree
bool YarptoiDynTree(const yarp::sig::Vector & yarpVector, iDynTree::Wrench & iDynTreeWrench)
{
if( yarpVector.size() != 6 ) return false;
memcpy(iDynTreeWrench.getLinearVec3().data(),yarpVector.data(),3*sizeof(double));
memcpy(iDynTreeWrench.getAngularVec3().data(),yarpVector.data()+3,3*sizeof(double));
return true;
}
开发者ID:PerryZh,项目名称:idyntree,代码行数:7,代码来源:yarp_iDynTree.cpp
示例5: iDynTreetoYarp
bool iDynTreetoYarp(const iDynTree::Wrench & iDynTreeWrench,yarp::sig::Vector & yarpVector)
{
if( yarpVector.size() != 6 ) { yarpVector.resize(6); }
memcpy(yarpVector.data(),iDynTreeWrench.getLinearVec3().data(),3*sizeof(double));
memcpy(yarpVector.data()+3,iDynTreeWrench.getAngularVec3().data(),3*sizeof(double));
return true;
}
开发者ID:PerryZh,项目名称:idyntree,代码行数:7,代码来源:yarp_iDynTree.cpp
示例6: eulerAngles
void eulerAngles(const std::vector<yarp::sig::Vector> &edges1,const std::vector<yarp::sig::Vector> &edges2,const std::vector<yarp::sig::Vector> &crossProduct,yarp::sig::Vector &alpha,yarp::sig::Vector &beta,yarp::sig::Vector &gamma)
{
double singamma;
alpha.resize(crossProduct.size(),0.0);
beta.resize(crossProduct.size(),0.0);
gamma.resize(crossProduct.size(),0.0);
for (int i=0; i<crossProduct.size(); i++)
{
double value=crossProduct.at(i)[0];
beta[i]=asin(std::min(abs(value),1.0)*Helpers::sign(value));
if (value==1.0)
alpha[i]=asin(Helpers::sign(edges2.at(i)[2])*std::min(1.0,abs(edges2.at(i)[2])));
else
{
double tmp=crossProduct.at(i)[2]/cos(beta[i]);
alpha[i]=acos(Helpers::sign(tmp)*std::min(1.0,abs(tmp)));
if (Helpers::sign(crossProduct.at(i)[1])!=Helpers::sign(-sin(alpha[i])*cos(beta[i])))
alpha[i]=-alpha[i];
singamma=-edges2.at(i)[0]/cos(beta[i]);
if (edges1.at(i)[0]>=0)
gamma[i]=asin(Helpers::sign(singamma)*std::min(1.0,abs(singamma)));
else
gamma[i]=-M_PI-asin(Helpers::sign(singamma)*std::min(1.0,abs(singamma)));
}
}
}
开发者ID:GiuCotugno,项目名称:grasp,代码行数:26,代码来源:minBoundBox.cpp
示例7: toYarp
/**
* Some helper function for converting between Yarp,KDL and Eigen
* matrix types.
*
*/
bool toYarp(const KDL::Wrench & ft, yarp::sig::Vector & ft_yrp)
{
if( ft_yrp.size() != 6 ) { ft_yrp.resize(6); }
for(int i=0; i < 6; i++ ) {
ft_yrp[i] = ft[i];
}
}
开发者ID:robotology-playground,项目名称:kdl_codyco,代码行数:12,代码来源:main.cpp
示例8: appendMatrixRow
void iCubShoulderConstr::appendMatrixRow(yarp::sig::Matrix &dest,
const yarp::sig::Vector &row)
{
yarp::sig::Matrix tmp;
// if dest is already filled with something
if (dest.rows())
{
// exit if lengths do not match
if (row.length()!=dest.cols())
return;
tmp.resize(dest.rows()+1,dest.cols());
// copy the content of dest in temp
for (int i=0; i<dest.rows(); i++)
for (int j=0; j<dest.cols(); j++)
tmp(i,j)=dest(i,j);
// reassign dest
dest=tmp;
}
else
dest.resize(1,row.length());
// append the last row
for (int i=0; i<dest.cols(); i++)
dest(dest.rows()-1,i)=row[i];
}
开发者ID:apostroph,项目名称:icub-main,代码行数:29,代码来源:iKinIpOpt.cpp
示例9: readEncoders
bool icubFinger::readEncoders(yarp::sig::Vector &encoderValues){
bool ret = false;
encoderValues.resize(3);
encoderValues.zero();
int pendingReads = _fingerEncoders->getPendingReads();
Bottle *handEnc = NULL;
for(int i = 0; i <= pendingReads; i++){
handEnc = _fingerEncoders->read();
}
if(handEnc != NULL)
{
encoderValues[0] = handEnc->get(_proximalEncoderIndex).asDouble();
encoderValues[1] = handEnc->get(_middleEncoderIndex).asDouble();
encoderValues[2] = handEnc->get(_distalEncoderIndex).asDouble();
ret = true;
adjustMinMax(encoderValues[0], _minProximal, _maxProximal);
adjustMinMax(encoderValues[1], _minMiddle, _maxMiddle);
adjustMinMax(encoderValues[2], _minDistal, _maxDistal);
}
//cout << "Encoders: " << encoderValues.toString() << endl;
return ret;
}
开发者ID:tacman-fp7,项目名称:object-surface-exploration,代码行数:30,代码来源:icubFinger.cpp
示例10: read
//ANALOG SENSOR
int GazeboYarpJointSensorsDriver::read(yarp::sig::Vector &out)
{
///< \todo TODO in my opinion the reader should care of passing a vector of the proper dimension to the driver, but apparently this is not the case
/*
if( (int)jointsensors_data.size() != jointsensors_nr_of_channels ||
(int)out.size() != jointsensors_nr_of_channels ) {
return AS_ERROR;
}
*/
if( (int)jointsensors_data.size() != jointsensors_nr_of_channels ) {
return AS_ERROR;
}
if( (int)out.size() != jointsensors_nr_of_channels ) {
std::cout << " GazeboYarpJointSensorsDriver:read() warning : resizing input vector, this can probably be avoided" << std::endl;
out.resize(jointsensors_nr_of_channels);
}
data_mutex.wait();
out = jointsensors_data;
data_mutex.post();
return AS_OK;
}
开发者ID:hu-yue,项目名称:gazebo-yarp-plugins,代码行数:26,代码来源:JointSensorsDriver.cpp
示例11: setHyperparameters
bool LinearMean::setHyperparameters(const yarp::sig::Vector newHyperPar)
{
if (newHyperPar.size()!=this->getNumberOfHyperparameters())
return false;
meanLinearHyperparam=newHyperPar.subVector(0, newHyperPar.size()-2);
meanOffset=newHyperPar(newHyperPar.size()-1);
return true;
}
开发者ID:xufango,项目名称:contrib_bk,代码行数:8,代码来源:LinearMean.cpp
示例12: addContactPoint
void ObjectModelGrid::addContactPoint(const yarp::sig::Vector fingertipPosition){
assert(fingertipPosition.size() == 3);
cout << "Contact position: " << fingertipPosition.toString() << endl;
_contactPoints.push_back(fingertipPosition);
}
开发者ID:tacman-fp7,项目名称:object-surface-exploration,代码行数:8,代码来源:objectModelGrid.cpp
示例13: toEigen
bool toEigen(const yarp::sig::Vector & vec_yrp, Eigen::VectorXd & vec_eigen)
{
if( vec_yrp.size() != vec_eigen.size() ) { vec_eigen.resize(vec_yrp.size()); }
if( memcpy(vec_eigen.data(),vec_yrp.data(),sizeof(double)*vec_eigen.size()) != NULL ) {
return true;
} else {
return false;
}
}
开发者ID:robotology-playground,项目名称:kdl_codyco,代码行数:9,代码来源:main.cpp
示例14: tmp
void iCubShoulderConstr::appendVectorValue(yarp::sig::Vector &dest, double val)
{
yarp::sig::Vector tmp(dest.length()+1);
for (size_t i=0; i<dest.length(); i++)
tmp[i]=dest[i];
dest=tmp;
dest[dest.length()-1]=val;
}
开发者ID:apostroph,项目名称:icub-main,代码行数:9,代码来源:iKinIpOpt.cpp
示例15: getDOF
bool YarpJointDev::getDOF ( yarp::sig::Vector& curDof ) {
curDof.clear();
for ( unsigned i = 0; i < _chain->GetNumberOfJoints(); ++i )
curDof.push_back ( 1 );
return true;
}
开发者ID:jiema,项目名称:NaoYARP,代码行数:10,代码来源:YarpJointDev.cpp
示例16: toYarp
bool toYarp(const iDynTree::Position& iDynTreePosition, yarp::sig::Vector& yarpVector)
{
if( yarpVector.size() != 3 )
{
yarpVector.resize(3);
}
memcpy(yarpVector.data(),iDynTreePosition.data(),3*sizeof(double));
return true;
}
开发者ID:mrkjankovic,项目名称:idyntree,代码行数:10,代码来源:YARPConversions.cpp
示例17: assert
void OpenSoT::tasks::velocity::Postural::setReference(const yarp::sig::Vector &x_desired,
const yarp::sig::Vector &xdot_desired)
{
assert(x_desired.size() == _x_size);
assert(xdot_desired.size() == _x_size);
_x_desired = x_desired;
_xdot_desired = xdot_desired;
this->update_b();
}
开发者ID:bmagyar,项目名称:OpenSoT,代码行数:10,代码来源:Postural.cpp
示例18: controlArm
bool reactCtrlThread::controlArm(const yarp::sig::Vector &_vels)
{
VectorOf<int> jointsToSetA;
VectorOf<int> jointsToSetT;
if (!areJointsHealthyAndSet(jointsToSetA,"arm","velocity"))
{
yWarning("[reactCtrlThread]Stopping control because arm joints are not healthy!");
stopControlHelper();
return false;
}
if (useTorso)
{
if (!areJointsHealthyAndSet(jointsToSetT,"torso","velocity"))
{
yWarning("[reactCtrlThread]Stopping control because torso joints are not healthy!");
stopControlHelper();
return false;
}
}
if (!setCtrlModes(jointsToSetA,"arm","velocity"))
{
yError("[reactCtrlThread]I am not able to set the arm joints to velocity mode!");
return false;
}
if (useTorso)
{
if (!setCtrlModes(jointsToSetT,"torso","velocity"))
{
yError("[reactCtrlThread]I am not able to set the torso joints to velocity mode!");
return false;
}
}
printMessage(1,"Moving the robot with velocities: %s\n",_vels.toString(3,3).c_str());
if (useTorso)
{
Vector velsT(3,0.0);
velsT[0] = _vels[2]; //swapping pitch and yaw as per iKin vs. motor interface convention
velsT[1] = _vels[1];
velsT[2] = _vels[0]; //swapping pitch and yaw as per iKin vs. motor interface convention
ivelT->velocityMove(velsT.data());
ivelA->velocityMove(_vels.subVector(3,9).data()); //indexes 3 to 9 are the arm joints velocities
}
else
{
ivelA->velocityMove(_vels.data()); //if there is not torso, _vels has only the 7 arm joints
}
return true;
}
开发者ID:towardthesea,项目名称:react-control,代码行数:54,代码来源:reactCtrlThread.cpp
示例19: isEqual
bool isEqual(const yarp::sig::Vector& a, const yarp::sig::Vector& b, const double& tolerance)
{
if (a.size() != b.size()) return false;
for (size_t i = 0; i < a.size(); i++)
{
if (fabs(a[i] - b[i]) > tolerance)
{
return false;
}
}
return true;
}
开发者ID:claudiofantacci,项目名称:yarp,代码行数:13,代码来源:IJoypadController.cpp
示例20: sense
void yarp_IMU_interface::sense(yarp::sig::Vector &orientation,
yarp::sig::Vector &linearAcceleration,
yarp::sig::Vector &angularVelocity)
{
this->sense();
orientation.resize(3);
orientation = _output.subVector(0,2);
linearAcceleration.resize(3);
linearAcceleration = _output.subVector(3,5);
angularVelocity.resize(3);
angularVelocity = _output.subVector(6,8);
}
开发者ID:kjyv,项目名称:idynutils,代码行数:13,代码来源:yarp_IMU_interface.cpp
注:本文中的yarp::sig::Vector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论