Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 12, No. 1, 2025 216 Research on Navigation of Smart Robots in Gerocomium Based on DWA Xiaotao Wang, Hongyan Zhang *, Huijie Liu, Renjie Sun, Haitao Zhang School of Mechanical and Electrical Engineering, Jilin Institute of Chemical Technology, Jilin Jilin, 132022, China * Corresponding author: Hongyan Zhang Abstract: The elderly moving slowly in the gerocomium and the staff going back and forth to the pharmacy will all become obstacles in the navigation path of the intelligent robot in the gerocomium. In scenarios with significant changes in lighting intensity, the robot may encounter problems such as path positioning loss and incorrect path planning. Facing the above challenges, this paper proposes two innovative ideas to optimize the DWA algorithm: (1) For the first time, it is proposed to combine the face detection based on YOLOv8 with DWA, and a new face attraction term is added. A radius threshold is set around the face. If the distance between the robot and the face is less than this value, an obstacle avoidance penalty term will be increased. (2) Dynamically adjust the cost function of DWA, and optimize the smoothness and safety of the DWA navigation path by combining the newly added face attraction term and the safety distance constraint. Adaptive weight allocation is introduced into the improved DWA to balance the safe distance between the robot and the elderly when they are close, the timeliness of the robot avoiding the slowly moving elderly, and the smoothness of the robot's navigation path. Finally, the environment of the gerocomium is simulated in a laboratory environment for experimental testing. The results show that, compared with the traditional DWA, the navigation success rate of the optimized DWA is increased by 21.5% (from 70.5% to 93.5%), the minimum safety distance is increased by 53.7% (from 0.37m to 0.72m), and the smoothness of the navigation path is increased by 71%. This method provides a more secure, efficient and powerful guarantee for the navigation of robots in gerocomiums. Keywords: L Multimodal Perception; Safety Distance Constraint; YOLOv8; Dynamically Adjust the DWA Cost Function; Face Attraction Term. 1. Introduction With the increasing severity of global aging, the application of intelligent robots in gerocomiums in the elderly care market is becoming more and more widespread. At the same time, the problems faced by these intelligent robots in gerocomiums have also become more prominent. The autonomous navigation algorithms of robots in gerocomiums are characterized by low accuracy, low safety, and poor obstacle avoidance performance. Specifically, the movement routes of robots are restricted in the narrow corridors of gerocomiums. The elderly and nursing staff who walk back and forth also serve as dynamic obstacles to the robots' navigation. There have been repeated dangerous accidents where intelligent robots in gerocomiums collide with the elderly.Wang Caiqi proposed an adaptive extended RRT* path planning algorithm based on the distance from nodes to obstacles, which improved the RRT* algorithm to adapt to the complex layout of gerocomium[1]. Xiao Shaotong proposed the positioning of mobile robots and multi-angle target recognition based on RGBD information. Through sensors such as LiDAR and RGB-D cameras, environmental modeling was carried out to optimize the path planning of robots in gerocomiums[2]. By combining ROS (Robot Operating System) with SLAM (Simultaneous Localization and Mapping) technology, the construction and update of real-time environmental maps were achieved. Internationally, advanced technologies have been introduced into path planning algorithms. For example, in "A modified RRT* with rapid convergence in complex environments" proposed by Wang J, graph-based algorithms such as the RRT* (Rapidly-exploring Random Tree Star) algorithm and the PRM (Probabilistic Roadmap) algorithm[3] have been adopted, which enhance the path planning capabilities of robots in complex environments. There are also studies dedicated to optimizing the DWA (Dynamic Window Approach) path planning algorithm, enabling robots to adaptively adjust their paths in dynamically changing environments. In this paper, by combining YOLOv8 and the dynamic adjustment of the DWA cost function, the DAW navigation algorithm is optimized for the environment of gerocomiums. The path is dynamically adjusted through real- time updated environmental data, achieving more efficient dynamic obstacle avoidance capabilities and environmental adaptability, allowing the robot to adapt to environmental changes in real time. 2. Design of Intelligent Robots in Gerocomiums 2.1. Hardware Design of the Robot As shown in Figure 1, to meet the technical requirements for the movement of the intelligent robot in the gerocomium and multi - scenario and multi - target point navigation, this paper uses a robot development platform framework based on ROS to design the robot. The lower computer of the robot uses the STM32F103ZET6 as the main control chip to control the coded motor and the servo, providing the robot with the ability to move forward, backward, and turn. Meanwhile, an infrared ranging module is installed at the bottom of the robot to detect tiny obstacles that cannot be captured by the LiDAR and the depth camera. As shown in Figure 2, the robot is equipped with a drive shaft and a medicine box to fulfill functions such as delivering medicine to the elderly. 217 Figure 1. Hardware Relationship Diagram of the Intelligent Robot in the Gerocomium for the Elderly Figure 2. Physical Diagram of the Intelligent Robot in the Gerocomium Figure 3. Schematic Diagram of the LiDAR Positioning Principle 218 2.2. The Robot is Equipped with Multiple Sensors Table 1. Hardware Composition and Configuration of the Intelligent Robot in the Gerocomium for the Elderly Serial number Name Model and configuration 1 LiDAR sensor Ledong 14P single-line LiDAR 2 Lower computer main control Raspberry Pi 4B 3 Binocular depth camera sensor Orbbec Astra 4 Servo pan-tilt Combination of dual servo motors 5 Graphical display screen of the robot 7-inch ISP high-definition display screen 6 IMU (Inertial Measurement Unit) pose sensor Six-axis (three-axis gyroscope, three-axis accelerometer) 7 Odometer sensor Encoded motor 8 Bottom-layer control chip STM32F103ZET6 9 Support plate Acrylic plate 10 Driving wheel Rubber tire The intelligent robot in the gerocomium for the elderly adopts a three-layer structure design, as shown in Figure 3. The first layer is the chassis structure of the robot, which provides power for the robot. The second layer is equipped with sensors such as a LiDAR, an IMU pose sensor, a binocular depth camera, and their circuit parts, providing the robot with environmental perception and core computing power functions. The third layer is equipped with the robot's binocular depth camera, servo pan-tilt, medicine storage structure of the medicine box, and its conveyor belt part. The main devices of the intelligent robot in the gerocomium for the elderly in this article correspond to each label, and the specific parameters are shown in Table 1. The robot is equipped with an LD14P single-line LiDAR. Its measurement range is 0.1 to 8 meters, the scanning frequency is 6 Hz, the measurement frequency is 4000 times per second, the scanning angle of view is 0 to 360 degrees, and the pitch angle ranges from 0 to 10 degrees. It is also equipped with a 4-megapixel 1080P binocular synchronous depth camera with a depth ranging range of 0.6 to 8 meters. In cooperation with the servo pan-tilt, it can rotate 360 degrees to track objects in real time, perform augmented reality, 3D reconstruction, etc., and is used for multi-modal environmental perception. At the same time, an STM32 single-chip microcomputer is installed to control the underlying drive of the robot. To obtain environmental data using the Ledong 14P LiDAR, first, import the SDK of the Ledong 14P LiDAR and the ldlidar function package into the workspace named "workspace" in the Ubuntu system and perform a catkin_make compilation. Secondly, insert the USB interface of the LiDAR and configure and identify the LiDAR interface ttyAMA0 in the ROS system environment. Finally, in the ldlidar workspace, enter "roslaunch ldlidar ld14p.launch" to start the launch file and activate the LiDAR.After the LiDAR is started, the acquired information will be published in the /scan topic. The rviz visualization software within the ROS system can subscribe to the /scan topic and view the point cloud map generated by the LiDAR in the /scan topic in real time. The LiDAR emits rays through the laser emitter. After the rays are reflected by the obstacles and return to the camera, the distance to the obstacles is calculated through triangulation, and finally, it is generated in the map. 2.3. Software DesignPage Numbers. Figure 4. Overall Block Diagram of the Robot Software The intelligent robot in the gerocomium uses a Raspberry Pi 4B as the upper computer. The Raspberry Pi 4B establishes a remote connection with the PC terminal through SSH to achieve human-computer interaction. The lower computer 219 uses an STM32 single-chip microcomputer to control the chassis, providing the robot with movement functions. After the system is powered on, the Raspberry Pi host is started. The Raspberry Pi host executes the startup file according to the command and starts the robot chassis drive module. When all modules are working properly, the startup file ldlidar_ld14 of the LiDAR will be executed within the ROS system to publish the LiDAR topic /scan. Then, the camer_ws startup file is executed to start the binocular depth camera to obtain environmental depth information, thereby publishing the topic camer_depth. Next, the ros_imu startup file is executed to start the IMU to obtain information such as the robot's pose and acceleration, and then publish the topic imu_date. These data are transmitted to the Raspberry Pi 4B through the USB port for data processing. At the same time, the underlying control board STM32F103ZET6 obtains the information of the encoded motor for the robot's movement and transmits it to the Raspberry Pi 4B. After being fused with part of the data from the IMU, it outputs the topic information of odom_cominded to confirm the robot's odometer information.After all the input information reaches the Raspberry Pi 4B, it is processed in combination with the data of the optimized DWA algorithm. The navigation plans a locally optimal path. ROS publishes the cmd_vel topic to the underlying control system, which is finally converted into the number of pulses to control the rotation of the motor and drive the robot for navigation. The overall transmission framework of the robot in this article is shown in the figure above. 3. Improvement of the DWA Algorithm 3.1. Improvement of the Dynamic Window Approach (DWA) The traditional DWA generates local paths through speed space sampling, but its assumption of static obstacles makes it difficult to adapt to dynamic scenarios. Zhang Jinze[4]proposed an obstacle avoidance model based on linear prediction, but did not take into account the target semantic information; Wang Wenfei[5] introduced deep learning to optimize the trajectory smoothness, but the computational cost is relatively high. In recent years, research has improved the navigation accuracy by fusing visual and LiDAR data. Cong Peichao used ORB-SLAM to construct a semantic map, but it lacks real-time performance. Therefore, this paper combines YOLOv8 to improve the DWA navigation algorithm. The three major core challenges of navigation in a gerocomium for the elderly: (1) There is a risk of the robot colliding with the elderly during its movement. (2) Avoidance of dynamic obstacles: The elderly moving slowly in the gerocomium and the staff going back and forth to the medicine dispensing room will all become obstacles on the navigation path of the intelligent robot in the gerocomium. The sudden movement of people requires a prediction mechanism. (3) In scenarios where there are significant changes in the intensity of lighting, the robot will encounter problems such as the loss of path positioning and errors in path planning. In the face of the above problems, a three-layer module is designed and three steps are taken to solve the difficult problem of the robot's path planning: Perception layer: YOLOv8 is used to detect human faces. The Orbbec binocular depth camera is employed to obtain environmental depth and texture information, and the LiDAR is utilized to acquire the information of obstacles on the two- dimensional plane of the environment. Positioning and mapping layer: RTAB-MAP fuses the data from multiple sensors to generate a global semantic map. Path planning layer: Based on the improved DWA, local obstacle avoidance and trajectory optimization are achieved. The first step: Face recognition. Convert the coordinates of the recognized face into global coordinates in the map. The output format of YOLOv8 is:   1 ( , , , , , ) N t t t t t t t Detection x y w h s c   (1) Among them: ( , )t tx y The pixel coordinates of the center of the bounding box. ( , )tw h The width and height of the bounding box ts Confidence score tc Face label Coordinate transformation: Coordinate transformation from pixel coordinates to camera coordinates: Assume that the camera intrinsic parameter matrix is: f 0 0 0 0 1 x x y y c K f c          (2) The depth value isZ , Then the coordinates in the camera coordinate system are 1 u 1 x x camera y camera y camera u c Z f X v c Y Z K v Z f Z Z                                         (3) Transformation from the camera coordinate system to the global coordinate system: It is transformed through the camera pose transformation matrix provided by RTAB-MAP: g: 1 camera camera cameraworld world camera lobal camera camera camera camera X X Y T P T R Y t Z Z                      (4) The second step: Optimization of the DWA cost function The traditional DWA cost function includes the following terms: 1 2 3total goal obstacle smoothC w C w C w C     (5) Among them: r|| P ||total obot goalC P  :Cost of the distance to the target r omin(|| P ||)obstacle bot obstacleC P  : Cost of the distance to the obstacle 1|| ||i iCsmooth v v   : Cost of trajectory smoothness 220 Add a face attractiveness term: r||| P ||face obot faceC P  (6) The comprehensive cost function is: 1 2 3 4 )total goal obstacle smooth faceC w C w C w C w C       (7) The third step: Dynamic obstacle avoidance and safety distance. Regard the position of the human face as a dynamic obstacle, and set the safe radius rsafe rif || P || 0.4obot face safeP r m   Trigger deceleration or stop 4. Experimental Section 4.1. Training of the YOLOv8 Face Recognition Dataset The robot is equipped with YOLOv8. By performing multi- frame processing on a recorded video, the incremental stacking of the dataset is completed. Recognition training is carried out by annotating the facial features of human faces. After the robot undergoes a large amount of training in the dataset, the accuracy rate of face recognition is shown in the following figure, and the speed is shown in the following figure. Conduct robot face recognition tests under different lighting intensities at different times. The specific times are shown in the following table. Table 2. Training of YOLOv8 on the Face Recognition Dataset under Different Lighting Conditions Time Illumination Intensity Success Rate of Face Recognition in the Training Set 12:00 noon Moderate 90% 14:00 in the afternoon Strongest 60% 18:00 in the evening Weak 40% Figure 5. The robot uses YOLOv8 to train the face recognition dataset. Face recognition training was carried out respectively under different lighting conditions at different times. The results are shown in the above table. When the lighting intensity is close to the maximum value, the success rate of face recognition decreases, and when the lighting intensity is close to the minimum value, the success rate of face recognition also decreases. It can be seen that the success rate of face recognition follows a normal distribution. The robot shown in the figure is already able to recognize human faces in a laboratory environment. Figure 6. The training results of face recognition 221 4.2. Navigation Results in the Laboratory After DWA Optimization The experimental environment is selected in the laboratory of our school to simulate the environment of a gerocomium for navigation. As shown in the figure, it is in a closed room with a length of 11.79m, a width of 8.43m, and a height of 5.43m. Inside the closed room, there is a large cuboid obstacle with a length of 4.53m, a width of 2.43m, and a height of 2.24m, irregular obstacles such as chairs, a sunken obstacle of an empty cardboard box with a length of 37cm, a width of 15cm, and a height of 41cm, and a table with a length of 1m, a width of 70cm, and a height of 1m. The robot has a length of 42cm, a width of 35cm, and a height of 55cm. During the navigation process, the movement of people is simulated to mimic the movement of the elderly in a gerocomium. Figure 7. Physical Robot and Experimental Environment The robot conducts on-site navigation in the laboratory and avoids pedestrians to build a map, as shown in the figure. During the navigation process, pedestrians keep walking continuously. The robot timely decelerates and turns according to the set safety distance and then continues the navigation. Experimental environment: The experimental scene for navigation and mapping is selected as the laboratory, as shown in Figure 9. On-site navigation tests, the smoothness test of the robot's navigation, the test of the minimum safety distance for the robot to avoid collision after recognizing a human face, etc. are carried out in the laboratory. 5. Analysis of Experimental Results As shown in the figure above, the robot navigates and builds a map while avoiding obstacles in the real environment of the laboratory. The navigation tests are carried out using the unimproved DWA, the improved DWA, D*+DWA, and A*+DWA respectively. The same slow-moving people and obstacles are added during different processes. The final test results are sorted out as follows. 5.1. Test Scenario Table 3. Test Scenarios Scene Type Description Difficulty Level Narrow Corridor With a width of 1.5m and a length of 12m High Dynamic Pedestrian Passage There are 5 moving obstacles with a speed of 0.3m/s Medium U-turn with a Sharp Bend The turning radius is 1.5m Extremely High 5.2. Ablation Experiment Scheme One: Traditional DWA Scheme Two: DWA + Face Recognition Scheme Three: DWA + Dynamic Adjustment of Cost Function + Safety Distance Constraint Scheme Four: DWA + Face Recognition + Dynamic Adjustment of Cost Function + Safety Distance Constraint Table 4. Comparison of the Results of the Ablation Experiments Method Navigation Success Rate Minimum Safety Distance Number Sharp Turns Navigation Path Length Scheme One 70.5% 0.37m 6 11.28m Scheme Two 84.3% 0.41m 5 11.25m Scheme Three 80.4% 0.64m 4 11.20m Scheme Fou Scheme Fou 0.72m 2 10.08m Figure 8. The Process and Results of Map Building for the Robot Navigation while Avoiding Pedestrians in the Laboratory Conclusion: Incorporating face detection into DWA for navigation increases the navigation success rate by 13.8%, reduces the length of the navigation path by 0.26%, and decreases the number of sharp turns by 16.7%. However, the improvement in the safety distance is limited (only +0.03m). The reason is that face detection provides the target position but does not dynamically adjust the obstacle avoidance strategy. Incorporating dynamic obstacle avoidance and safety distance into DWA increases the minimum safety distance by 72.97% (from 0.37m to 0.64m) and reduces the number of sharp turns by 33%. The reason is that the dynamic obstacle prediction model enhances the robustness of obstacle avoidance, and the safety distance constraint prevents getting too close to obstacles. The collaborative effect of each module further increases the navigation success rate to 93.5%, shortens the navigation path by 10.6%, reduces the number of sharp turns by 66.7%, and increases the minimum safety distance by 94%. The reason is that face detection provides accurate target positioning, the dynamic obstacle avoidance model adjusts the path in real-time, and the safety distance constraint ensures the safety of interaction. 5.3. Comparison of Evaluation Indicators Table 5. Comparison of the Navigation Results after DWA Optimization Navigation Algorithm NavigationSuccessRate Minimum Safety Distance Number of Sharp Turns Traditional DWA 76% 0.26m 7 A* + DWA 80% 0.32m 5 D* + DWA 84.7% 0.54m 4 Method in This Paper 90% 0.65m 2 222 Conclusion: By comparing with the experimental results of other algorithms, it is shown that the method proposed in this paper increases the navigation success rate of the robot by 14%, enabling the robot to reach the navigation target point more accurately. The minimum safety distance is increased to 0.65m, enhancing the safety of the robot's navigation and avoiding collisions with the elderly in the gerocomium. The number of sharp turns is reduced by 71.4%, making the robot's navigation route smoother and avoiding jagged navigation routes. By adding methods such as face recognition detection and setting the minimum safety distance, the navigation accuracy and safety of the robot in the gerocomium can be significantly improved, which provides a more secure and effective guarantee for the life of the elderly in the gerocomium. Acknowledgments Fund Project: Industrialization Cultivation Project of Education Department of Jilin Province (JJKH20240313CY). References [1] Wang Caiqi, Cui Xining, Xiong Yi, et al. Adaptive Extended RRT* Path Planning Algorithm Based on the Distance from Nodes to Obstacles [J/OL]. Journal of Computer Applications, 1-10 [2024-09-01]. [2] Xiao Shaotong. Mobile Robot Localization and Multi-angle Target Recognition Based on RG- BDInformation [D]. Harbin Engineering University, 2020. [3] Wang J, Li J, Song Y, et al. FC-RRT*: A modified RRT* with rapid convergence in complex environments[J]. Journal of Computational Science,2024, 77,102239. [4] Zhang Jinze, Zhao Hong, Wang Ning, et al. Fuzzy Dual- window DWA Obstacle Avoidance Algorithm for Unmanned Surface Vehicles under Dense Obstacles [J]. Chinese Journal of Ship Research, 2021, 16(06): 10-18. [5] Wang Wenfei, Ru Le, Lu Bo, et al. Research on Real-time Path Planning of UAV Based on Improved DWA [J]. Electronics Optics & Control, 2023, 30(08): 50-55 + 60. [6] Cong Peichao, Cui Liying, Wan Xianquan, et al. Localization and Dense Mapping Algorithm of Orchard Spraying Robot Based on Improved ORB-SLAM2 [J]. Transactions of the Chinese Society for Agricultural Machinery, 2023, 54(07): 45- 55. [7] Z.Wen. SLAM Based Vision Self-Navigation Robot With RTAB-MAP Algorithm[C]//ITM Department, Illinois Institute of Technology. Proceedings of the 3rd International Conference on Signal Processing and Machine Learning (part2). Electronic and Electrical Engineering Department, University College of London,2023:5. [8] Sun Xiangyu, Han Hui. Serial Port Communication and Display Design Based on STM32 [J]. CFHI Technology, 2024, (05) :60-62+33. [9] Chen Jingyi. Research on Path Planning of Warehouse Mobile Robots Based on Improved Har- ris Hawk Optimization Algorithm and Dynamic Window Approach [D]. Chang'an University, 2023. [10] Zhu Mingchao, Lü Zhenjiong, Deng Minhan, et al. ROS Intelligent Robot for Autonomous Navigation Based on Multi- sensor Fusion [J]. Automation Application, 2024, 65(13): 1-4. [11] Li Zhipeng. Path Planning of Mobile Robots Based on Improved Ant Colony Algorithm and Dynamic Window Approach [D]. Yanshan University, 2024. [12] Ye Yingya. Optimization Strategies of Rtab-Map Binocular Vision SLAM with FPGA Hardware Acceleration [D]. Guilin University of Technology, 2024. [13] Huang Dingjian, Yang Huashan, Zhong Yong, et al. Research on Dynamic Obstacle Avoidance Based on ROS and LiDAR SLAM [J]. Process Automation Instrumentation, 2024, 45(05): 30-34. [14] Zhang Guifu. Research and Development of Navigation Technology for Service Mobile Robots Based on Multi-sensor Fusion [D]. Southeast University, 2023. [15] Li Changgeng. Research on Path Planning of Mobile Robots Based on the Improved A* Algorithm and the Dynamic Window Approach [D]. Chongqing University of Technology, 2022. [16] Chi Xu. Research on Path Planning of Mobile Robots Based on the Fusion of the Improved A* Algorithm and the Dynamic Window Approach [D]. Dalian Jiaotong University, 2021.