Skip to content

Commit

Permalink
feat(controllers): add TF listener and lookup TF helpers in BaseContr…
Browse files Browse the repository at this point in the history
…ollerInterface (#169)
  • Loading branch information
bpapaspyros committed Dec 5, 2024
1 parent f8eed86 commit 222cbc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ class BaseControllerInterface : public controller_interface::ControllerInterface
* if the lookupTransform call failed
* @return If it exists, the requested transform
*/

[[nodiscard]] geometry_msgs::msg::TransformStamped lookup_ros_transform(
const std::string& frame, const std::string& reference_frame, const tf2::TimePoint& time_point,
const tf2::Duration& duration);
Expand Down
7 changes: 7 additions & 0 deletions source/modulo_controllers/src/BaseControllerInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,16 @@ void BaseControllerInterface::add_service(
}

void BaseControllerInterface::add_tf_listener() {
<<<<<<< HEAD
if (!is_node_initialized()) {
throw modulo_core::exceptions::CoreException("Failed to add TF buffer and listener: Node is not initialized yet.");
}
=======
if (this->get_node() == nullptr) {
throw modulo_core::exceptions::CoreException("Failed to add TF buffer and listener: Node is not initialized yet.");
}

>>>>>>> ed20342 (feat(controllers): add TF listener and lookup TF helpers in BaseControllerInterface (#169))
if (this->tf_buffer_ == nullptr || this->tf_listener_ == nullptr) {
RCLCPP_DEBUG(this->get_node()->get_logger(), "Adding TF buffer and listener.");
console_bridge::setLogLevel(console_bridge::CONSOLE_BRIDGE_LOG_NONE);
Expand Down

0 comments on commit 222cbc8

Please sign in to comment.