void BoundingBox::menuCallback(const InteractiveMarkerFeedbackConstPtr &feedback) { MenuHandler::EntryHandle handle = feedback->menu_entry_id; MenuHandler::CheckState state; string title; menu_handler_.getCheckState(handle, state); menu_handler_.getTitle(handle, title); updatePublisher_->publishMenuClicked(title, state); InteractiveMarker o; if (server_->get(name_, o)) { pose_ = o.pose; object_.pose = pose_; } switch (feedback->menu_entry_id) { case 1: /* * Bounding box visibility */ if (state == MenuHandler::CHECKED) { showBoundingBoxControl(false); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { showBoundingBoxControl(true); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 2: /* * Bounding box description */ if (state == MenuHandler::CHECKED) { removeDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 3: /* * Bounding box measure */ if (state == MenuHandler::CHECKED) { removeMeasureControl(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addMeasureControl(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 5: /* * Movement controls */ if (state == MenuHandler::CHECKED) { removeMovementControls(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addMovementControls(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 6: /* * Rotation controls */ if (state == MenuHandler::CHECKED) { removeRotationControls(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addRotationControls(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 8: /* * Take object action */ ROS_INFO("Take object"); break; case 9: /* * Throw object action */ ROS_INFO("Throw object"); break; } server_->insert(object_); menu_handler_.reApply(*server_); server_->applyChanges(); }
void Object::menuCallback(const InteractiveMarkerFeedbackConstPtr &feedback) { MenuHandler::EntryHandle handle = feedback->menu_entry_id; MenuHandler::CheckState state; string title; menu_handler_.getCheckState(handle, state); menu_handler_.getTitle(handle, title); updatePublisher_->publishMenuClicked(title, state); /*InteractiveMarker o; if (server_->get(name_, o)) { pose_ = o.pose; object_.pose = pose_; }*/ switch (feedback->menu_entry_id) { case 1: /* * Object's bounding box visibility */ if (state == MenuHandler::CHECKED) { showBoundingBoxControl(false); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { showBoundingBoxControl(true); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 2: /* * Object's description visibility */ if (state == MenuHandler::CHECKED) { removeDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 3: /* * Object's measure visibility */ if (state == MenuHandler::CHECKED) { removeMeasureControl(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addMeasureControl(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 4: /* * Object's pre-grasp positions visibility */ if (state == MenuHandler::CHECKED) { removePregraspPositions(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addPregraspPositions(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 5: /* * Move arm to pre-grasp position on click */ if (state == MenuHandler::CHECKED) { move_arm_to_pregrasp_onclick_ = false; menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { move_arm_to_pregrasp_onclick_ = true; menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 7: /* * Movement controls */ if (state == MenuHandler::CHECKED) { removeMovementControls(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addMovementControls(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 8: /* * Rotation controls */ if (state == MenuHandler::CHECKED) { removeRotationControls(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addRotationControls(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; } server_->insert(object_); menu_handler_.reApply(*server_); server_->applyChanges(); }