本文整理汇总了C++中rl::math::Vector类的典型用法代码示例。如果您正苦于以下问题:C++ Vector类的具体用法?C++ Vector怎么用?C++ Vector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vector类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Metric::clamp(::rl::math::Vector& q) const
{
assert(q.size() == this->getDofPosition());
for (::std::size_t i = 0, j = 0; i < this->joints.size(); j += this->joints[i]->getDofPosition(), ++i)
{
this->joints[i]->clamp(q.segment(j, this->joints[i]->getDofPosition()));
}
}
示例2: assert
void
Metric::clip(::rl::math::Vector& q) const
{
assert(q.size() == this->getDofPosition());
for (::std::size_t i = 0, j = 0; i < this->joints.size(); j += this->joints[i]->getDofPosition(), ++i)
{
::rl::math::Vector qi = q.segment(j, this->joints[i]->getDofPosition()); // TODO
this->joints[i]->clip(qi);
q.segment(j, this->joints[i]->getDofPosition()) = qi; // TODO
}
}
示例3: get
void
LeuzeRs4::getDistances(::rl::math::Vector& distances) const
{
assert(this->isConnected());
assert(distances.size() >= this->getDistancesCount());
const uint8_t* ptr;
if (this->data[3] & 2)
{
ptr = this->data + 5;
if ((this->data[3] & 3) && (this->data[4] & 128))
{
ptr = this->data + 6;
}
}
else
{
ptr = this->data + 4;
}
const uint8_t& number1 = get(ptr);
get(ptr);//bool motion = get(ptr) & 64 ? true : false;
const uint8_t& number2 = get(ptr);
get(ptr);
const uint8_t& number3 = get(ptr);
get(ptr);
const uint8_t& number4 = get(ptr);
get(ptr);
/*int number = */hostEndianDoubleWord(hostEndianWord(number1, number2), hostEndianWord(number3, number4));
int step = get(ptr);
const uint8_t& startHigh = get(ptr);
const uint8_t& startLow = get(ptr);
int start = hostEndianWord(startHigh, startLow);
const uint8_t& stopHigh = get(ptr);
const uint8_t& stopLow = get(ptr);
int stop = hostEndianWord(stopHigh, stopLow);
for (int i = 0; i < (stop - start) / step + 1; ++i)
{
const uint8_t& dataHigh = get(ptr);
const uint8_t& dataLow = get(ptr);
distances(distances.size() - 1 - i) = hostEndianWord(dataHigh, dataLow & 254) / 1000.0f;
}
}
示例4:
void
Model::setPosition(const ::rl::math::Vector& q)
{
if (NULL != this->kin)
{
assert(q.size() == this->kin->getDof());
this->kin->setPosition(q);
}
else
{
assert(q.size() == this->mdl->getDof());
this->mdl->setPosition(q);
}
}
示例5:
void
SickS300::getDistances(::rl::math::Vector& distances) const
{
assert(this->isConnected());
assert(distances.size() >= this->getDistancesCount());
::rl::math::Real scale = 0.01f;
for (::std::size_t i = 0; i < this->getDistancesCount(); ++i)
{
uint16_t value = Endian::hostEndianWord(this->data[24 + 1 + i * 2], this->data[24 + 0 + i * 2]) & 0x1FFF;
switch (this->data[24 + 1 + i * 2] & 224)
{
case 128:
::std::cerr << "Measured value detected within warning field" << ::std::endl;
case 64:
::std::cerr << "Measured value detected within protective field" << ::std::endl;
case 32:
::std::cerr << "Glare (dazzling) detected" << ::std::endl;
distances(i) = ::std::numeric_limits< ::rl::math::Real >::quiet_NaN();
break;
default:
distances(i) = value * scale;
break;
}
}
}
示例6:
DamaSupportSurface::DamaSupportSurface(::std::string _name, ::rl::math::Real _height, const ::rl::math::Vector& _min, const ::rl::math::Vector& _max)
{
this->name = _name;
this->height = _height;
this->dim = _max.size();
this->min = _min;
this->max = _max;
}
示例7:
void
Jr3::getTorques(::rl::math::Vector& torques) const
{
assert(torques.size() >= 3);
for (::std::size_t i = 3; i < 6; ++i)
{
torques(i) = (this->values[i] - this->zeroes[i]) * 1000;
}
}
示例8:
void
Sampler::generateCollisionFree(::rl::math::Vector& q)
{
assert(q.size() == this->model->getDof());
do
{
this->generate(q);
this->model->setPosition(q);
this->model->updateFrames();
}
while (this->model->isColliding());
}
示例9: q
void
Coach::setJointPosition(const ::rl::math::Vector& q)
{
assert(this->getDof() >= q.size());
this->text.clear();
this->text.str("");
this->text << 2;
this->text << " " << this->i;
for (::std::size_t i = 0; i < this->getDof(); ++i)
{
this->text << " " << q(i);
}
this->text << ::std::endl;
}
示例10:
void
MitsubishiH7::setJointPosition(const ::rl::math::Vector& q)
{
assert(q.size() >= this->getDof());
this->out.dat.jnt.j1 = 0;
this->out.dat.jnt.j2 = 0;
this->out.dat.jnt.j3 = 0;
this->out.dat.jnt.j4 = 0;
this->out.dat.jnt.j5 = 0;
this->out.dat.jnt.j6 = 0;
this->out.dat.jnt.j7 = 0;
this->out.dat.jnt.j8 = 0;
switch (this->getDof())
{
case 8:
this->out.dat.jnt.j8 = static_cast<float>(q(7));
case 7:
this->out.dat.jnt.j7 = static_cast<float>(q(6));
case 6:
this->out.dat.jnt.j6 = static_cast<float>(q(5));
case 5:
this->out.dat.jnt.j5 = static_cast<float>(q(4));
case 4:
this->out.dat.jnt.j4 = static_cast<float>(q(3));
case 3:
this->out.dat.jnt.j3 = static_cast<float>(q(2));
case 2:
this->out.dat.jnt.j2 = static_cast<float>(q(1));
case 1:
this->out.dat.jnt.j1 = static_cast<float>(q(0));
default:
break;
}
this->out.command = MXT_COMMAND_MOVE;
this->out.sendType = MXT_TYPE_JOINT;
}
示例11: DeviceException
void
SickLms200::getDistances(::rl::math::Vector& distances) const
{
assert(this->isConnected());
assert(distances.size() >= this->getDistancesCount());
if (this->data[6] & 32)
{
throw DeviceException("partial scan");
}
::rl::math::Real scale;
switch (this->data[6] & 192)
{
case 0:
scale = 0.01f;
break;
case 64:
scale = 0.001f;
break;
default:
throw DeviceException("unknown scale");
break;
}
uint16_t count = Endian::hostEndianWord(this->data[6] & 11, this->data[5]);
uint8_t mask;
switch (this->configuration)
{
case 0x00:
case 0x01:
case 0x02:
mask = 0x1F;
break;
case 0x03:
case 0x04:
case 0x05:
mask = 0x3F;
break;
case 0x06:
mask = 0x7F;
break;
default:
mask = 0x00;
break;
}
uint16_t value;
for (::std::size_t i = 0; i < count; ++i)
{
value = Endian::hostEndianWord(this->data[8 + i * 2] & mask, this->data[7 + i * 2]);
switch (this->configuration)
{
case 0x00:
case 0x01:
case 0x02:
switch (value)
{
case 0x1FFF:
::std::cerr << "Measured value not valid" << ::std::endl;
case 0x1FFE:
::std::cerr << "Dazzling" << ::std::endl;
case 0x1FFD:
::std::cerr << "Operation overflow" << ::std::endl;
case 0x1FFB:
::std::cerr << "Signal-to-noise ratio too small" << ::std::endl;
case 0x1FFA:
::std::cerr << "Error when reading channel 1" << ::std::endl;
distances(i) = ::std::numeric_limits< ::rl::math::Real >::quiet_NaN();
break;
case 0x1FF7:
::std::cerr << "Measured value > Maximum value" << ::std::endl;
distances(i) = ::std::numeric_limits< ::rl::math::Real >::infinity();
break;
default:
distances(i) = value;
distances(i) *= scale;
break;
}
break;
case 0x03:
case 0x04:
case 0x05:
switch (value)
{
case 0x3FFF:
::std::cerr << "Measured value not valid" << ::std::endl;
case 0x3FFE:
::std::cerr << "Dazzling" << ::std::endl;
case 0x3FFD:
::std::cerr << "Operation overflow" << ::std::endl;
case 0x3FFB:
::std::cerr << "Signal-to-noise ratio too small" << ::std::endl;
case 0x3FFA:
::std::cerr << "Error when reading channel 1" << ::std::endl;
//.........这里部分代码省略.........