Skip to content
Open
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,4 @@ python/tetra3
# users GPS data
test_ubx
test_ubx/*
python/telemetry_analysis/
4 changes: 3 additions & 1 deletion default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,7 @@
"active_telescope_index": 0,
"active_eyepiece_index": 0
},
"imu_threshold_scale": 1
"imu_threshold_scale": 1,
"telemetry_record": false,
"telemetry_images": false
}
12 changes: 11 additions & 1 deletion python/PiFinder/camera_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,17 @@ def get_image_loop(
f"Exposure saved and auto-exposure disabled: {self.exposure_time}µs"
)

if command.startswith("save"):
if command.startswith("save_image:"):
# Save current camera frame to specified path
save_path = command.split(":", 1)[1]
try:
img = camera_image.copy()
img.save(save_path, "PNG", compress_level=6)
logger.debug("Telemetry image saved: %s", save_path)
except Exception as e:
logger.error("Failed to save telemetry image: %s", e)

if command.startswith("save:"):
# Set flag to save next capture to this file
self._save_next_to = command.split(":")[1]
console_queue.put("CAM: Save flag set")
Expand Down
10 changes: 9 additions & 1 deletion python/PiFinder/imu_pi.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,27 @@ def imu_monitor(shared_state, console_queue, log_queue):
0, 0, 0, 0
), # Scalar-first numpy quaternion(w, x, y, z) - Init to invalid quaternion
"status": 0, # IMU Status: 3=Calibrated
"gyro": None, # Raw gyroscope angular velocity (rad/s)
"accel": None, # Raw linear acceleration (m/s², gravity removed)
}

while True:
imu.update()
imu_data["status"] = imu.calibration

# TODO: move_start and move_end don't seem to be used?
# Read raw sensor data for telemetry
try:
imu_data["gyro"] = imu.sensor.gyro
imu_data["accel"] = imu.sensor.linear_acceleration
except Exception:
pass

if imu.moving():
if not imu_data["moving"]:
logger.debug("IMU: move start")
imu_data["moving"] = True
imu_data["move_start"] = time.time()
# DISABLE old method
imu_data["quat"] = quaternion.from_float_array(
imu.avg_quat
) # Scalar-first (w, x, y, z)
Expand Down
Loading
Loading