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 11
11
from vmas .simulator .dynamics .diff_drive import DiffDrive
12
12
from vmas .simulator .dynamics .holonomic_with_rot import HolonomicWithRotation
13
13
from vmas .simulator .scenario import BaseScenario
14
- from vmas .simulator .utils import Color , ScenarioUtils
14
+ from vmas .simulator .utils import ScenarioUtils
15
15
16
16
if typing .TYPE_CHECKING :
17
17
from vmas .simulator .rendering import Geom
@@ -88,24 +88,14 @@ def observation(self, agent: Agent):
88
88
)
89
89
90
90
def extra_render (self , env_index : int = 0 ) -> "List[Geom]" :
91
- from vmas .simulator import rendering
92
91
93
92
geoms : List [Geom ] = []
94
93
95
94
# Agent rotation
96
95
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 )
102
98
)
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 )
109
99
110
100
return geoms
111
101
Original file line number Diff line number Diff line change 11
11
from vmas .simulator .core import Agent , World
12
12
from vmas .simulator .dynamics .drone import Drone
13
13
from vmas .simulator .scenario import BaseScenario
14
- from vmas .simulator .utils import Color , ScenarioUtils
14
+ from vmas .simulator .utils import ScenarioUtils
15
15
16
16
if typing .TYPE_CHECKING :
17
17
from vmas .simulator .rendering import Geom
@@ -93,24 +93,14 @@ def done(self):
93
93
)
94
94
95
95
def extra_render (self , env_index : int = 0 ) -> "List[Geom]" :
96
- from vmas .simulator import rendering
97
96
98
97
geoms : List [Geom ] = []
99
98
100
99
# Agent rotation
101
100
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 )
107
103
)
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 )
114
104
115
105
return geoms
116
106
Original file line number Diff line number Diff line change 12
12
from vmas .simulator .dynamics .holonomic_with_rot import HolonomicWithRotation
13
13
from vmas .simulator .dynamics .kinematic_bicycle import KinematicBicycle
14
14
from vmas .simulator .scenario import BaseScenario
15
- from vmas .simulator .utils import Color , ScenarioUtils
15
+ from vmas .simulator .utils import ScenarioUtils
16
16
17
17
if typing .TYPE_CHECKING :
18
18
from vmas .simulator .rendering import Geom
@@ -99,24 +99,14 @@ def observation(self, agent: Agent):
99
99
)
100
100
101
101
def extra_render (self , env_index : int = 0 ) -> "List[Geom]" :
102
- from vmas .simulator import rendering
103
102
104
103
geoms : List [Geom ] = []
105
104
106
105
# Agent rotation
107
106
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 )
113
109
)
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 )
120
110
121
111
return geoms
122
112
You can’t perform that action at this time.
0 commit comments