From 8cdb4cea4d4426b5d2fc1d2bbcf480f268eda281 Mon Sep 17 00:00:00 2001 From: Walter Fetter Lages Date: Wed, 12 Dec 2018 11:57:08 -0200 Subject: [PATCH] Fix bug in context of tree and chain. --- include/pid_plus_gravity_controller/pid_plus_gravity_controller.h | 6 ++++-- src/pid_plus_gravity_controller.cpp | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/pid_plus_gravity_controller/pid_plus_gravity_controller.h b/include/pid_plus_gravity_controller/pid_plus_gravity_controller.h index ff68c3a..a7bac23 100644 --- a/include/pid_plus_gravity_controller/pid_plus_gravity_controller.h +++ b/include/pid_plus_gravity_controller/pid_plus_gravity_controller.h @@ -1,7 +1,7 @@ /****************************************************************************** ROS pid_plus_gravity_controller Package PID+Gravity Compensation Controller - Copyright (C) 2017 Walter Fetter Lages + Copyright (C) 2017,2018 Walter Fetter Lages This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,9 @@ namespace effort_controllers std::vector joints_; ros::Subscriber sub_command_; - + + KDL::Tree tree; + KDL::Chain chain; KDL::ChainDynParam *chainParam_; KDL::JntArray q_; diff --git a/src/pid_plus_gravity_controller.cpp b/src/pid_plus_gravity_controller.cpp index 1d4118c..d522e2e 100644 --- a/src/pid_plus_gravity_controller.cpp +++ b/src/pid_plus_gravity_controller.cpp @@ -80,7 +80,6 @@ namespace effort_controllers return false; } - KDL::Tree tree; if (!kdl_parser::treeFromString(robot_desc_string,tree)) { ROS_ERROR("Failed to construct KDL tree."); @@ -101,7 +100,6 @@ namespace effort_controllers return false; } - KDL::Chain chain; if (!tree.getChain(chainRoot,chainTip,chain)) { ROS_ERROR("Failed to get chain from KDL tree."); -- 2.12.0