From e20a508cc60795533c286f705c40b3027ee42a96 Mon Sep 17 00:00:00 2001 From: yufei4hua Date: Wed, 8 Oct 2025 17:39:48 +0200 Subject: [PATCH 1/4] Add nominal yaw dynamics. Set default window size. --- crazyflow/sim/physics.py | 2 +- crazyflow/sim/sim.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crazyflow/sim/physics.py b/crazyflow/sim/physics.py index 6957055..529a1bb 100644 --- a/crazyflow/sim/physics.py +++ b/crazyflow/sim/physics.py @@ -15,7 +15,7 @@ "acc": np.array([20.907574256269616, 3.653687545690674]), "roll_acc": np.array([-130.3, -16.33, 119.3]), "pitch_acc": np.array([-99.94, -13.3, 84.73]), - "yaw_acc": np.array([0.0, 0.0, 0.0]), + "yaw_acc": np.array([-60.0, -10.0, 120.0]), } diff --git a/crazyflow/sim/sim.py b/crazyflow/sim/sim.py index d689890..8773742 100644 --- a/crazyflow/sim/sim.py +++ b/crazyflow/sim/sim.py @@ -156,8 +156,8 @@ def render( mode: str | None = "human", world: int = 0, default_cam_config: dict | None = None, - width: int = 640, - height: int = 480, + width: int = 1280, + height: int = 720, ) -> NDArray | None: if self.viewer is None: self.mj_model.vis.global_.offwidth = width From 18eb419ad698ad5d85744c066392cff1a1ce6e98 Mon Sep 17 00:00:00 2001 From: yufei4hua Date: Thu, 9 Oct 2025 08:45:56 +0200 Subject: [PATCH 2/4] Synchronize default yaw params in symbolic model. --- crazyflow/sim/physics.py | 2 +- crazyflow/sim/sim.py | 4 ++-- crazyflow/sim/symbolic.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crazyflow/sim/physics.py b/crazyflow/sim/physics.py index 529a1bb..3087aaf 100644 --- a/crazyflow/sim/physics.py +++ b/crazyflow/sim/physics.py @@ -15,7 +15,7 @@ "acc": np.array([20.907574256269616, 3.653687545690674]), "roll_acc": np.array([-130.3, -16.33, 119.3]), "pitch_acc": np.array([-99.94, -13.3, 84.73]), - "yaw_acc": np.array([-60.0, -10.0, 120.0]), + "yaw_acc": np.array([-60.0, -10.0, 140.0]), } diff --git a/crazyflow/sim/sim.py b/crazyflow/sim/sim.py index 8773742..4de27c5 100644 --- a/crazyflow/sim/sim.py +++ b/crazyflow/sim/sim.py @@ -156,8 +156,8 @@ def render( mode: str | None = "human", world: int = 0, default_cam_config: dict | None = None, - width: int = 1280, - height: int = 720, + width: int = 1920, + height: int = 1080, ) -> NDArray | None: if self.viewer is None: self.mj_model.vis.global_.offwidth = width diff --git a/crazyflow/sim/symbolic.py b/crazyflow/sim/symbolic.py index 1742528..9da5c7e 100644 --- a/crazyflow/sim/symbolic.py +++ b/crazyflow/sim/symbolic.py @@ -194,7 +194,7 @@ def symbolic_attitude(dt: float, params: dict | None = None) -> SymbolicModel: # system matrix ill-conditioned for control methods like LQR. Therefore, we introduce a small # spring-like term to the yaw dynamics that leads to a non-singular system matrix. # TODO: identify proper parameters for yaw_rate from real data. - ya, yb, yc = params.get("ya", -0.01), params.get("yb", 0), params.get("yc", 0) + ya, yb, yc = params.get("ya", -60.0), params.get("yb", -10.0), params.get("yc", 140.0) # Define dynamics equations. X_dot = cs.vertcat( From 307ddbfe4d574b4bed008f754391d8f0fc8098db Mon Sep 17 00:00:00 2001 From: Martin Schuck <57562633+amacati@users.noreply.github.com> Date: Thu, 9 Oct 2025 09:23:48 +0200 Subject: [PATCH 3/4] Clarify yaw dynamics parameters in SYS_ID_PARAMS --- crazyflow/sim/physics.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crazyflow/sim/physics.py b/crazyflow/sim/physics.py index 3087aaf..aa85ad3 100644 --- a/crazyflow/sim/physics.py +++ b/crazyflow/sim/physics.py @@ -15,6 +15,8 @@ "acc": np.array([20.907574256269616, 3.653687545690674]), "roll_acc": np.array([-130.3, -16.33, 119.3]), "pitch_acc": np.array([-99.94, -13.3, 84.73]), + # Yaw dynamics are not identified, parameters were chosen to stabilize yaw dynamics. See + # https://github.com/utiasDSL/crazyflow/pull/41 "yaw_acc": np.array([-60.0, -10.0, 140.0]), } From 295dd923c399d1ca8b2dab025aa04a10bf73717a Mon Sep 17 00:00:00 2001 From: Martin Schuck <57562633+amacati@users.noreply.github.com> Date: Thu, 9 Oct 2025 09:27:41 +0200 Subject: [PATCH 4/4] Clarify comments on yaw dynamics parameters --- crazyflow/sim/symbolic.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crazyflow/sim/symbolic.py b/crazyflow/sim/symbolic.py index 9da5c7e..aaac9be 100644 --- a/crazyflow/sim/symbolic.py +++ b/crazyflow/sim/symbolic.py @@ -188,12 +188,12 @@ def symbolic_attitude(dt: float, params: dict | None = None) -> SymbolicModel: b = params.get("b", 3.653687545690674) ra, rb, rc = params.get("ra", -130.3), params.get("rb", -16.33), params.get("rc", 119.3) pa, pb, pc = params.get("pa", -99.94), params.get("pb", -13.3), params.get("pc", 84.73) - # The identified model sets params_yaw_rate to [0, 0, 0], because the training data did not - # contain any data with yaw != 0. Therefore, it cannot infer the impact of setting the yaw - # attitude to a non-zero value on the dynamics. However, using a zero vector will make the - # system matrix ill-conditioned for control methods like LQR. Therefore, we introduce a small - # spring-like term to the yaw dynamics that leads to a non-singular system matrix. - # TODO: identify proper parameters for yaw_rate from real data. + # The identified model does not identify yaw and leaves the parameters zero, because the + # training data did not contain any data with yaw != 0. Therefore, it cannot infer the impact + # of setting the yaw attitude to a non-zero value on the dynamics. However, using a zero + # vector will make the system matrix ill-conditioned for control methods like LQR. Therefore, + # we choose parameters that stabilize the yaw dynamics. There are not identified! See + # https://github.com/utiasDSL/crazyflow/pull/41 ya, yb, yc = params.get("ya", -60.0), params.get("yb", -10.0), params.get("yc", 140.0) # Define dynamics equations.