Skip to content

Commit

Permalink
add option to show default parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ottojo committed Feb 2, 2024
1 parent 3da38e7 commit d74b422
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/service_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class ServiceWrapper {

void checkForTimeouts();

void setIgnoreDefaultParameters(bool ignoreDefaultParameters);

private:
void threadFunc();
void handleRequest(const RequestPtr &request);
Expand Down
12 changes: 12 additions & 0 deletions src/rig_reconfigure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ int main(int argc, char *argv[]) {

bool shouldResetLayout = false;
bool showInfo = false;
bool ignoreDefaultParameters = true;
serviceWrapper.setIgnoreDefaultParameters(ignoreDefaultParameters);

// Main loop
while (!glfwWindowShouldClose(window)) {
Expand Down Expand Up @@ -295,6 +297,16 @@ int main(int argc, char *argv[]) {
ImGui::EndMenu();
}

if (ImGui::BeginMenu("Parameters")) {
bool propertyChanged = ImGui::MenuItem("Hide default parameters", nullptr, &ignoreDefaultParameters);
serviceWrapper.setIgnoreDefaultParameters(ignoreDefaultParameters);
if (propertyChanged && !curSelectedNode.empty()) {
// Reload parameters if menu item was toggled
serviceWrapper.pushRequest(std::make_shared<Request>(Request::Type::QUERY_NODE_PARAMETERS));
}
ImGui::EndMenu();
}

if (ImGui::BeginMenu("Info")) {
ImGui::MenuItem("Show info", nullptr, &showInfo);
ImGui::EndMenu();
Expand Down
4 changes: 4 additions & 0 deletions src/service_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,7 @@ void ServiceWrapper::parameterModificationResponseReceived(const rclcpp::Client<

responseQueue.push(response);
}

void ServiceWrapper::setIgnoreDefaultParameters(bool ignoreDefaultParameters_) {
this->ignoreDefaultParameters=ignoreDefaultParameters_;
}

0 comments on commit d74b422

Please sign in to comment.