@@ -991,6 +991,44 @@ export class ROS2CommandCentreClient {
991991 console . log ( 'Rover launch completed successfully' ) ;
992992 }
993993
994+ /**
995+ * Restart autonomous navigation without waypoints
996+ * Used when returning to autonomous mode after manual control
997+ */
998+ async restartAutonomousNavigation ( ) : Promise < void > {
999+ // Set navigation state
1000+ this . _isNavigating = true ;
1001+ this . notifyStateChange ( ) ;
1002+
1003+ // Send the LaunchRover command without waypoints
1004+ await this . sendCommand ( {
1005+ type : 'LaunchRover' ,
1006+ params : {
1007+ waypoint_count : 0 ,
1008+ launch_mode : 'autonomous'
1009+ }
1010+ } ) ;
1011+
1012+ console . log ( 'Waiting for autonomous navigation nodes to restart...' ) ;
1013+
1014+ // Wait for required nodes to be running (based on Python autonomous_nodes)
1015+ const requiredNodes = [ 'gps' , 'obstacle_detection' , 'auto_nav' , 'serial_motor_imu' , 'usb_camera' , 'csi_camera_1' , 'csi_camera_2' ]
1016+ const nodesStarted = await this . waitForNodesRunning ( requiredNodes , 45000 ) ; // 45 second timeout
1017+
1018+ if ( ! nodesStarted ) {
1019+ console . error ( 'Failed to restart all required nodes for autonomous navigation' ) ;
1020+ this . _isNavigating = false ;
1021+ this . notifyStateChange ( ) ;
1022+ throw new Error ( 'Required nodes failed to restart for autonomous navigation' ) ;
1023+ }
1024+
1025+ console . log ( 'Autonomous navigation restarted successfully' ) ;
1026+
1027+ // Store required nodes and start health monitoring
1028+ this . _requiredNodes = requiredNodes ;
1029+ this . startNodeHealthCheck ( ) ;
1030+ }
1031+
9941032 /**
9951033 * Switch to manual control mode
9961034 */
0 commit comments