Autoware.Auto
platform_interface.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__PLATFORM_INTERFACE_HPP_
19 #define VEHICLE_INTERFACE__PLATFORM_INTERFACE_HPP_
20 
21 #include <common/types.hpp>
22 #include <autoware_auto_msgs/msg/raw_control_command.hpp>
23 #include <autoware_auto_msgs/msg/vehicle_control_command.hpp>
24 #include <autoware_auto_msgs/msg/vehicle_odometry.hpp>
25 #include <autoware_auto_msgs/msg/vehicle_state_command.hpp>
26 #include <autoware_auto_msgs/msg/vehicle_state_report.hpp>
27 #include <autoware_auto_msgs/srv/autonomy_mode_change.hpp>
28 #include <vehicle_interface/visibility_control.hpp>
29 
30 #include <chrono>
31 
33 
34 using autoware_auto_msgs::msg::RawControlCommand;
36 using autoware_auto_msgs::msg::VehicleStateCommand;
37 using autoware_auto_msgs::msg::VehicleStateReport;
38 using autoware_auto_msgs::msg::VehicleOdometry;
39 using ModeChangeRequest = autoware_auto_msgs::srv::AutonomyModeChange_Request;
40 using ModeChangeResponse = autoware_auto_msgs::srv::AutonomyModeChange_Response;
41 
42 namespace autoware
43 {
44 namespace drivers
45 {
46 namespace vehicle_interface
47 {
48 
53 {
54 public:
56  PlatformInterface() = default;
58  virtual ~PlatformInterface() = default;
59 
67  virtual bool8_t update(std::chrono::nanoseconds timeout) = 0;
73  virtual bool8_t send_state_command(const VehicleStateCommand & msg) = 0;
79  virtual bool8_t send_control_command(const VehicleControlCommand & msg) = 0;
85  virtual bool8_t send_control_command(const RawControlCommand & msg) = 0;
91  virtual bool8_t handle_mode_change_request(ModeChangeRequest::SharedPtr request) = 0;
92 
98  const VehicleStateReport & get_state_report() const noexcept;
101  const VehicleOdometry & get_odometry() const noexcept;
102 
103 protected:
105  VehicleStateReport & state_report() noexcept;
107  VehicleOdometry & odometry() noexcept;
108 
109 private:
110  VehicleStateReport m_state_report{};
111  VehicleOdometry m_odometry{};
112 }; // class PlatformInterface
113 } // namespace vehicle_interface
114 } // namespace drivers
115 } // namespace autoware
116 
117 #endif // VEHICLE_INTERFACE__PLATFORM_INTERFACE_HPP_
autoware::motion::control::pure_pursuit::VehicleControlCommand
autoware_auto_msgs::msg::VehicleControlCommand VehicleControlCommand
Definition: pure_pursuit.hpp:41
types.hpp
This file includes common type definition.
ModeChangeRequest
autoware_auto_msgs::srv::AutonomyModeChange_Request ModeChangeRequest
Definition: ssc_interface.hpp:69
autoware::drivers::vehicle_interface::PlatformInterface
Definition: platform_interface.hpp:52
autoware::common::types::bool8_t
bool bool8_t
Definition: types.hpp:33
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
ModeChangeResponse
autoware_auto_msgs::srv::AutonomyModeChange_Response ModeChangeResponse
Definition: platform_interface.hpp:40
VEHICLE_INTERFACE_PUBLIC
#define VEHICLE_INTERFACE_PUBLIC
Definition: drivers/vehicle_interface/include/vehicle_interface/visibility_control.hpp:44