本文整理汇总了C++中yarp::sig::Vector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector::size方法的具体用法?C++ Vector::size怎么用?C++ Vector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yarp::sig::Vector
的用法示例。
在下文中一共展示了Vector::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
}
示例5: 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();
}
示例6: 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;
}
示例7: setWeightsStandardDeviation
void MultiTaskLinearGPRLearner::setWeightsStandardDeviation(const yarp::sig::Vector& s) {
if( s.size() != this->getDomainCols() ) {
throw std::runtime_error("MultiTaskLinearGPRLearner: wrong dimension of noise std deviation");
}
inv_Sigma_w = zeros(this->getDomainCols(),this->getDomainCols());
for(unsigned i=0; i < s.size(); i++ ) {
inv_Sigma_w(i,i) = 1/(s[i]*s[i]);
}
this->weight_prior_indefinite = false;
this->reset();
}
示例8: yarpToEigenVector
//---------------------------------------------------------
bool yarpToEigenVector(const yarp::sig::Vector &yarpVector, Eigen::VectorXd &eigenVector)
{
if(yarpVector.size() == 0)
{
cout<<"ERROR: input vector is empty (yarpToEigenVector)"<<endl;
return false;
}
//resize and fill eigen vector with yarp vector elements
eigenVector.resize(yarpVector.size());
for(unsigned int i = 0; i < yarpVector.size(); i++)
eigenVector(i) = yarpVector(i);
return true;
};
示例9: 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];
}
}
示例10: 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;
}
示例11: setReferenceSpeeds
bool RobotUtils::setReferenceSpeeds(const yarp::sig::Vector &maximum_velocity)
{
assert(maximum_velocity.size() == this->getNumberOfJoints());
if(!bodyIsInPositionMode()) {
std::cout << "Trying to set reference speeds for the whole coman "
<< "but the robot is not entirely in Position Mode";
return false;
}
yarp::sig::Vector velocity_torso,
velocity_right_arm,
velocity_left_arm,
velocity_right_leg,
velocity_left_leg,
velocity_head;
idynutils.fromIDynToRobot(maximum_velocity, velocity_torso, idynutils.torso);
idynutils.fromIDynToRobot(maximum_velocity, velocity_right_arm, idynutils.right_arm);
idynutils.fromIDynToRobot(maximum_velocity, velocity_left_arm, idynutils.left_arm);
idynutils.fromIDynToRobot(maximum_velocity, velocity_right_leg, idynutils.right_leg);
idynutils.fromIDynToRobot(maximum_velocity, velocity_left_leg, idynutils.left_leg);
if(head.isAvailable) idynutils.fromIDynToRobot(maximum_velocity, velocity_head, idynutils.head);
return torso.setReferenceSpeeds(velocity_torso) &&
right_arm.setReferenceSpeeds(velocity_right_arm) &&
left_arm.setReferenceSpeeds(velocity_left_arm) &&
right_leg.setReferenceSpeeds(velocity_right_leg) &&
left_leg.setReferenceSpeeds(velocity_left_leg) &&
(head.isAvailable || head.setReferenceSpeeds(velocity_head));
}
示例12: 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;
}
示例13: 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;
}
示例14: 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;
}
示例15: addContactPoint
void ObjectModelGrid::addContactPoint(const yarp::sig::Vector fingertipPosition){
assert(fingertipPosition.size() == 3);
cout << "Contact position: " << fingertipPosition.toString() << endl;
_contactPoints.push_back(fingertipPosition);
}