36 lines
927 B
C++
Raw Normal View History

2025-05-14 23:13:28 +08:00
#pragma once
#include <memory>
#include <string>
#include <sstream>
#include "rclcpp/rclcpp.hpp"
#include "gazebo_msgs/srv/spawn_entity.hpp"
#include "cyberdog_marker/srv/place_marker.hpp"
namespace cyberdog
{
namespace marker
{
class MarkerService : public rclcpp::Node
{
public:
explicit MarkerService(const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
~MarkerService() = default;
private:
void handle_place_marker(
const std::shared_ptr<cyberdog_marker::srv::PlaceMarker::Request> request,
std::shared_ptr<cyberdog_marker::srv::PlaceMarker::Response> response);
std::string generate_marker_sdf(const std::string & color, double radius = 0.05);
rclcpp::Service<cyberdog_marker::srv::PlaceMarker>::SharedPtr place_marker_service_;
rclcpp::Client<gazebo_msgs::srv::SpawnEntity>::SharedPtr spawn_entity_client_;
int marker_count_;
};
} // namespace marker
} // namespace cyberdog