-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
described parameters | applied codeguides
Signed-off-by: Jakub Delicat <[email protected]>
- Loading branch information
Showing
7 changed files
with
177 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
panther_docking/include/panther_docking/dock_pose_publisher_node.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) 2024 Husarion Sp. z o.o. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef PANTHER_DOCKING_DOCK_POSE_PUBLISHER_NODE_HPP_ | ||
#define PANTHER_DOCKING_DOCK_POSE_PUBLISHER_NODE_HPP_ | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include <tf2_ros/buffer.h> | ||
#include <tf2_ros/transform_listener.h> | ||
#include <geometry_msgs/msg/pose_stamped.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp> | ||
|
||
namespace panther_docking | ||
{ | ||
constexpr double kMinimalDetectionDistance = 1.0; | ||
|
||
class DockPosePublisherNode : public rclcpp::Node | ||
{ | ||
public: | ||
DockPosePublisherNode(const std::string & name); | ||
|
||
private: | ||
void publishPose(); | ||
|
||
double timeout_; | ||
std::string target_frame_; | ||
std::vector<std::string> source_frames_; | ||
std::string base_frame_; | ||
rclcpp::Publisher<geometry_msgs::msg::PoseStamped>::SharedPtr pose_publisher_; | ||
std::shared_ptr<tf2_ros::TransformListener> tf_listener_; | ||
std::unique_ptr<tf2_ros::Buffer> tf_buffer_; | ||
rclcpp::TimerBase::SharedPtr timer_; | ||
}; | ||
} // namespace panther_docking | ||
|
||
#endif // PANTHER_DOCKING_DOCK_POSE_PUBLISHER_NODE_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2024 Husarion Sp. z o.o. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include <iostream> | ||
#include <memory> | ||
#include <stdexcept> | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include "panther_docking/dock_pose_publisher_node.hpp" | ||
|
||
int main(int argc, char ** argv) | ||
{ | ||
rclcpp::init(argc, argv); | ||
|
||
auto dock_pose_publisher_node = | ||
std::make_shared<panther_docking::DockPosePublisherNode>("dock_pose_publisher_node"); | ||
|
||
try { | ||
rclcpp::spin(dock_pose_publisher_node); | ||
} catch (const std::runtime_error & e) { | ||
std::cerr << "[" << dock_pose_publisher_node->get_name() << "] Caught exception: " << e.what() | ||
<< std::endl; | ||
} | ||
|
||
std::cout << "[" << dock_pose_publisher_node->get_name() << "] Shutting down" << std::endl; | ||
rclcpp::shutdown(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters