本文整理汇总了C++中Body::devices方法的典型用法代码示例。如果您正苦于以下问题:C++ Body::devices方法的具体用法?C++ Body::devices怎么用?C++ Body::devices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Body
的用法示例。
在下文中一共展示了Body::devices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
virtual bool initialize(SimpleControllerIO* io) override
{
ostream& os = io->os();
Body* body = io->body();
root = io->body()->rootLink();
thrusts << body->devices();
DeviceList<Light> lights(body->devices());
if(!lights.empty()){
light = lights.front();
}
prevLightButtonState = false;
if(!joystick.isReady()){
os << "Joystick is not ready: " << joystick.errorMessage() << endl;
}
if(joystick.numAxes() < 5){
os << "The number of the joystick axes is not sufficient for controlling the robot." << endl;
}
if(joystick.numButtons() < 1){
os << "The number of the joystick buttons is not sufficient for controlling the robot." << endl;
}
return true;
}
示例2: copy
void Body::copy(const Body& org)
{
initialize();
impl->centerOfMass = org.impl->centerOfMass;
impl->mass = org.impl->mass;
impl->name = org.impl->name;
impl->modelName = org.impl->modelName;
impl->info = org.impl->info;
setRootLink(cloneLinkTree(org.rootLink()));
// deep copy of the devices
const DeviceList<>& orgDevices = org.devices();
for(size_t i=0; i < orgDevices.size(); ++i){
const Device& orgDevice = *orgDevices[i];
Device* device = orgDevice.clone();
device->setLink(link(orgDevice.link()->index()));
addDevice(device);
}
// deep copy of the extraJoints
for(size_t i=0; i < org.extraJoints_.size(); ++i){
const ExtraJoint& orgExtraJoint = org.extraJoints_[i];
ExtraJoint extraJoint(orgExtraJoint);
for(int j=0; j < 2; ++j){
extraJoint.link[j] = link(orgExtraJoint.link[j]->index());
}
extraJoints_.push_back(extraJoint);
}
if(org.impl->customizerInterface){
installCustomizer(org.impl->customizerInterface);
}
}