Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crazyflow/sim/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"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 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]),
}


Expand Down
4 changes: 2 additions & 2 deletions crazyflow/sim/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 1920,
height: int = 1080,
) -> NDArray | None:
if self.viewer is None:
self.mj_model.vis.global_.offwidth = width
Expand Down
14 changes: 7 additions & 7 deletions crazyflow/sim/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ 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.
ya, yb, yc = params.get("ya", -0.01), params.get("yb", 0), params.get("yc", 0)
# 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.
X_dot = cs.vertcat(
Expand Down