This simulation is based on the paper: Polzin, M., & Hughes, J. (2024). Into the ice: Exploration and data capturing in glacial moulins by a tethered robot. Journal of Field Robotics, 41(3), 654-668. [See the full paper]
cave_lidar_demo.mp4
This project simulates the movement of a robot descending into a cave of varying thickness using a PID controller to stay within the boundaries.
To get started with the simulation, follow these steps:
-
Clone the repository:
git clone https://github.com/souvik0306/Into_the_Ice.git cd Into_the_Ice
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the main application:
python app.py
-
Run the Open3D visualization:
python app_open3d.py
Defines simulation parameters:
- Cave length
- Depth points
- Spiral rotations
- Noise amplitude
- PID gain values
Calculates the necessary velocity adjustments based on:
- Current position error
- Integral of past errors
- Rate of change of error
Uses the classic PID formula to output control signals for both x and y directions.
Simulates the robot's movement:
- Generates random cave boundaries (
left_thickness
,right_thickness
) to represent the varying width of the cave. - Calculates the desired path as a spiral.
- Simulates two trajectories:
- Undamped: Moves freely within the cave boundaries with added noise.
- Damped (PID Controlled): Uses the PID controller to adjust its velocity to stay close to the desired spiral path while remaining within the cave boundaries.
Tracks the robot's position, calculates the error between the damped and desired trajectories, and stores this data.
Initializes the Matplotlib figures and axes for:
- Cave thickness visualization
- Error percentage plot
Updates the data for the 3D and thickness plots during the animation.
Updates the error percentage plot during the animation.
- Calls
run_simulation
to get the simulated data. - Uses
setup_plots
to initialize the plots. - Creates two
FuncAnimation
instances:- One for the main plot (3D trajectory and thickness).
- One for the error plot.
- Shows the plots with the animations running.
- Creates and deforms a cylindrical mesh to represent the cave.
- Applies Perlin noise to the mesh vertices to simulate natural cave walls.
- Simulates the robot's path inside the cave.
- Visualizes the cave and robot path using Open3D.
The codebase simulates a robot navigating a cave with varying thickness. It uses a PID controller to keep the robot on a desired spiral path while avoiding collisions with the cave walls. The simulation results are visualized using Matplotlib animations, showing the 3D trajectory, the cave thickness, and the error difference between damped and random movement. Additionally, app_open3d.py
provides a 3D visualization of the cave and robot path using Open3D.