-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Current, VMAS seemly does not support a customized, fixed viewer bound in interactive mode. This feature would be useful if the origin [0, world_x_dim], and the [0, world_y_dim], instead of [-world_x_dim/2, world_x_dim/2] and [-world_y_dim/2, world_y_dim/2]. In addition, I do not want to shift my map since I am using an HD map with dense data.
My current workaround is to add an attribute viewer_bound in my Scenario class's make_world function:
self.viewer_bound = torch.tensor(
[0, world_x_dim, 0, world_y_dim],
device=device,
dtype=torch.float32,
)
and then modify the source code of file /vmas/simulator/environment/environment.py around this line from
self.viewer.set_bounds(
-cam_range[X],
cam_range[X],
-cam_range[Y],
cam_range[Y],
)
to
if hasattr(self.scenario, "viewer_bound"):
self.viewer.set_bounds(
self.scenario.viewer_bound[0], # left boundary
self.scenario.viewer_bound[1], # right boundary
self.scenario.viewer_bound[2], # bottom boundary
self.scenario.viewer_bound[3], # top boundary
)
else:
self.viewer.set_bounds(
-cam_range[X],
cam_range[X],
-cam_range[Y],
cam_range[Y],
)
This way, if self.scenario contains the user-given attibute viewer_bound, the viewer bound will be set accordingly; otherwise, the funtionality is untouched.
I would appreciate it if anyone could point out if there is an easier way to achieve this. If not, I think it would be nice if the developer would add such a feature to VMAS.