void UnknownObject::setAllowObjectInteraction(bool allow) { ROS_INFO("Interaction allowed"); allow_object_interaction_ = allow; if (allow_object_interaction_) { addMovementControls(); addRotationControls(); addScaleControls(); menu_handler_.setCheckState(menu_handler_interaction_movement_, MenuHandler::CHECKED); menu_handler_.setCheckState(menu_handler_interaction_rotation_, MenuHandler::CHECKED); menu_handler_.setCheckState(menu_handler_interaction_scale_, MenuHandler::CHECKED); } else { removeMovementControls(); removeRotationControls(); removeScaleControls(); menu_handler_.setCheckState(menu_handler_interaction_movement_, MenuHandler::UNCHECKED); menu_handler_.setCheckState(menu_handler_interaction_rotation_, MenuHandler::UNCHECKED); menu_handler_.setCheckState(menu_handler_interaction_scale_, MenuHandler::UNCHECKED); } server_->insert(object_); menu_handler_.reApply(*server_); server_->applyChanges(); }
void Primitive::updateControls() { if (show_measure_control_) { removeMeasureControl(); addMeasureControl(); } if (show_rotation_control_) { removeRotationControls(); addRotationControls(); } if (show_movement_control_) { removeMovementControls(); addMovementControls(); } if (show_description_control_) { removeDescriptionControl(); addDescriptionControl(); } if (show_scale_control_) { updateScaleControls(); } }
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(); }
void UnknownObject::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); switch (feedback->menu_entry_id) { case 1: /** * Uknown object description */ if (state == MenuHandler::CHECKED) { removeDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 2: /** * Unknown object measure */ if (state == MenuHandler::CHECKED) { removeMeasureControl(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addMeasureControl(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 4: /* * Enable all interaction controls */ addMovementControls(); addRotationControls(); addScaleControls(); menu_handler_.setCheckState(menu_handler_interaction_movement_, MenuHandler::CHECKED); menu_handler_.setCheckState(menu_handler_interaction_rotation_, MenuHandler::CHECKED); menu_handler_.setCheckState(menu_handler_interaction_scale_, MenuHandler::CHECKED); break; case 5: /* * Disable all interaction controls */ removeMovementControls(); removeRotationControls(); removeScaleControls(); menu_handler_.setCheckState(menu_handler_interaction_movement_, MenuHandler::UNCHECKED); menu_handler_.setCheckState(menu_handler_interaction_rotation_, MenuHandler::UNCHECKED); menu_handler_.setCheckState(menu_handler_interaction_scale_, MenuHandler::UNCHECKED); break; case 6: /* * Movement controls */ if (state == MenuHandler::CHECKED) { removeMovementControls(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addMovementControls(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 7: /* * Rotation controls */ if (state == MenuHandler::CHECKED) { removeRotationControls(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addRotationControls(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 8: /* * Scale controls */ if (state == MenuHandler::CHECKED) { removeScaleControls(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addScaleControls(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; } server_->insert(object_); menu_handler_.reApply(*server_); server_->applyChanges(); }