## 1 Introduction  
Exploring the Moon and other planets has been a long-standing goal of space agencies and private companies around the world. The number of space launches has seen a steady increase in recent years. Lowering costs and the broader availability of key technologies have driven progress and made space exploration more accessible [1, 2]. However, the growth in this sector may slow down because of issues related to the scalability of current technology. Although space-related innovations are certainly at the forefront of technical and scientific advancement, most missions still rely on human supervision and intervention. To overcome this issue, we can increase the degree of autonomy by implementing more advanced and independent systems. Autonomy is finding its way into satellites, which require relatively little operator attention. One can observe a trend of making the satellite hardware relatively more and more self-contained, with on-board processing and control capabilities [3, 4]. The next logical step is applying autonomy to in-orbit operations and space robotics [5, 6]. Complex in-orbit operations, or robot steering, require significant human involvement when carried out completely manually. With the increasing number of launches, one can expect the number of devices and vehicles performing such complex tasks to grow. Without some degree of autonomy, the sheer amount of equipment that needs to be supervised and tended to by qualified staff will impose serious limitations on the scalability of such deployments. Coupled with additional limitations for manual control, such as communication delays, this poses a problem that needs to be addressed--with new paradigms, methods, and algorithms facilitating automation and autonomy in space. The number of space applications on the verge of disruption by increased autonomy is vast, including, among numerous others, robotic rovers. The number of deployments of such robots has increased significantly as of late [7; 8; 9; 10]. To prepare for these missions, simulating the environments of these extraterrestrial bodies has become an essential part of the development of robotic technologies. Although many such solutions have been developed over the years, most of them are not up to the task of addressing the challenges of modern-day space autonomy. The recent wide adoption of deep learning [11; 12] and the increased use of industry-standard robotic software [13; 14; 15] are slowly making their way into space-related applications. Moreover, space applications often use dedicated and heterogeneous computational resources, which creates the need for hardware-in-the-loop (HIL) simulation, allowing the testing of the complex interplay of hardware and software under possibly realistic conditions [16]. In this paper, we present LunarSim, a space simulator that is tightly integrated with ROS 2 [17], space-ROS [15], and micro-ROS [18], and is capable of performing simulations, using a wide range of hardware (programmable logic, embedded microcomputers, and microcontrollers). A sample view of its environment is demonstrated in Figure 1. The main motivation for the simulator's development was the insufficient visual fidelity of the images generated by other simulators and/or their limited availability. The focus of the majority of simulators is on terramechanics, as they were mostly developed to analyse the problem of terrain traversal, with the quality of visualisations, the capabilities of HIL simulation, and software integration not being the focus of the developers. According to the scale proposed in [19], they could be classified as high fidelity in terms of terramechanics and physical and terrain simulation, but as low to medium categories of visual fidelity level. The presented simulator aims at a high fidelity level, in terms of visualisation, and a medium fidelity level of physical simulation.