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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: v0.69.0
pixi-version: v0.70.2
# enable caching of installed envs
cache: true
# only write new caches on main pushes (TODO: Enable)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Pixi (installs pixi + caches envs) # https://github.com/marketplace/actions/setup-pixi
uses: prefix-dev/setup-pixi@v0.9.3 # pin the action version
with:
pixi-version: v0.69.0 # pin the pixi binary version (optional)
pixi-version: v0.70.2 # pin the pixi binary version (optional)
cache: true # enable caching of installed envs
# only write new caches on main pushes (TODO: Enable)
# cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
Expand Down
18 changes: 9 additions & 9 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions swarm_gpt/core/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def deploy(self, drone_ids: list[int] | None = None) -> bool:
landing_pos = obs["pos"] if self.settings["land_on_docks"] else d["pos"]
# TODO fix hard coded yaw
init_pos_dict[uri] = np.array([*init_pos, 0.0])
final_pos_dict[uri] = np.array([*landing_pos + np.array([0.0, 0.0, 0.8]), 0.0])
final_pos_dict[uri] = np.array([*landing_pos + np.array([0.0, 0.0, 0.5]), 0.0])
landing_pos_dict[uri] = np.array([*landing_pos - np.array([0.0, 0.0, 0.2]), 0.0])
choreography_dict[uri] = self.splines[i]
color_top[uri] = {
Expand All @@ -366,7 +366,9 @@ def deploy(self, drone_ids: list[int] | None = None) -> bool:
taken_off = False
continue
try:
logger.debug(f"Trying to get obs for {uri}")
obs = swarm.get_obs(uri)
logger.debug(f"got obs for {uri}")
z = obs["pos"][2]
qw = np.abs(obs["quat"][-1])
# Demo fix: If the drone is disconnected, we cannot get its position. We assume it has not taken off.
Expand All @@ -384,16 +386,17 @@ def deploy(self, drone_ids: list[int] | None = None) -> bool:
"VLC could not start playback; skipping choreography (drones will land)."
)
else:
logger.debug("Starting choreography execution")
swarm.execute_choreography(
choreography_dict,
self.waypoints["time"][0, -1],
color_top=color_top,
color_bot=color_bot,
)
swarm.goto(final_pos_dict, duration=2.0) # Transition from ideal point to hover pos
# if self.settings["land_on_docks"]: # Commented out for demo
# swarm.goto(final_pos_dict, duration=5.0) # Hovering
swarm.goto(landing_pos_dict, duration=1.5) # Landing
if self.settings["land_on_docks"]: # Commented out for demo
swarm.goto(final_pos_dict, duration=3.0) # Hovering
swarm.land(duration=1.5) # Landing
finally:
swarm.close()
self.music_manager.song = original_song
Expand Down
6 changes: 5 additions & 1 deletion swarm_gpt/core/drone_swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def __init__(

def get_obs(self, uri: str) -> dict[str, Array]:
"""Generate the observation for a drone using mocap or lighthouse."""
return self._run(self._read_observation(uri))
obs = self._run(self._parallel_by_uri("Reading observation", [uri], self._read_observation))
return obs[0]

def missing_uris(self) -> list[str]:
"""Return configured URIs that are not currently active."""
Expand Down Expand Up @@ -420,6 +421,7 @@ async def _parallel_by_uri(
logger.error(f"{uri} disconnected or unreachable. {action_name} failed: {result}")
else:
logger.error(f"{action_name} failed for {uri}: {result}")
return results

async def _emergency_stop(self, uri: str) -> None:
await self._cf(uri).localization().emergency().send_emergency_stop()
Expand Down Expand Up @@ -483,6 +485,8 @@ async def _read_lighthouse_observation(self, uri: str) -> dict[str, Array]:
"rpy": rpy,
"is_outdated": False,
}
except Exception as exc:
logger.error(f"Reading observation from {uri} failed: {exc}")
finally:
await stream.stop()

Expand Down
Loading