6 int id,
const std::array<float, 4>& color_array,
const eufs_msgs::msg::ConeWithCovariance& cone,
7 std::string name_space =
"recieved_path_from_eufs", std::string frame_id =
"map",
8 std::string shape =
"cylinder",
float scale = 0.5,
9 int action = visualization_msgs::msg::Marker::MODIFY) {
10 visualization_msgs::msg::Marker marker;
12 marker.header.frame_id = frame_id;
13 marker.header.stamp = rclcpp::Clock().now();
14 marker.ns = name_space;
17 marker.action = action;
19 marker.pose.orientation.x = 0.0;
20 marker.pose.orientation.y = 0.0;
21 marker.pose.orientation.z = 0.0;
22 marker.pose.orientation.w = 1.0;
24 marker.pose.position.x = cone.point.x;
25 marker.pose.position.y = cone.point.y;
26 marker.pose.position.z = 0;
28 marker.scale.x = scale;
29 marker.scale.y = scale;
30 marker.scale.z = scale;
32 marker.color.r = color_array[0];
33 marker.color.g = color_array[1];
34 marker.color.b = color_array[2];
35 marker.color.a = color_array[3];
37 marker.lifetime = rclcpp::Duration(std::chrono::duration<double>(5));
42 const eufs_msgs::msg::ConeArrayWithCovariance& cone_array,
43 std::string name_space =
"recieved_path_from_eufs", std::string frame_id =
"map",
44 std::string shape =
"cylinder",
float scale = 0.5,
45 int action = visualization_msgs::msg::Marker::MODIFY) {
46 visualization_msgs::msg::MarkerArray marker_array;
50 for (
auto& c : cone_array.blue_cones) {
53 marker_array.markers.push_back(marker);
58 for (
auto& c : cone_array.yellow_cones) {
61 marker_array.markers.push_back(marker);
66 for (
auto& c : cone_array.orange_cones) {
69 marker_array.markers.push_back(marker);
72 for (
auto& c : cone_array.big_orange_cones) {
75 marker_array.markers.push_back(marker);
84 RCLCPP_INFO(this->get_logger(),
"EUFS using simulated State Estimation");
86 "/odometry_integration/car_state", 10,
90 "/ground_truth/track", 10,
98 "/path_planning/recieved_eufs_map", 10);
101 this->create_client<eufs_msgs::srv::SetCanState>(
"/ros_can/set_mission");
103 this->
eufs_ebs_client_ = this->create_client<eufs_msgs::srv::SetCanState>(
"/ros_can/ebs");
104 RCLCPP_INFO(this->get_logger(),
"Planning: EUFS adapter created");
108 auto mission = msg.ami_state;
115 auto request = std::make_shared<eufs_msgs::srv::SetCanState::Request>();
116 request->ami_state = mission;
117 request->as_state = state;
120 if (rclcpp::spin_until_future_complete(this->get_node_base_interface(), result_future) !=
121 rclcpp::FutureReturnCode::SUCCESS) {
122 RCLCPP_ERROR(this->get_logger(),
"Planning : failed to call mission service");
127 RCLCPP_DEBUG(this->get_logger(),
"Received pose from EUFS");
128 custom_interfaces::msg::Pose pose;
130 pose.x = msg.pose.pose.position.x;
131 pose.y = msg.pose.pose.position.y;
132 pose.theta = atan2(2.0f * (msg.pose.pose.orientation.w * msg.pose.pose.orientation.z +
133 msg.pose.pose.orientation.x * msg.pose.pose.orientation.y),
134 msg.pose.pose.orientation.w * msg.pose.pose.orientation.w +
135 msg.pose.pose.orientation.x * msg.pose.pose.orientation.x -
136 msg.pose.pose.orientation.y * msg.pose.pose.orientation.y -
137 msg.pose.pose.orientation.z * msg.pose.pose.orientation.z);
141void EufsAdapter::finish() { RCLCPP_DEBUG(this->get_logger(),
"Finish undefined for Eufs\n"); }
144 RCLCPP_DEBUG(this->get_logger(),
"Received cones from EUFS");
150 custom_interfaces::msg::ConeArray cones;
151 for (
auto cone : msg.blue_cones) {
152 custom_interfaces::msg::Cone c;
153 c.position.x = cone.point.x;
154 c.position.y = cone.point.y;
155 cones.cone_array.push_back(c);
157 for (
auto cone : msg.yellow_cones) {
158 custom_interfaces::msg::Cone c;
159 c.position.x = cone.point.x;
160 c.position.y = cone.point.y;
161 cones.cone_array.push_back(c);
163 for (
auto cone : msg.orange_cones) {
164 custom_interfaces::msg::Cone c;
165 c.position.x = cone.point.x;
166 c.position.y = cone.point.y;
167 cones.cone_array.push_back(c);
169 for (
auto cone : msg.big_orange_cones) {
170 custom_interfaces::msg::Cone c;
171 c.position.x = cone.point.x;
172 c.position.y = cone.point.y;
173 cones.cone_array.push_back(c);
175 for (
auto cone : msg.unknown_color_cones) {
176 custom_interfaces::msg::Cone c;
177 c.position.x = cone.point.x;
178 c.position.y = cone.point.y;
179 cones.cone_array.push_back(c);
rclcpp::Publisher< visualization_msgs::msg::MarkerArray >::SharedPtr eufs_map_publisher_
void set_mission_state(int mission, int state)
rclcpp::Client< eufs_msgs::srv::SetCanState >::SharedPtr eufs_ebs_client_
rclcpp::Client< eufs_msgs::srv::SetCanState >::SharedPtr eufs_mission_state_client_
void map_callback(const eufs_msgs::msg::ConeArrayWithCovariance &msg)
void finish() final
Function that sends the finish signal to the respective node.
void mission_state_callback(const eufs_msgs::msg::CanState &msg) const
rclcpp::Subscription< eufs_msgs::msg::CarState >::SharedPtr eufs_pose_subscription_
void pose_callback(const eufs_msgs::msg::CarState &msg)
rclcpp::Subscription< eufs_msgs::msg::ConeArrayWithCovariance >::SharedPtr eufs_map_subscription_
rclcpp::Subscription< eufs_msgs::msg::CanState >::SharedPtr eufs_state_subscription_
Responsible for path planning and trajectory generation for the autonomous vehicle.
void track_map_callback(const custom_interfaces::msg::ConeArray &message)
Callback for track map updates.
void vehicle_localization_callback(const custom_interfaces::msg::Pose &message)
Callback for vehicle localization pose updates.
std::string map_frame_id_
void set_mission(Mission mission)
Sets the mission type for planning execution.
PlanningConfig planning_config_
const std::map< std::string, std::array< float, 4 >, std::less<> > & marker_color_map()
const std::map< std::string, int, std::less<> > & marker_shape_map()
const std::unordered_map< unsigned short, Mission > eufs_to_system
visualization_msgs::msg::MarkerArray marker_array_from_cone_array_w_covariance(const eufs_msgs::msg::ConeArrayWithCovariance &cone_array, std::string name_space="recieved_path_from_eufs", std::string frame_id="map", std::string shape="cylinder", float scale=0.5, int action=visualization_msgs::msg::Marker::MODIFY)
visualization_msgs::msg::Marker marker_from_cone_w_covariance(int id, const std::array< float, 4 > &color_array, const eufs_msgs::msg::ConeWithCovariance &cone, std::string name_space="recieved_path_from_eufs", std::string frame_id="map", std::string shape="cylinder", float scale=0.5, int action=visualization_msgs::msg::Marker::MODIFY)