# A Cyber-Physical System for Wildfire Detection and Firefighting
## 3 Materials and Methods
### Nuclio Serverless Function
It allows real-time communication without the need for the client to constantly poll the server for new data. WebSockets are commonly used in web development for real-time web applications, but they can also be used for other types of applications, such as Node-RED. ROS-Bridge uses JavaScript Object Notation (JSON) to encode and decode ROS messages that are sent and received over the WebSocket connection. ### ROS-Based UGV Node

The UGV node plays a critical role in our cyber-physical system for wildfire detection and firefighting. As described earlier, this node serves as an integrated system that consists of a companion computer with an ROS environment. The ROS environment is responsible for processing data obtained from various sensors on the UGV, including cameras and environmental sensors. In our implementation, we leverage several key ROS packages to enhance the capabilities of the UGV. Firstly, we integrate YOLOv4, a state-of-the-art object detection algorithm, for fire detection. This enables the UGV to identify and locate fires accurately. Secondly, we utilize the Move Base package to implement navigation planning algorithms, which allow the UGV to navigate safely and effectively while avoiding obstacles in its environment. This capability is crucial for ensuring the UGV's operational efficiency during firefighting missions. Additionally, we employ GMapping, an ROS package for mapping, to enhance the situational awareness [40] of the UGV. By constructing a map of the environment, the UGV can provide valuable information to the ground station operators, aiding them in making informed decisions. UGV ROS Launcher

In order to test the behavior of the UGV, how to detect fire spots, and how to avoid a collision, a 3D simulation environment has been used. The setup of the simulated UGV environment consists of the following ROS launcher:

* **Robot Localization Launcher**: Despite incorporating a GPS sensor, relying solely on GPS data for outdoor localization in the Jackal Rover poses challenges. The imprecision of GPS measurements leads to significant fluctuations in values, and factors such as slippage and uneven surfaces can cause deviation from the GPS trajectory. Moreover, GPS only provides position information without orientation details. To address this, integrating a compass such as an Inertial Measurement Unit (IMU) becomes essential. Fusing data from multiple sensors, including GPS, IMU, and wheel odometry, mitigates noise and errors, improving the reliability of GPS localization. * **Path Planning:** Once we have implemented GPS localization on our Jackal Rover, we can proceed with fulfilling a key requirement of our project, which is forest navigation. This task is crucial as the robot needs to reach the GPS location of the fire while avoiding obstacles. To accomplish this, we have opted for the Navigation Stack, a collection of ROS nodes and algorithms for autonomous robot navigation. Our project incorporates the Move_Base node, the core component of the Navigation Stack, which guides the robot to its goal while considering obstacles. We have created a launch file, move_base_launch, to configure the Navigation Stack. This launch file loads various parameters from.yaml files for different components, including the costmap, local planner, and move_base itself. * **Mapping launcher**: Mapping is a critical component of implementing Unmanned Ground Vehicles (UGVs) with ROS. It allows the Jackal Rover to create a detailed representation of the environment it traverses, providing valuable information to firefighters. Simultaneous Localization and Mapping (SLAM) is employed to build a map while tracking the robot's location. Among the available 2D SLAM algorithms in ROS, GMapping is selected for its particle filter approach and utilization of odometry and LIDAR scans. The GMapping algorithm is implemented through the GMapping ROS package, utilizing the slam_gmapping node to create a 2D map as the robot moves. This efficient and accurate mapping solution enhances situational awareness for firefighting operations.