18 #ifndef LGSVL_INTERFACE__LGSVL_INTERFACE_HPP_ 19 #define LGSVL_INTERFACE__LGSVL_INTERFACE_HPP_ 23 #include <autoware_auto_msgs/msg/raw_control_command.hpp> 24 #include <autoware_auto_msgs/msg/vehicle_kinematic_state.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> 29 #include <lgsvl_msgs/msg/vehicle_odometry.hpp> 30 #include <lgsvl_msgs/msg/can_bus_data.hpp> 31 #include <lgsvl_msgs/msg/vehicle_control_data.hpp> 32 #include <lgsvl_msgs/msg/vehicle_state_data.hpp> 34 #include <geometry_msgs/msg/pose_with_covariance_stamped.hpp> 35 #include <nav_msgs/msg/odometry.hpp> 36 #include <tf2_msgs/msg/tf_message.hpp> 39 #include <rclcpp/rclcpp.hpp> 42 #include <tf2_ros/transform_listener.h> 43 #include <tf2_ros/buffer.h> 48 #include <unordered_map> 67 constexpr
static int32_t
COV_X = 0;
68 constexpr
static int32_t
COV_Y = 7;
69 constexpr
static int32_t
COV_Z = 14;
70 constexpr
static int32_t
COV_RX = 21;
71 constexpr
static int32_t
COV_RY = 28;
72 constexpr
static int32_t
COV_RZ = 35;
78 using VSC = autoware_auto_msgs::msg::VehicleStateCommand;
79 using VSD = lgsvl_msgs::msg::VehicleStateData;
93 const std::string & sim_cmd_topic,
94 const std::string & sim_state_cmd_topic,
95 const std::string & sim_state_report_topic,
96 const std::string & sim_nav_odom_topic,
97 const std::string & sim_veh_odom_topic,
98 const std::string & kinematic_state_topic,
99 const std::string & sim_odom_child_frame,
103 bool publish_tf = NO_PUBLISH,
104 bool publish_pose = PUBLISH);
109 bool update(std::chrono::nanoseconds timeout)
override;
112 bool send_state_command(
const autoware_auto_msgs::msg::VehicleStateCommand & msg)
override;
117 bool send_control_command(
const autoware_auto_msgs::msg::RawControlCommand & msg)
override;
119 bool handle_mode_change_request(
120 autoware_auto_msgs::srv::AutonomyModeChange_Request::SharedPtr request)
override;
124 static const std::unordered_map<WIPER_TYPE, WIPER_TYPE> autoware_to_lgsvl_wiper;
125 static const std::unordered_map<GEAR_TYPE, GEAR_TYPE> autoware_to_lgsvl_gear;
126 static const std::unordered_map<MODE_TYPE, MODE_TYPE> autoware_to_lgsvl_mode;
132 void on_state_report(
const autoware_auto_msgs::msg::VehicleStateReport & msg);
134 rclcpp::Publisher<lgsvl_msgs::msg::VehicleControlData>::SharedPtr m_cmd_pub{};
135 rclcpp::Publisher<lgsvl_msgs::msg::VehicleStateData>::SharedPtr m_state_pub{};
136 rclcpp::Publisher<autoware_auto_msgs::msg::VehicleKinematicState>::SharedPtr
137 m_kinematic_state_pub{};
138 rclcpp::Publisher<tf2_msgs::msg::TFMessage>::SharedPtr m_tf_pub{};
139 rclcpp::Publisher<geometry_msgs::msg::PoseWithCovarianceStamped>::SharedPtr m_pose_pub{};
140 rclcpp::Subscription<nav_msgs::msg::Odometry>::SharedPtr m_nav_odom_sub{};
141 rclcpp::Subscription<lgsvl_msgs::msg::CanBusData>::SharedPtr m_state_sub{};
142 rclcpp::Subscription<lgsvl_msgs::msg::VehicleOdometry>::SharedPtr m_veh_odom_sub{};
143 rclcpp::TimerBase::SharedPtr m_nav_base_tf_timer{};
150 std::shared_ptr<tf2_ros::Buffer> m_tf_buffer;
151 std::shared_ptr<tf2_ros::TransformListener> m_tf_listener;
153 bool m_nav_base_tf_set{
false};
156 bool m_odom_set{
false};
157 geometry_msgs::msg::Vector3 m_odom_zero{};
159 rclcpp::Logger m_logger;
164 #endif // LGSVL_INTERFACE__LGSVL_INTERFACE_HPP_ static constexpr double COV_Y_VAR
Definition: lgsvl_interface.hpp:60
static constexpr int32_t COV_Z
Definition: lgsvl_interface.hpp:69
autoware_auto_msgs::msg::VehicleKinematicState VehicleKinematicState
Definition: trajectory_spoofer.hpp:44
static constexpr double COV_Z_VAR
Definition: lgsvl_interface.hpp:61
Definition: lgsvl_interface.hpp:51
#define LGSVL_INTERFACE_PUBLIC
Definition: drivers/lgsvl_interface/include/lgsvl_interface/visibility_control.hpp:46
autoware_auto_msgs::msg::VehicleStateCommand VSC
Definition: lgsvl_interface.hpp:78
static constexpr int32_t COV_RY
Definition: lgsvl_interface.hpp:71
static constexpr int32_t COV_RZ
Definition: lgsvl_interface.hpp:72
constexpr bool NO_PUBLISH
Definition: lgsvl_interface.hpp:75
static constexpr int32_t COV_X
Definition: lgsvl_interface.hpp:67
Definition: lgsvl_interface.hpp:87
autoware_auto_msgs::msg::VehicleControlCommand VehicleControlCommand
Definition: pure_pursuit.hpp:41
static constexpr double COV_RY_VAR
Definition: lgsvl_interface.hpp:63
decltype(VSC::mode) MODE_TYPE
Definition: lgsvl_interface.hpp:82
static constexpr int32_t COV_Y
Definition: lgsvl_interface.hpp:68
static constexpr int32_t COV_RX
Definition: lgsvl_interface.hpp:70
decltype(VSC::wiper) WIPER_TYPE
Definition: lgsvl_interface.hpp:80
constexpr bool PUBLISH
Definition: lgsvl_interface.hpp:74
static constexpr double COV_RZ_VAR
Definition: lgsvl_interface.hpp:64
static constexpr double COV_X_VAR
Definition: lgsvl_interface.hpp:59
This file contains a 1D linear lookup table implementation.
decltype(VSC::gear) GEAR_TYPE
Definition: lgsvl_interface.hpp:81
static constexpr double COV_RX_VAR
Definition: lgsvl_interface.hpp:62
lgsvl_msgs::msg::VehicleStateData VSD
Definition: lgsvl_interface.hpp:79
autoware_auto_msgs::msg::VehicleOdometry Odometry
Definition: safety_state_machine.hpp:43