88# You might explicitly import the Request types for clarity, though not strictly necessary
99from autoware_adapi_v1_msgs .srv ._set_route_points import SetRoutePoints_Request
1010from autoware_adapi_v1_msgs .srv ._clear_route import ClearRoute_Request
11+ from geometry_msgs .msg import PoseStamped
1112
1213
1314class RouteNode (Node ):
@@ -17,6 +18,9 @@ class RouteNode(Node):
1718 # These are service names, not topic names. Renamed for clarity.
1819 set_route_points_service_name = "/api/routing/set_route_points"
1920 clear_route_service_name = "/api/routing/clear_route"
21+
22+ goal_topic = '/planning/mission_planning/goal'
23+ checkpoint_topic = '/planning/mission_planning/checkpoint'
2024
2125 def __init__ (self , autoware_state ) -> None :
2226 # Initialize the Node base class with a unique name
@@ -31,6 +35,13 @@ def __init__(self, autoware_state) -> None:
3135 self .clear_route_client = self .create_client (
3236 ClearRoute , self .clear_route_service_name
3337 )
38+
39+ self .goal_publisher = self .create_publisher (
40+ PoseStamped , self .goal_topic , 10
41+ )
42+ self .checkpoint_publisher = self .create_publisher (
43+ PoseStamped , self .checkpoint_topic , 10
44+ )
3445
3546 # Good practice: Wait for the service server to be available before trying to call it
3647 self .get_logger ().info (
@@ -87,6 +98,25 @@ def request_route(self, goal: Pose, waypoints: list[Pose]) -> None:
8798
8899 # Add a callback to process the response when it arrives.
89100 future .add_done_callback (self .set_route_response_callback )
101+
102+ def publish_route (self , goal : Pose , checkpoints : list [Pose ]) -> None :
103+ self ._publish_goal (goal )
104+
105+ for checkpoint in checkpoints :
106+ self ._publish_checkpoint (checkpoint )
107+
108+ def _publish_goal (self , goal ) -> None :
109+ goal = PoseStamped ()
110+ goal .header .stamp = self .node .get_clock ().now ().to_msg ()
111+ goal .pose = goal
112+ self .goal_publisher .publish (goal )
113+
114+
115+ def _publish_checkpoint (self , checkpoint ) -> None :
116+ goal = PoseStamped ()
117+ goal .header .stamp = self .node .get_clock ().now ().to_msg ()
118+ goal .pose = checkpoint
119+ self .checkpoint_publisher .publish (goal )
90120
91121 def set_route_response_callback (self , future ):
92122 """Callback to handle the response from the SetRoutePoints service."""
0 commit comments