Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
port_drayage_state_machine.hpp
Go to the documentation of this file.
1#pragma once
2
3/*
4 * Copyright (C) 2020-2022 LEIDOS.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 * use this file except in compliance with the License. You may obtain a copy of
8 * the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 * License for the specific language governing permissions and limitations under
16 * the License.
17 */
18
19#include <rclcpp/rclcpp.hpp>
20#include <functional>
21
22namespace port_drayage_plugin
23{
37 {
42 };
43
56 {
61 };
62
72 {
73 private:
75 std::function<void()> on_system_startup_;
76 std::function<void()> on_received_new_destination_;
77 std::function<void()> on_arrived_at_destination_;
78 std::function<void()> on_drayage_completed_;
79
80 // Logger interface for this object
81 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger_;
82
83 public:
89 PortDrayageStateMachine(rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger) :
90 logger_(logger),
92
99
105
111 void setOnSystemStartupCallback(const std::function<void()> &cb);
112
118 void setOnReceivedNewDestinationCallback(const std::function<void()> &cb);
119
125 void setOnArrivedAtDestinationCallback(const std::function<void()> &cb);
126
132 void setOnDrayageCompletedCallback(const std::function<void()> &cb);
133 };
134} // namespace port_drayage_plugin
void setOnDrayageCompletedCallback(const std::function< void()> &cb)
Set the callback to be invoked upon transitioning into the inactive state.
void setOnArrivedAtDestinationCallback(const std::function< void()> &cb)
Set the callback to be invoked upon transitioning into the AWAITING_DESTINATION state.
void setOnReceivedNewDestinationCallback(const std::function< void()> &cb)
Set the callback to be invoked upon transitioning into the EN_ROUTE state.
void setOnSystemStartupCallback(const std::function< void()> &cb)
Set the callback to be invoked upon transitioning out of the inactive state.
PortDrayageStateMachine(rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger)
Constructor the PortDrayageStateMachine.
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger_
PortDrayageState getState() const
Get the current state of the state machine.
PortDrayageEvent
Enum containing the event values that cause changes in the PortDrayagePlugin state machine.
PortDrayageState
Enum containing the possible state values for the PortDrayagePlugin.