|
5 | 5 | import typing |
6 | 6 | from typing import List |
7 | 7 |
|
8 | | -import numpy as np |
9 | 8 | import torch |
10 | 9 | from torch import Tensor |
11 | 10 |
|
|
14 | 13 | from vmas.simulator.dynamics.holonomic import Holonomic |
15 | 14 | from vmas.simulator.dynamics.holonomic_with_rot import HolonomicWithRotation |
16 | 15 | from vmas.simulator.scenario import BaseScenario |
17 | | -from vmas.simulator.utils import ( |
18 | | - Color, |
19 | | - ScenarioUtils, |
20 | | - TorchUtils, |
21 | | - X, |
22 | | - x_to_rgb_colormap, |
23 | | - Y, |
24 | | -) |
| 16 | +from vmas.simulator.utils import Color, ScenarioUtils, TorchUtils, X, Y |
25 | 17 |
|
26 | 18 | if typing.TYPE_CHECKING: |
27 | 19 | from vmas.simulator.rendering import Geom |
@@ -1570,66 +1562,6 @@ def extra_render(self, env_index: int = 0) -> "List[Geom]": |
1570 | 1562 | line.set_color(*color, alpha=agent._alpha) |
1571 | 1563 | geoms.append(line) |
1572 | 1564 |
|
1573 | | - if ( |
1574 | | - hasattr(self, "alternative_actions") |
1575 | | - and hasattr(self, "agents_uncertanties") |
1576 | | - and not self.enable_shooting |
1577 | | - ): |
1578 | | - for index, agent in enumerate(self.blue_agents): |
1579 | | - uncertanty = self.agents_uncertanties[agent] |
1580 | | - circle = rendering.make_ellipse( |
1581 | | - uncertanty[X] / 10, |
1582 | | - uncertanty[Y] / 10, |
1583 | | - ) |
1584 | | - xform = rendering.Transform() |
1585 | | - xform.set_translation(*agent.state.pos[env_index]) |
1586 | | - circle.add_attr(xform) |
1587 | | - circle.set_color(*self.blue_color, alpha=0.2) |
1588 | | - geoms.append(circle) |
1589 | | - |
1590 | | - other_actions = self.alternative_actions[agent] |
1591 | | - for i, action in enumerate(other_actions): |
1592 | | - is_agent = index == i |
1593 | | - line = rendering.Line( |
1594 | | - agent.state.pos[env_index], |
1595 | | - agent.state.pos[env_index] |
1596 | | - + action * 10 * agent.shape.circumscribed_radius(), |
1597 | | - width=2, |
1598 | | - ) |
1599 | | - if is_agent: |
1600 | | - line.set_color(*self.blue_color) |
1601 | | - geoms.append(line) |
1602 | | - |
1603 | | - if hasattr(self, "agent_behavioral_distances"): |
1604 | | - colors = x_to_rgb_colormap( |
1605 | | - np.array(list(self.agent_behavioral_distances.values())), |
1606 | | - low=0, |
1607 | | - high=1, |
1608 | | - )[:, :-1] |
1609 | | - for i, agent in enumerate(self.blue_agents): |
1610 | | - agent.color = colors[i] |
1611 | | - |
1612 | | - if hasattr(self, "edge_radius") and self.ai_red_agents: |
1613 | | - # Communication lines |
1614 | | - for i, agent1 in enumerate(self.blue_agents): |
1615 | | - for j, agent2 in enumerate(self.blue_agents): |
1616 | | - if j <= i: |
1617 | | - continue |
1618 | | - agent_dist = torch.linalg.vector_norm( |
1619 | | - agent1.state.pos - agent2.state.pos, dim=-1 |
1620 | | - ) |
1621 | | - if agent_dist[env_index] <= self.edge_radius: |
1622 | | - color = Color.BLACK.value |
1623 | | - line = rendering.Line( |
1624 | | - (agent1.state.pos[env_index]), |
1625 | | - (agent2.state.pos[env_index]), |
1626 | | - width=1, |
1627 | | - ) |
1628 | | - xform = rendering.Transform() |
1629 | | - line.add_attr(xform) |
1630 | | - line.set_color(*color) |
1631 | | - geoms.append(line) |
1632 | | - |
1633 | 1565 | return geoms |
1634 | 1566 |
|
1635 | 1567 | def _get_background_geoms(self, objects): |
|
0 commit comments