@@ -3,6 +3,7 @@ import * as React from "react";
33import Connection from "./Connection" ;
44import ExplorePanel from "./ExplorePanel" ;
55import GpsButton from "./GpsButton" ;
6+ import Button from "./Button" ;
67import KeyboardControlPanel from "./KeyboardControlPanel" ;
78import VisualizerWrapper from "./components/VisualizerWrapper" ;
89import LeafletMap from "./components/LeafletMap" ;
@@ -77,6 +78,16 @@ export default function App(): React.ReactElement {
7778 connectionRef . current ?. stopMoveCommand ( ) ;
7879 } , [ ] ) ;
7980
81+ const handleReturnHome = React . useCallback ( ( ) => {
82+ connectionRef . current ?. worldClick ( 0 , 0 ) ;
83+ } , [ ] ) ;
84+
85+ const handleStop = React . useCallback ( ( ) => {
86+ if ( state . robotPose ) {
87+ connectionRef . current ?. worldClick ( state . robotPose . coords [ 0 ] ! , state . robotPose . coords [ 1 ] ! ) ;
88+ }
89+ } , [ state . robotPose ] ) ;
90+
8091 return (
8192 < div style = { { position : "relative" , width : "100%" , height : "100%" } } >
8293 { isGpsMode ? (
@@ -105,6 +116,8 @@ export default function App(): React.ReactElement {
105116 onUseCostmap = { ( ) => setIsGpsMode ( false ) }
106117 > </ GpsButton >
107118 < ExplorePanel onStartExplore = { handleStartExplore } onStopExplore = { handleStopExplore } />
119+ < Button onClick = { handleReturnHome } isActive = { false } > Go Home</ Button >
120+ < Button onClick = { handleStop } isActive = { false } > Stop</ Button >
108121 < KeyboardControlPanel
109122 onSendMoveCommand = { handleSendMoveCommand }
110123 onStopMoveCommand = { handleStopMoveCommand }
0 commit comments