EasyFleet
A simple-by-default framework for multi-robot, multi-capability fleets built on ROS 2
Loading...
Searching...
No Matches
perception_fake_capability.hpp
1// Copyright 2026 Intelligent Robotics Lab
2//
3// This file is part of the project EasyFleet
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#ifndef EASYFLEET_EASYNAV_COLLABORATION_DEPLOYMENT__PERCEPTION_FAKE_CAPABILITY_HPP_
17#define EASYFLEET_EASYNAV_COLLABORATION_DEPLOYMENT__PERCEPTION_FAKE_CAPABILITY_HPP_
18
19#include <random>
20#include <string>
21
22#include "easyfleet_interfaces/action/perception.hpp"
23#include "rclcpp/rclcpp.hpp"
24#include "rclcpp_action/rclcpp_action.hpp"
25#include "rclcpp_lifecycle/lifecycle_node.hpp"
26
27#include "easyfleet_core/capability.hpp"
28#include "easyfleet_core/perception_action_server_base.hpp"
29
30namespace easyfleet_easynav_collaboration_deployment
31{
32
34
53{
54public:
59 rclcpp_lifecycle::LifecycleNode & node,
60 const std::string & action_name);
61
62protected:
68 rclcpp_action::GoalResponse on_goal_received(
69 const rclcpp_action::GoalUUID & uuid,
70 std::shared_ptr<const Goal> goal) override;
71
75 void on_execute(const GoalHandleSharedPtr goal_handle) override;
76
77private:
81 Feedback make_random_detections();
82
83 std::string target_class_;
84 std::string frame_id_;
85 double detection_rate_hz_;
86
87 std::mt19937 random_engine_;
88};
89
93class PerceptionFakeCapability : public easyfleet_core::Capability<PerceptionFakeActionServer>
94{
95public:
98 explicit PerceptionFakeCapability(const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
99};
100
101} // namespace easyfleet_easynav_collaboration_deployment
102
103#endif // EASYFLEET_EASYNAV_COLLABORATION_DEPLOYMENT__PERCEPTION_FAKE_CAPABILITY_HPP_
typename easyfleet_interfaces::action::Perception::Feedback Feedback
Definition action_server_base.hpp:73
std::shared_ptr< GoalHandle > GoalHandleSharedPtr
Definition action_server_base.hpp:79
Lifecycle node that advertises a single action as a "capability".
Definition capability.hpp:65
Fixes ActionServerBase's action type to easyfleet_interfaces/Perception, so a concrete perception bac...
Definition perception_action_server_base.hpp:32
PerceptionFakeActionServer(rclcpp_lifecycle::LifecycleNode &node, const std::string &action_name)
Constructs the action server.
Definition perception_fake_capability.cpp:44
void on_execute(const GoalHandleSharedPtr goal_handle) override
Streams random detections at detection_rate_hz_ until canceled, preempted or shut down.
Definition perception_fake_capability.cpp:120
rclcpp_action::GoalResponse on_goal_received(const rclcpp_action::GoalUUID &uuid, std::shared_ptr< const Goal > goal) override
Accepts only goals asking for the configured target_class_.
Definition perception_fake_capability.cpp:57
PerceptionFakeCapability(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructs the capability node.
Definition perception_fake_capability.cpp:156