Skip to content

Commit

Permalink
Add qt as dependency. Fix render_points
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmadAmine998 committed Aug 6, 2024
1 parent 1da98e9 commit d8a3a45
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/waypoint_follow.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def render_lookahead_point(self, e):
if self.lookahead_point_render is None:
self.lookahead_point_render = e.render_points(points, color=(0, 0, 128), size=2)
else:
self.lookahead_point_render.updateItems(points)
self.lookahead_point_render.setData(points)

def render_local_plan(self, e):
"""
Expand All @@ -219,7 +219,7 @@ def render_local_plan(self, e):
if self.local_plan_render is None:
self.local_plan_render = e.render_lines(points, color=(0, 128, 0), size=1)
else:
self.local_plan_render.updateItems(points)
self.local_plan_render.setData(points)

def _get_current_waypoint(
self, waypoints, lookahead_distance, position, theta
Expand Down
9 changes: 4 additions & 5 deletions f1tenth_gym/envs/rendering/rendering_pyqt.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def render_points(
points: list | np.ndarray,
color: Optional[tuple[int, int, int]] = (0, 0, 255),
size: Optional[int] = 1,
) -> None:
) -> pg.PlotDataItem:
"""
Render a sequence of xy points on screen.
Expand All @@ -327,10 +327,9 @@ def render_points(
size : Optional[int], optional
size of the points in pixels, by default 1
"""
origin = self.map_origin
resolution = self.map_resolution
points = ((points - origin[:2]) / resolution).astype(int)
size = math.ceil(size)
return self.canvas.plot(
points[:, 0], points[:, 1], pen=None, symbol="o", symbolPen=pg.mkPen(color=color, width=0), symbolBrush=pg.mkBrush(color=color, width=0), symbolSize=size
)

def render_lines(
self,
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ opencv-python = "^4.9.0.80"
yamldataclassconfig = "^1.5.0"
requests = "^2.31.0"
shapely = "^2.0.2"
pyqtgraph = "^0.13.7"
PyQT6 = "^6.7.1"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.4"
Expand Down

0 comments on commit d8a3a45

Please sign in to comment.