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(); }
void Plane::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: /* * Plane tag description */ if (state == MenuHandler::CHECKED) { removeDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { description_ = tag_; addDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 3: /* * Plane tag */ tag_ = "Unknown"; updatePublisher_->publishTagChanged(tag_); if (state == MenuHandler::UNCHECKED) { menu_handler_.setCheckState(3, MenuHandler::CHECKED); menu_handler_.setCheckState(4, MenuHandler::UNCHECKED); menu_handler_.setCheckState(5, MenuHandler::UNCHECKED); menu_handler_.setCheckState(6, MenuHandler::UNCHECKED); if (show_description_control_) { removeDescriptionControl(); description_ = tag_; addDescriptionControl(); } } break; case 4: /* * Plane tag */ tag_ = "Wall"; updatePublisher_->publishTagChanged(tag_); if (state == MenuHandler::UNCHECKED) { menu_handler_.setCheckState(3, MenuHandler::UNCHECKED); menu_handler_.setCheckState(4, MenuHandler::CHECKED); menu_handler_.setCheckState(5, MenuHandler::UNCHECKED); menu_handler_.setCheckState(6, MenuHandler::UNCHECKED); if (show_description_control_) { removeDescriptionControl(); description_ = tag_; addDescriptionControl(); } } break; case 5: /* * Plane tag */ tag_ = "Door"; updatePublisher_->publishTagChanged(tag_); if (state == MenuHandler::UNCHECKED) { menu_handler_.setCheckState(3, MenuHandler::UNCHECKED); menu_handler_.setCheckState(4, MenuHandler::UNCHECKED); menu_handler_.setCheckState(5, MenuHandler::CHECKED); menu_handler_.setCheckState(6, MenuHandler::UNCHECKED); if (show_description_control_) { removeDescriptionControl(); description_ = tag_; addDescriptionControl(); } } break; case 6: /* * Plane tag */ tag_ = "Table desk"; updatePublisher_->publishTagChanged(tag_); if (state == MenuHandler::UNCHECKED) { menu_handler_.setCheckState(3, MenuHandler::UNCHECKED); menu_handler_.setCheckState(4, MenuHandler::UNCHECKED); menu_handler_.setCheckState(5, MenuHandler::UNCHECKED); menu_handler_.setCheckState(6, MenuHandler::CHECKED); if (show_description_control_) { removeDescriptionControl(); description_ = tag_; addDescriptionControl(); } } break; } server_->insert(object_); menu_handler_.reApply(*server_); server_->applyChanges(); }
void Billboard::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: /* * Billboard trajectory */ if (state == MenuHandler::CHECKED) { removeTrajectoryControls(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addTrajectoryControls(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 2: /* * Billboard trajectory prediction */ if (state == MenuHandler::CHECKED) { removeTrajectoryPredictionMarkers(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addTrajectoryPredictionMarkers(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; case 3: /* * Billboard description */ if (state == MenuHandler::CHECKED) { removeDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::UNCHECKED); } else { addDescriptionControl(); menu_handler_.setCheckState(handle, MenuHandler::CHECKED); } break; } server_->insert(object_); menu_handler_.reApply(*server_); server_->applyChanges(); }