Autoware.Auto
test_ne_raptor_interface_listener.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 
18 
19 #ifndef NE_RAPTOR_INTERFACE__TEST_NE_RAPTOR_INTERFACE_LISTENER_HPP_
20 #define NE_RAPTOR_INTERFACE__TEST_NE_RAPTOR_INTERFACE_LISTENER_HPP_
21 
22 #include <gtest/gtest.h>
23 
25 
26 #include <cmath>
27 #include <cstdint>
28 #include <fstream>
29 #include <memory>
30 
31 namespace autoware
32 {
33 namespace ne_raptor_interface
34 {
35 
37 class NERaptorInterfaceListener : public rclcpp::Node
38 {
39 public:
42  explicit NERaptorInterfaceListener(const rclcpp::NodeOptions & options);
43 
44  // Save received values
45  AcceleratorPedalCmd l_accel_cmd;
46  BrakeCmd l_brake_cmd;
47  GearCmd l_gear_cmd;
48  GlobalEnableCmd l_enable_cmd;
49  MiscCmd l_misc_cmd;
50  SteeringCmd l_steer_cmd;
51  VehicleStateReport l_vehicle_state;
52  VehicleOdometry l_vehicle_odo;
55  // Check whether values were received
68 private:
69  // Subscribers (from Raptor DBW)
70  rclcpp::SubscriptionBase::SharedPtr
71  l_accel_cmd_sub,
72  l_brake_cmd_sub,
73  l_gear_cmd_sub,
74  l_global_enable_cmd_sub,
75  l_misc_cmd_sub,
76  l_steer_cmd_sub,
77  l_dbw_enable_cmd_sub,
78  l_dbw_disable_cmd_sub;
79  // Subscribers (from Autoware.Auto)
80  rclcpp::SubscriptionBase::SharedPtr
81  l_vehicle_state_sub,
82  l_vehicle_odo_sub,
83  l_vehicle_kin_state_sub;
84 
85  // Listener functions
86 
89  void on_accel_cmd(const AcceleratorPedalCmd::SharedPtr & msg);
90 
93  void on_brake_cmd(const BrakeCmd::SharedPtr & msg);
94 
97  void on_gear_cmd(const GearCmd::SharedPtr & msg);
98 
101  void on_global_enable_cmd(const GlobalEnableCmd::SharedPtr & msg);
102 
105  void on_misc_cmd(const MiscCmd::SharedPtr & msg);
106 
109  void on_steer_cmd(const SteeringCmd::SharedPtr & msg);
110 
113  void on_dbw_enable_cmd(const std_msgs::msg::Empty::SharedPtr & msg);
114 
117  void on_dbw_disable_cmd(const std_msgs::msg::Empty::SharedPtr & msg);
118 
121  void on_vehicle_state(const VehicleStateReport::SharedPtr & msg);
122 
125  void on_vehicle_odo(const VehicleOdometry::SharedPtr & msg);
126 
129  void on_vehicle_kin_state(const VehicleKinematicState::SharedPtr & msg);
130 }; // class NERaptorInterfaceListener
131 
132 } // namespace ne_raptor_interface
133 } // namespace autoware
134 
135 #endif // NE_RAPTOR_INTERFACE__TEST_NE_RAPTOR_INTERFACE_LISTENER_HPP_
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_vehicle_odo
VehicleOdometry l_vehicle_odo
Definition: test_ne_raptor_interface_listener.hpp:52
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_brake_cmd
bool8_t l_got_brake_cmd
Definition: test_ne_raptor_interface_listener.hpp:57
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_dbw_disable_cmd
bool8_t l_got_dbw_disable_cmd
Definition: test_ne_raptor_interface_listener.hpp:63
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_global_enable_cmd
bool8_t l_got_global_enable_cmd
Definition: test_ne_raptor_interface_listener.hpp:59
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_gear_cmd
GearCmd l_gear_cmd
Definition: test_ne_raptor_interface_listener.hpp:47
autoware::ne_raptor_interface::NERaptorInterfaceListener::NERaptorInterfaceListener
NERaptorInterfaceListener(const rclcpp::NodeOptions &options)
Default constructor.
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_vehicle_odo
bool8_t l_got_vehicle_odo
Definition: test_ne_raptor_interface_listener.hpp:65
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_gear_cmd
bool8_t l_got_gear_cmd
Definition: test_ne_raptor_interface_listener.hpp:58
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_enable_cmd
GlobalEnableCmd l_enable_cmd
Definition: test_ne_raptor_interface_listener.hpp:48
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_dbw_enable_cmd
bool8_t l_got_dbw_enable_cmd
Definition: test_ne_raptor_interface_listener.hpp:62
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_vehicle_state
VehicleStateReport l_vehicle_state
Definition: test_ne_raptor_interface_listener.hpp:51
ne_raptor_interface
Definition: ne_raptor_interface.launch.py:1
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_steer_cmd
SteeringCmd l_steer_cmd
Definition: test_ne_raptor_interface_listener.hpp:50
autoware::ne_raptor_interface::NERaptorInterfaceListener
Class that listens for messages published while testing NERaptorInterface.
Definition: test_ne_raptor_interface_listener.hpp:37
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_vehicle_state
bool8_t l_got_vehicle_state
Definition: test_ne_raptor_interface_listener.hpp:64
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
ne_raptor_interface.hpp
This file defines the NERaptorInterface class.
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_misc_cmd
MiscCmd l_misc_cmd
Definition: test_ne_raptor_interface_listener.hpp:49
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_vehicle_kin_state
bool8_t l_got_vehicle_kin_state
Definition: test_ne_raptor_interface_listener.hpp:66
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_misc_cmd
bool8_t l_got_misc_cmd
Definition: test_ne_raptor_interface_listener.hpp:60
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_accel_cmd
AcceleratorPedalCmd l_accel_cmd
Definition: test_ne_raptor_interface_listener.hpp:45
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_steer_cmd
bool8_t l_got_steer_cmd
Definition: test_ne_raptor_interface_listener.hpp:61
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_vehicle_kin_state
VehicleKinematicState l_vehicle_kin_state
Definition: test_ne_raptor_interface_listener.hpp:53
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_brake_cmd
BrakeCmd l_brake_cmd
Definition: test_ne_raptor_interface_listener.hpp:46
autoware::trajectory_spoofer::VehicleKinematicState
autoware_auto_vehicle_msgs::msg::VehicleKinematicState VehicleKinematicState
Definition: trajectory_spoofer.hpp:42
autoware::ne_raptor_interface::NERaptorInterfaceListener::l_got_accel_cmd
bool8_t l_got_accel_cmd
Definition: test_ne_raptor_interface_listener.hpp:56