open-rmf / rmf

Root repository for the RMF software
Apache License 2.0
223 stars 58 forks source link

How does the dock method call exactly work? #310

Closed TheConstructAi closed 1 year ago

TheConstructAi commented 1 year ago

Discussed in https://github.com/open-rmf/rmf/discussions/309

Originally posted by **TheConstructAi** February 9, 2023 Hi, I'm would like to know exactly whats the pipeline of execution when a robot reaches a waypoint an triggers the `dock()` methods of the fleet RobotHandler of the adapter. Because By default, is seem that every time that method is called, when it finishes it: * Sends a navigation goal to the previous waypoint * The planner robot position ( the yellow circle ) doesn't update to the position of the robot where it finished the dock). ![dockissue](https://user-images.githubusercontent.com/80715513/217871511-ff61958a-f029-4441-844b-19a32221c95a.gif) Is there any procedure it has to be done to update the robot's position to rmf? Why is it sending a goal after in theory doing the dock? Why doesn't i't send a goal to the end waypoint anyway? That would be at least understandable. Am I missing something here? I know its a recurring question but its not still clear how a correct dock has to be done without essentially tricking the handler to NOt send goals after docking. Do we have to deal with the docking as a cleaning process? Because at least there it finishes on the right place and with the planner location ( yellow circle) on the correct spot. Maybe we have to update the position where the docking procedure ends in some way, although not sure how to tell rmf? Here you have a snipet of the dock method simplified for this. But the behaviors is exactly the same with the default adapter template code: ``` def dock(self, dock_name, docking_finished_callback): """Start thread to invoke docking , then notify rmf_core.""" self.node.get_logger().info("################ DOCK DOCK DOCK #################") self.stop() self.rmf_docking_requested = True self.rmf_docking_executed = False def dock_closure(): self.node.get_logger().info( f"Requesting robot {self.name} to dock at =={dock_name}==") result, info = self.api.start_process( self.name, dock_name, self.map_name) self.node.get_logger().info( "Dock Handler Response:"+str(result)) if not result: self.node.get_logger().error( "ERROR IN START PROCESS DOCK="+str(info)) self.rmf_docking_requested = False self.rmf_docking_executed = False # Check for docking complete! while self.rmf_docking_requested: dock_current_status = self.api.dock_status_get(self.name) self.rmf_docking_executed = dock_current_status == "DOCKED" self.node.get_logger().info("dock_current_status===>"+str(dock_current_status)) # Docking completed if self.rmf_docking_executed: self.rmf_docking_requested = False docking_finished_callback() self.node.get_logger().info( f'[COMPLETE] Completed dock at: "{dock_name}"!' ) return # Docking pre-empted if self._docking_quit_event.is_set(): self.rmf_docking_requested = False self.rmf_docking_executed = False self.clear() self.node.get_logger().info( f'[ABORT] Pre-empted dock at: "{dock_name}"!' ) return self._docking_quit_cv.acquire() self._docking_quit_cv.wait(1) self._docking_quit_cv.release() self._docking_quit_event.clear() if self._docking_thread is not None: self._docking_thread.join() self._docking_thread = threading.Thread(target=dock_closure) self._docking_thread.start() ```
Yadunund commented 1 year ago

Answered https://github.com/open-rmf/fleet_adapter_template/issues/19#issuecomment-1531817107