save calibration as JSON again

This commit is contained in:
Willem Melching
2020-12-08 11:54:27 +01:00
parent a7bf03305a
commit 9803d3fcdc
+5 -2
View File
@@ -80,7 +80,7 @@ class Calibrator():
rpy_init = list(msg.liveCalibration.rpyCalib)
valid_blocks = msg.liveCalibration.validBlocks
except (ValueError, capnp.lib.capnp.KjException):
# TODO: remove this after next release
# TODO: remove this when offroad can read capnp
calibration_params = json.loads(calibration_params)
rpy_init = calibration_params["calib_radians"]
valid_blocks = calibration_params['valid_blocks']
@@ -134,7 +134,10 @@ class Calibrator():
write_this_cycle = (self.idx == 0) and (self.block_idx % (INPUTS_WANTED//5) == 5)
if self.param_put and write_this_cycle:
put_nonblocking("CalibrationParams", self.get_msg().to_bytes())
# TODO: change to raw bytes when offroad can read capnp
cal_params = {"calib_radians": list(self.rpy),
"valid_blocks": int(self.valid_blocks)}
put_nonblocking("CalibrationParams", json.dumps(cal_params).encode('utf8'))
def handle_v_ego(self, v_ego):
self.v_ego = v_ego