A medical system comprising: at least one first sensor disposed in a medical instrument and configured to measure acceleration; at least one second sensor disposed in the medical instrument and configured to measure rotation; at least one third sensor disposed in the medical instrument and configured to measure direction of movement; a clock circuit configured to indicate time; a memory; and processing circuitry in communication with the at least one first sensor, the at least one second sensor, the at least one third sensor, and the clock circuit, the processing circuitry configured to: receive measured data of the at least one first sensor, the at least one second sensor, and the at least one third sensor, characterised by being further configured to correlate the measured data with time indicated by the clock circuit to derive a reference time point, and store the correlated measured data and reference time point in the memory, wherein: the processing circuitry is configured to determine that a distal portion of the medical instrument has entered a body cavity of a patient based on measured acceleration decreasing from above a first threshold to below a second threshold, or the system further includes at least one fourth sensor including a barometer disposed in the medical instrument configured to measure pressure and the processing circuitry is configured to determine that a distal portion of the medical instrument has entered a body cavity of a patient based on measured pressure from the barometer exceeding a threshold wherein the reference time point is the time at which the medical instrument enters the body cavity. at least one first sensor disposed in a medical instrument and configured to measure acceleration; at least one second sensor disposed in the medical instrument and configured to measure rotation; at least one third sensor disposed in the medical instrument and configured to measure direction of movement; a clock circuit configured to indicate time; a memory; and processing circuitry in communication with the at least one first sensor, the at least one second sensor, the at least one third sensor, and the clock circuit, the processing circuitry configured to: receive measured data of the at least one first sensor, the at least one second sensor, and the at least one third sensor, characterised by being further configured to correlate the measured data with time indicated by the clock circuit to derive a reference time point, and store the correlated measured data and reference time point in the memory, wherein: the processing circuitry is configured to determine that a distal portion of the medical instrument has entered a body cavity of a patient based on measured acceleration decreasing from above a first threshold to below a second threshold, or the system further includes at least one fourth sensor including a barometer disposed in the medical instrument configured to measure pressure and the processing circuitry is configured to determine that a distal portion of the medical instrument has entered a body cavity of a patient based on measured pressure from the barometer exceeding a threshold wherein the reference time point is the time at which the medical instrument enters the body cavity. receive measured data of the at least one first sensor, the at least one second sensor, and the at least one third sensor, characterised by being further configured to correlate the measured data with time indicated by the clock circuit to derive a reference time point, and store the correlated measured data and reference time point in the memory, wherein: the processing circuitry is configured to determine that a distal portion of the medical instrument has entered a body cavity of a patient based on measured acceleration decreasing from above a first threshold to below a second threshold, or the system further includes at least one fourth sensor including a barometer disposed in the medical instrument configured to measure pressure and the processing circuitry is configured to determine that a distal portion of the medical instrument has entered a body cavity of a patient based on measured pressure from the barometer exceeding a threshold wherein the reference time point is the time at which the medical instrument enters the body cavity. the processing circuitry is configured to determine that a distal portion of the medical instrument has entered a body cavity of a patient based on measured acceleration decreasing from above a first threshold to below a second threshold, or the system further includes at least one fourth sensor including a barometer disposed in the medical instrument configured to measure pressure and the processing circuitry is configured to determine that a distal portion of the medical instrument has entered a body cavity of a patient based on measured pressure from the barometer exceeding a threshold wherein the reference time point is the time at which the medical instrument enters the body cavity.