Skip to content

[Feat] Render lidar before agents and allow for tuple as color#115

Merged
matteobettini merged 7 commits intoproroklab:mainfrom
Zartris:render_lidar_before_agents
Jun 27, 2024
Merged

[Feat] Render lidar before agents and allow for tuple as color#115
matteobettini merged 7 commits intoproroklab:mainfrom
Zartris:render_lidar_before_agents

Conversation

@Zartris
Copy link
Contributor

@Zartris Zartris commented Jun 25, 2024

image
Her is an image of my problem.

When lidar is rendered after the agent geom, it is hard to see the shape of the agent.

I have two methods for solving this.

  1. Render lidar before the agent, hence we can see the agent being rendered on top.
  2. Like in the Agent class, we make a getter function for color, that checks if it is an Enum or a tuple. This allows the user to specify an alpha on the lidar color. The downside of this is the user needs to understand that this color tuple needs to be 3 or 4 values, whereas before this was more restricted. But as this is the same as we do in the Agent class I do not see the big harm.

These are small changes that should not break anything.

…r function to lidar like in Agent.render so it allows for alpha in colors.
Copy link
Member

@matteobettini matteobettini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not so keen of changing the order of rendering objects (unless strictly necessary) as this might affect other users that were relying on sensors being rendered on top of the agent.

I am keen to add an alpha to sensors geoms, but we have to decide a way to uniform this.

Currently:

  • agents have self.color and self.alpha
  • entities have just self.color (which you just made me notice that it can sontrol alpha if it is size 4)

I think we should make also entities and sensors have self._alpha and force colors to be either the vmas object or a 3 dimentional tuple or tensor

Comment on lines 1052 to 1055

for geom in geoms:
geom.set_color(*self.color, alpha=self._alpha)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you are doing is now setting the colors of the sensor geoms to that of the agent


ray_circ = rendering.make_circle(0.01)
ray_circ.set_color(*self._render_color.value)
ray_circ.set_color(*self.render_color)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just affects the ray circ and not the line, your problem seems to be the line

@matteobettini matteobettini added the enhancement New feature or request label Jun 26, 2024
@Zartris
Copy link
Contributor Author

Zartris commented Jun 27, 2024

  1. Removed the render order change, so now it is back to being agent first then lidar
  2. Changed so now it is indeed the ray and not the circle color.
    3 .Added alpha in construct, changed it from a tuple of 4 to a tuple of 3.

Zartris and others added 2 commits June 27, 2024 13:48
Co-authored-by: Matteo Bettini <55539777+matteobettini@users.noreply.github.com>
Co-authored-by: Matteo Bettini <55539777+matteobettini@users.noreply.github.com>
Copy link
Member

@matteobettini matteobettini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect thanks!

These last changes and we are good to go

@matteobettini matteobettini merged commit a4a6ee2 into proroklab:main Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants