From ddb237cbeb281dd8135ceb0b19c981ecf5acf9b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Thu, 23 Mar 2023 23:45:49 +0100 Subject: [PATCH 1/2] Initialize services in constructor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- src/gui/plugins/view_angle/ViewAngle.cc | 27 +++++++------------------ 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/gui/plugins/view_angle/ViewAngle.cc b/src/gui/plugins/view_angle/ViewAngle.cc index fafcd3c6aa..cab598d90f 100644 --- a/src/gui/plugins/view_angle/ViewAngle.cc +++ b/src/gui/plugins/view_angle/ViewAngle.cc @@ -57,19 +57,21 @@ namespace gz::sim public: std::mutex mutex; /// \brief View Control service name - public: std::string viewControlService; + public: std::string viewControlService = "/gui/camera/view_control"; /// \brief View Control reference visual service name - public: std::string viewControlRefVisualService; + public: std::string viewControlRefVisualService = + "/gui/camera/view_control/reference_visual"; /// \brief View Control sensitivity service name - public: std::string viewControlSensitivityService; + public: std::string viewControlSensitivityService = + "/gui/camera/view_control/sensitivity"; /// \brief Move gui camera to pose service name - public: std::string moveToPoseService; + public: std::string moveToPoseService = "/gui/move_to/pose"; /// \brief Move gui camera to model service name - public: std::string moveToModelService; + public: std::string moveToModelService = "/gui/move_to/model"; /// \brief New move to model message public: bool newMoveToModel = false; @@ -144,27 +146,12 @@ void ViewAngle::LoadConfig(const tinyxml2::XMLElement *) if (this->title.empty()) this->title = "View Angle"; - // view control requests - this->dataPtr->viewControlService = "/gui/camera/view_control"; - - // view control reference visual requests - this->dataPtr->viewControlRefVisualService = - "/gui/camera/view_control/reference_visual"; - - // view control sensitivity requests - this->dataPtr->viewControlSensitivityService = - "/gui/camera/view_control/sensitivity"; - // Subscribe to camera pose std::string topic = "/gui/camera/pose"; this->dataPtr->node.Subscribe( topic, &ViewAngle::CamPoseCb, this); - // Move to pose service - this->dataPtr->moveToPoseService = "/gui/move_to/pose"; - // Move to model service - this->dataPtr->moveToModelService = "/gui/move_to/model"; this->dataPtr->node.Advertise(this->dataPtr->moveToModelService, &ViewAngle::OnMoveToModelService, this); gzmsg << "Move to model service on [" From 44bd40aa1ed60e248c64d53c46b8dfd0319bc87c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Thu, 23 Mar 2023 23:52:24 +0100 Subject: [PATCH 2/2] Tweak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- src/gui/plugins/view_angle/ViewAngle.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/plugins/view_angle/ViewAngle.cc b/src/gui/plugins/view_angle/ViewAngle.cc index cab598d90f..d18af02b68 100644 --- a/src/gui/plugins/view_angle/ViewAngle.cc +++ b/src/gui/plugins/view_angle/ViewAngle.cc @@ -64,7 +64,7 @@ namespace gz::sim "/gui/camera/view_control/reference_visual"; /// \brief View Control sensitivity service name - public: std::string viewControlSensitivityService = + public: std::string viewControlSensitivityService = "/gui/camera/view_control/sensitivity"; /// \brief Move gui camera to pose service name