# Advancing Road Infrastructure Safety with the Remotely Piloted Safety Cone
## 2 Materials and Methods
### Hardware Architecture
#### 2.3.3 Autopilot Software  
The software used in the Pixhawk platform is based on ArduRover firmware, an open-source solution within the ArduPilot ecosystem specifically developed for autonomous ground vehicles. This solution enables essential tasks, including autonomous navigation, propulsion control, and sensor management. It also supports real-time sensor fusion and LUA script development inside the controller. It also features direct integration with the ROS2 framework through MAVROS, which encodes MAVLink messages within the ROS2  
Figure 5: Power and actuation schematic of RPSC with four-motor traction control. environment. This enables the Pixhawk software to facilitate customised and adaptive operation according to the vehicle's specific requirements. Accurate state estimation is essential for the RPSC's autonomous navigation capabilities. To this end, the software utilises an extended Kalman filter (EKF) to integrate and fuse signals from the GNSS RTK system, IMU, encoders, and magnetometer in real-time. This fusion enables the continuous estimation of the robot's state vector, mitigating the cumulative errors of the odometry and ensuring stability, even in conditions of GNSS signal degradation. For the RPSC, which operates in dynamic environments with active traffic, the EKF is particularly important as interference or partial loss of the satellite signal is common. The software dynamically adjusts the weight given to each sensor according to its accuracy and integrity, enabling the EKF to optimise navigation performance continuously. The EKF is configured to use the Pixhawk's built-in barometer as the primary source of altitude information. Wheel encoders estimate horizontal velocity and provide direct displacement data. The Here3+'s magnetometer determines orientation. Conversely, the GNSS RTK is the primary source for global positioning, delivering centimetre accuracy. In RPSC control, the software independently controls each side of the vehicle using PWM signals, steering, and differential traction. The system utilizes cascaded PID controllers, specifically velocity and position PID controllers, to regulate linear velocity and yaw, while a separate PID controller adjusts angular steerability. Linear acceleration ramps are also implemented in the software to ensure smooth transitions in velocity. This limits the derivative of the PWM signal, reducing mechanical stress on the motors. These ramps are configured with adjustable incremental rates according to the terrain's demands. Operational safety is a fundamental aspect of the RPSC design, achieved through a series of fail-safe mechanisms programmed to stop the system in the event of an anomaly. These mechanisms are configured to activate in critical conditions, such as loss of connection, sensor failure, or interruption to the control link, ensuring that the vehicle stops safely. The first fail-safe is a pre-check of sensor activation, battery status, and communication links. It verifies that the minimum number of required GNSS satellites is available to ensure reliable navigation. Loss of communication with the ground control station triggers another fail-safe, switching the RPSC to HOLD mode. Similarly, a Lua script monitors the connection between the Pixhawk and the Raspberry Pi by checking for a heartbeat signal every 0.5 s. If the heartbeat signal is absent, indicating a loss of communication, the script forces the vehicle into HOLD mode and disarms it. The ArduPilot ecosystem is complemented by Mission Planner software, which acts as a ground control station (GCS) and operational extension of the autopilot. Mission Planner provides an interface for monitoring, parameterisation, and remote control of the RPSC, allowing a physical controller to be connected to the station and thus facilitating manual operation when necessary. The Pixhawk, running ArduRover, communicates with a Raspberry Pi running MAVROS within the ROS2 environment.