Skip to content

Commit

Permalink
refactor: do not include yawControl key when rendering show without y…
Browse files Browse the repository at this point in the history
…aw control
  • Loading branch information
ntamas committed Dec 12, 2023
1 parent 5c0e64b commit d6e9a79
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/modules/sbstudio/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,6 @@ def export(
if lights is None:
lights = {name: LightProgram() for name in trajectories.keys()}

if yaw_setpoints is None:
yaw_setpoints = {name: YawSetpointList() for name in trajectories.keys()}

environment = {"type": show_type}

if time_markers is None:
Expand All @@ -349,6 +346,16 @@ def export(
# TODO(ntamas): add cameras to environment in the "environment" key
# TODO: add music to the "media" key

def format_drone(name: str):
settings = {
"name": name,
"lights": lights[name].as_dict(ndigits=ndigits),
"trajectory": trajectories[name].as_dict(ndigits=ndigits, version=0),
}
if yaw_setpoints is not None:
settings["yawControl"] = yaw_setpoints[name].as_dict(ndigits=ndigits)
return {"type": "generic", "settings": settings}

data = {
"input": {
"format": "json",
Expand All @@ -361,19 +368,7 @@ def export(
},
"swarm": {
"drones": [
{
"type": "generic",
"settings": {
"name": name,
"lights": lights[name].as_dict(ndigits=ndigits),
"trajectory": trajectories[name].as_dict(
ndigits=ndigits, version=0
),
"yawControl": yaw_setpoints[name].as_dict(
ndigits=ndigits
),
},
}
format_drone(name)
for name in natsorted(trajectories.keys())
]
},
Expand Down

0 comments on commit d6e9a79

Please sign in to comment.