File tree 2 files changed +53
-0
lines changed
simulator/simple_planning_simulator
system/control_cmd_switcher/tool
2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ rclcpp_components_register_node(${PROJECT_NAME}
29
29
EXECUTABLE ${PROJECT_NAME} _exe
30
30
)
31
31
32
+ install (PROGRAMS
33
+ tool/rely_trajectry.py
34
+ DESTINATION lib/${PROJECT_NAME}
35
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
36
+ )
37
+
32
38
if (BUILD_TESTING)
33
39
ament_add_ros_isolated_gtest(test_simple_planning_simulator
34
40
test /test_simple_planning_simulator.cpp
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ import rclpy
4
+ from rclpy .node import Node
5
+ from autoware_auto_planning_msgs .msg import Trajectory
6
+ import threading
7
+
8
+ class RelayTrajectoryNode (Node ):
9
+
10
+ def __init__ (self ):
11
+ super ().__init__ ('relay_trajectory' )
12
+ self .subscription = self .create_subscription (
13
+ Trajectory ,
14
+ '/tmp/planning/scenario_planning/trajectory' ,
15
+ self .listener_callback ,
16
+ 10 )
17
+ self .publisher = self .create_publisher (Trajectory , '/planning/scenario_planning/trajectory' , 10 )
18
+ self .running = True
19
+
20
+ def listener_callback (self , msg ):
21
+ if self .running :
22
+ self .publisher .publish (msg )
23
+
24
+ def main (args = None ):
25
+ rclpy .init (args = args )
26
+ node = RelayTrajectoryNode ()
27
+
28
+ def input_thread ():
29
+ nonlocal node
30
+ while True :
31
+ user_input = input ("Enter 'y' to stop publishing: " )
32
+ if user_input .lower () == 'y' :
33
+ node .running = False
34
+ print ("Publishing stopped." )
35
+ break
36
+
37
+ thread = threading .Thread (target = input_thread )
38
+ thread .start ()
39
+
40
+ rclpy .spin (node )
41
+
42
+ thread .join ()
43
+ node .destroy_node ()
44
+ rclpy .shutdown ()
45
+
46
+ if __name__ == '__main__' :
47
+ main ()
You can’t perform that action at this time.
0 commit comments