| 364 | } |
| 365 | |
| 366 | void OPTCalibration::convertToWorldFrame() |
| 367 | { |
| 368 | for (size_t i = 0; i < node_vec_.size(); ++i) |
| 369 | { |
| 370 | const TreeNode & sensor_node = *node_vec_[i]; |
| 371 | cb::Pose pose = sensor_node.sensor()->pose(); |
| 372 | cb::BaseObject::ConstPtr parent = sensor_node.sensor()->parent(); |
| 373 | |
| 374 | while (parent->parent()) |
| 375 | { |
| 376 | pose = parent->pose() * pose; |
| 377 | parent = parent->parent(); |
| 378 | sensor_node.sensor()->setParent(parent); |
| 379 | sensor_node.sensor()->setPose(pose); |
| 380 | } |
| 381 | |
| 382 | //ROS_INFO_STREAM(std::endl << sensor_node.sensor()->pose().matrix()); |
| 383 | } |
| 384 | |
| 385 | for (size_t i = checkerboard_vec_.size(); i < view_map_vec_.size(); ++i) |
| 386 | { |
| 387 | ViewMap & view_map = view_map_vec_[i]; |
| 388 | |
| 389 | ViewMap::iterator it = view_map.begin(); |
| 390 | bool ok = false; |
| 391 | while (not ok and it != view_map.end()) |
| 392 | { |
| 393 | if (it->first->type() == TreeNode::DEPTH) |
| 394 | ++it; |
| 395 | else |
| 396 | ok = true; |
| 397 | } |
| 398 | |
| 399 | const CheckerboardView::Ptr & cb_view = it->second; |
| 400 | const TreeNode::Ptr & sensor_node = it->first; |
| 401 | |
| 402 | cb::Checkerboard::Ptr cb = boost::make_shared<cb::Checkerboard>(*boost::static_pointer_cast<cb::Checkerboard>(cb_view->object)); |
| 403 | |
| 404 | cb::BaseObject::ConstPtr parent = sensor_node->sensor(); |
| 405 | while (parent->parent()) |
| 406 | { |
| 407 | cb->transform(parent->pose()); |
| 408 | parent = parent->parent(); |
| 409 | } |
| 410 | cb->setParent(parent); |
| 411 | |
| 412 | checkerboard_vec_.push_back(cb); |
| 413 | is_floor_vec_.push_back(cb_view->is_floor); |
| 414 | |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | class RootPinholeError |
| 419 | { |