File tree Expand file tree Collapse file tree 3 files changed +9
-39
lines changed Expand file tree Collapse file tree 3 files changed +9
-39
lines changed Original file line number Diff line number Diff line change 1111from vmas .simulator .dynamics .diff_drive import DiffDrive
1212from vmas .simulator .dynamics .holonomic_with_rot import HolonomicWithRotation
1313from vmas .simulator .scenario import BaseScenario
14- from vmas .simulator .utils import Color , ScenarioUtils
14+ from vmas .simulator .utils import ScenarioUtils
1515
1616if typing .TYPE_CHECKING :
1717 from vmas .simulator .rendering import Geom
@@ -88,24 +88,14 @@ def observation(self, agent: Agent):
8888 )
8989
9090 def extra_render (self , env_index : int = 0 ) -> "List[Geom]" :
91- from vmas .simulator import rendering
9291
9392 geoms : List [Geom ] = []
9493
9594 # Agent rotation
9695 for agent in self .world .agents :
97- color = Color .BLACK .value
98- line = rendering .Line (
99- (0 , 0 ),
100- (0.1 , 0 ),
101- width = 1 ,
96+ geoms .append (
97+ ScenarioUtils .plot_entity_rotation (agent , env_index , length = 0.1 )
10298 )
103- xform = rendering .Transform ()
104- xform .set_rotation (agent .state .rot [env_index ])
105- xform .set_translation (* agent .state .pos [env_index ])
106- line .add_attr (xform )
107- line .set_color (* color )
108- geoms .append (line )
10999
110100 return geoms
111101
Original file line number Diff line number Diff line change 1111from vmas .simulator .core import Agent , World
1212from vmas .simulator .dynamics .drone import Drone
1313from vmas .simulator .scenario import BaseScenario
14- from vmas .simulator .utils import Color , ScenarioUtils
14+ from vmas .simulator .utils import ScenarioUtils
1515
1616if typing .TYPE_CHECKING :
1717 from vmas .simulator .rendering import Geom
@@ -93,24 +93,14 @@ def done(self):
9393 )
9494
9595 def extra_render (self , env_index : int = 0 ) -> "List[Geom]" :
96- from vmas .simulator import rendering
9796
9897 geoms : List [Geom ] = []
9998
10099 # Agent rotation
101100 for agent in self .world .agents :
102- color = Color .BLACK .value
103- line = rendering .Line (
104- (0 , 0 ),
105- (0.1 , 0 ),
106- width = 1 ,
101+ geoms .append (
102+ ScenarioUtils .plot_entity_rotation (agent , env_index , length = 0.1 )
107103 )
108- xform = rendering .Transform ()
109- xform .set_rotation (agent .state .rot [env_index ])
110- xform .set_translation (* agent .state .pos [env_index ])
111- line .add_attr (xform )
112- line .set_color (* color )
113- geoms .append (line )
114104
115105 return geoms
116106
Original file line number Diff line number Diff line change 1212from vmas .simulator .dynamics .holonomic_with_rot import HolonomicWithRotation
1313from vmas .simulator .dynamics .kinematic_bicycle import KinematicBicycle
1414from vmas .simulator .scenario import BaseScenario
15- from vmas .simulator .utils import Color , ScenarioUtils
15+ from vmas .simulator .utils import ScenarioUtils
1616
1717if typing .TYPE_CHECKING :
1818 from vmas .simulator .rendering import Geom
@@ -99,24 +99,14 @@ def observation(self, agent: Agent):
9999 )
100100
101101 def extra_render (self , env_index : int = 0 ) -> "List[Geom]" :
102- from vmas .simulator import rendering
103102
104103 geoms : List [Geom ] = []
105104
106105 # Agent rotation
107106 for agent in self .world .agents :
108- color = Color .BLACK .value
109- line = rendering .Line (
110- (0 , 0 ),
111- (0.1 , 0 ),
112- width = 1 ,
107+ geoms .append (
108+ ScenarioUtils .plot_entity_rotation (agent , env_index , length = 0.1 )
113109 )
114- xform = rendering .Transform ()
115- xform .set_rotation (agent .state .rot [env_index ])
116- xform .set_translation (* agent .state .pos [env_index ])
117- line .add_attr (xform )
118- line .set_color (* color )
119- geoms .append (line )
120110
121111 return geoms
122112
You can’t perform that action at this time.
0 commit comments