EasyFleet
A simple-by-default framework for multi-robot, multi-capability fleets built on ROS 2
Toggle main menu visibility
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_FAKE_COLLABORATION_DEPLOYMENT__PERCEPTION_FAKE_CAPABILITY_HPP_
17
#define EASYFLEET_FAKE_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
30
namespace
easyfleet_fake_collaboration_deployment
31
{
32
34
47
class
PerceptionFakeActionServer
:
public
easyfleet_core::PerceptionActionServerBase
48
{
49
public
:
53
PerceptionFakeActionServer
(
54
rclcpp_lifecycle::LifecycleNode & node,
55
const
std::string & action_name);
56
57
protected
:
63
rclcpp_action::GoalResponse
on_goal_received
(
64
const
rclcpp_action::GoalUUID & uuid,
65
std::shared_ptr<const Goal> goal)
override
;
66
70
void
on_execute
(
const
GoalHandleSharedPtr
goal_handle)
override
;
71
72
private
:
76
Feedback
make_random_detections();
77
78
std::string target_class_;
79
std::string frame_id_;
80
double
detection_rate_hz_;
81
82
std::mt19937 random_engine_;
83
};
84
88
class
PerceptionFakeCapability
:
public
easyfleet_core::Capability
<PerceptionFakeActionServer>
89
{
90
public
:
93
explicit
PerceptionFakeCapability
(
const
rclcpp::NodeOptions & options = rclcpp::NodeOptions());
94
};
95
96
}
// namespace easyfleet_fake_collaboration_deployment
97
98
#endif
// EASYFLEET_FAKE_COLLABORATION_DEPLOYMENT__PERCEPTION_FAKE_CAPABILITY_HPP_
easyfleet_core::ActionServerBase< easyfleet_interfaces::action::Perception >::Feedback
typename easyfleet_interfaces::action::Perception::Feedback Feedback
Definition
action_server_base.hpp:73
easyfleet_core::ActionServerBase< easyfleet_interfaces::action::Perception >::GoalHandleSharedPtr
std::shared_ptr< GoalHandle > GoalHandleSharedPtr
Definition
action_server_base.hpp:79
easyfleet_core::Capability
Lifecycle node that advertises a single action as a "capability".
Definition
capability.hpp:65
easyfleet_core::PerceptionActionServerBase
Fixes ActionServerBase's action type to easyfleet_interfaces/Perception, so a concrete perception bac...
Definition
perception_action_server_base.hpp:32
easyfleet_fake_collaboration_deployment::PerceptionFakeActionServer::PerceptionFakeActionServer
PerceptionFakeActionServer(rclcpp_lifecycle::LifecycleNode &node, const std::string &action_name)
Constructs the action server.
Definition
perception_fake_capability.cpp:44
easyfleet_fake_collaboration_deployment::PerceptionFakeActionServer::on_execute
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
easyfleet_fake_collaboration_deployment::PerceptionFakeActionServer::on_goal_received
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
easyfleet_fake_collaboration_deployment::PerceptionFakeCapability::PerceptionFakeCapability
PerceptionFakeCapability(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructs the capability node.
Definition
perception_fake_capability.cpp:156
easyfleet_example_deployments
easyfleet_fake_collaboration_deployment
include
easyfleet_fake_collaboration_deployment
perception_fake_capability.hpp
Generated by
1.17.0