From d6a79d6c6621c431c64f2b301dd4ca111963de29 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Fri, 24 Apr 2026 07:42:39 +0300 Subject: [PATCH] Pass acc data in mG in SCALED_IMU to comply with mavlink standard https://mavlink.io/en/messages/common.html#SCALED_IMU pyflix@0.13 --- flix/mavlink.ino | 2 +- tools/pyflix/flix.py | 3 ++- tools/pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/flix/mavlink.ino b/flix/mavlink.ino index 1459872..feaef8d 100644 --- a/flix/mavlink.ino +++ b/flix/mavlink.ino @@ -65,7 +65,7 @@ void sendMavlink() { sendMessage(&msg); mavlink_msg_scaled_imu_pack(mavlinkSysId, MAV_COMP_ID_AUTOPILOT1, &msg, time, - acc.x * 1000, -acc.y * 1000, -acc.z * 1000, // convert to frd + acc.x / ONE_G * 1000, -acc.y / ONE_G * 1000, -acc.z / ONE_G * 1000, // convert to frd gyro.x * 1000, -gyro.y * 1000, -gyro.z * 1000, 0, 0, 0, 0); sendMessage(&msg); diff --git a/tools/pyflix/flix.py b/tools/pyflix/flix.py index fb88e55..211b5df 100644 --- a/tools/pyflix/flix.py +++ b/tools/pyflix/flix.py @@ -186,7 +186,8 @@ class Flix: self._trigger('motors', self.motors) if isinstance(msg, mavlink.MAVLink_scaled_imu_message): - self.acc = self._mavlink_to_flu([msg.xacc / 1000, msg.yacc / 1000, msg.zacc / 1000]) + ONE_G = 9.80665 + self.acc = self._mavlink_to_flu([msg.xacc * ONE_G / 1000, msg.yacc * ONE_G / 1000, msg.zacc * ONE_G / 1000]) self.gyro = self._mavlink_to_flu([msg.xgyro / 1000, msg.ygyro / 1000, msg.zgyro / 1000]) self._trigger('acc', self.acc) self._trigger('gyro', self.gyro) diff --git a/tools/pyproject.toml b/tools/pyproject.toml index 3b8f3c6..1d9ba3a 100644 --- a/tools/pyproject.toml +++ b/tools/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pyflix" -version = "0.12" +version = "0.13" description = "Python API for Flix drone" authors = [{ name="Oleg Kalachev", email="okalachev@gmail.com" }] license = "MIT"