Loading [MathJax]/extensions/tex2jax.js
Autoware.Auto
dbw_state_machine.hpp
Go to the documentation of this file.
1// Copyright 2020 the Autoware Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//    http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
18#ifndef VEHICLE_INTERFACE__DBW_STATE_MACHINE_HPP_
19#define VEHICLE_INTERFACE__DBW_STATE_MACHINE_HPP_
20
21#include <common/types.hpp>
22#include <vehicle_interface/visibility_control.hpp>
23
24#include <experimental/optional>
25#include <cstdint>
26#include <chrono>
27#include <exception>
28#include <iostream>
29#include <memory>
30#include <utility>
31
33
34namespace autoware
35{
36namespace drivers
37{
38namespace vehicle_interface
39 {
40 
41 enum class DbwState
42 {
43  DISABLED = 0,
44  ENABLE_REQUESTED = 1,
45  ENABLE_SENT = 2,
46  ENABLED = 3
47 }; // enum class DbwState
48 
51 {
52 public:
55  explicit DbwStateMachine(uint16_t dbw_disabled_debounce);
57  ~DbwStateMachine() = default;
58 
60  bool8_t enabled() const;
61 
64  DbwState get_state() const;
65 
68  void dbw_feedback(bool8_t enabled);
69 
71  void control_cmd_sent();
72 
74  void state_cmd_sent();
75 
78  void user_request(bool8_t enable);
79 
80 private:
81  bool8_t m_first_control_cmd_sent;
82  bool8_t m_first_state_cmd_sent;
83  uint16_t m_disabled_feedback_count;
84  const uint16_t DISABLED_FEEDBACK_THRESH;
85  DbwState m_state;
86 
87  void disable_and_reset();
88 }; // class DbwStateMachine
89 
90 } // namespace vehicle_interface
91 } // namespace drivers
92 } // namespace autoware
93 
94 #endif // VEHICLE_INTERFACE__DBW_STATE_MACHINE_HPP_
autoware::drivers::vehicle_interface::DbwState::ENABLE_SENT
@ ENABLE_SENT
types.hpp
This file includes common type definition.
autoware::drivers::vehicle_interface::DbwState
DbwState
Definition: dbw_state_machine.hpp:41
autoware::drivers::vehicle_interface::DbwState::ENABLE_REQUESTED
@ ENABLE_REQUESTED
autoware::drivers::vehicle_interface::DbwStateMachine
Class for maintaining the DBW state.
Definition: dbw_state_machine.hpp:50
autoware::common::types::bool8_t
bool bool8_t
Definition: types.hpp:39
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
autoware::drivers::vehicle_interface::DbwState::ENABLED
@ ENABLED
autoware::drivers::vehicle_interface::DbwState::DISABLED
@ DISABLED
VEHICLE_INTERFACE_PUBLIC
#define VEHICLE_INTERFACE_PUBLIC
Definition: drivers/vehicle_interface/include/vehicle_interface/visibility_control.hpp:44