Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene plotter visualiztion features #134

Merged

Conversation

KieranRatcliffeInvertedAI
Copy link
Contributor

Added the capability to change the colours of all agents, including the colour of their edges, to ScenePlotter. This should not force any existing implementations of ScenePlotter but give some visualization flexibility internally or externally if the user chooses to do so.
Are there any other features that might be interesting to add to this PR such as adding agent path visualization to ScenePlotter?

@@ -713,7 +718,17 @@ def plot_frame(self, idx, ax=None, numbers=False, direction_vec=False,

def animate_scene(self, output_name=None, start_idx=0, end_idx=-1, ax=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great to add a docstring and some type hints here.

(I apologize for not doing that when I originally made this, but it's not too late to start :) )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I am going through the attributes and methods making docstrings, I have two questions as of now:

  1. What does open_drive do? It appears to be a flag that enables different behaviour but what is the high level function of these different execution paths?
  2. It seems like there are a lot of parameters from the LocationResponse dataclass are input separately into the class. My question is why is this done separately instead of just inputting the LocationResponse directly? Is there any use case where a user needs to modify these parameters after getting the LocationResponse individually since it is opening this tool up to misuse and seems overall clunky.

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. I don't know what open_drive does unfortunately. Maybe that's something Alireza added?

  2. If you can refactor that I would say go for it, seems like a sensible thing to do!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was said in-person but for documentation purposes, I will be taking this feedback and doing a larger refactor of ScenePlotter.

c = self.agent_c
lw = 1
fc = self._get_color(agent_idx,self.agent_face_colors)
if not fc:
Copy link
Contributor

Choose a reason for hiding this comment

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

You should use if fc is None here. Although in this case I think you'd be OK, it is generally not a good idea to check for None as a boolean (the problem is that 0, [] and '' are also False, but they are not None). See: https://peps.python.org/pep-0008/#programming-recommendations

@adscib
Copy link
Contributor

adscib commented Aug 18, 2023

Do you have more changes coming? If so, I'll hold off on reviewing for now.

@KieranRatcliffeInvertedAI
Copy link
Contributor Author

Do you have more changes coming? If so, I'll hold off on reviewing for now.

I do have some more changes coming and am doing a larger refactor.

@adscib adscib removed their request for review August 18, 2023 18:15
@adscib
Copy link
Contributor

adscib commented Aug 18, 2023

OK, let me know when it's ready.

@KieranRatcliffeInvertedAI
Copy link
Contributor Author

KieranRatcliffeInvertedAI commented Aug 23, 2023

This PR is ready for a re-review. Noteable changes include:

  1. All the open_drive relevant parameters as kwargs since this functionality will be used rarely.
  2. Condensed the input parameters to a LocationResponse instead of inputting the parameters individually.
  3. Added docustrings to the client-facing member functions of ScenePlotter.
  4. Added data validation to the client-facing functions.
  5. Added the ability to manually control the colours of the faces and edges of all agents.
  6. Added sphinx documentation so ScenePlotter will be documented on our website.
  7. Updated the demos to use the new ScenePlotter input parameters.

Copy link
Contributor

@bzwartsenberg bzwartsenberg left a comment

Choose a reason for hiding this comment

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

This looks awesome. I have not had time to look at the notebooks, but the updates to ScenePLotter look awesome, it's great to have some actual docstrings now.

I could come back to the notebooks, if you want, but that seems like it might benefit from Frank / Robert's opinion more than mine.

@KieranRatcliffeInvertedAI
Copy link
Contributor Author

@bzwartsenberg coming back to this and seeing if there is time to review this?

Copy link
Contributor

@bzwartsenberg bzwartsenberg left a comment

Choose a reason for hiding this comment

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

Again I have not looked carefully at the jupyter notebooks, but if the updates are only to propagate changes to the ScenePlotter itself that should be all good.

@KieranRatcliffeInvertedAI
Copy link
Contributor Author

@adscib I am going through old PR's and I've changed this to be more backwards compatible, requiring less concern about merging. Essentially this adds documentation and cleaned up the scene plotter, as well as adding left-hand option for visualizing Carla maps more easily.
Let me know if you think there are any issues and if we can merge this into develop.

@KieranRatcliffeInvertedAI
Copy link
Contributor Author

@adscib Pinging this PR again to get the go-ahead to merge this into develop. Added some changes to update this branch to fit with changes to the develop branch.

@KieranRatcliffeInvertedAI KieranRatcliffeInvertedAI merged commit ab4cfe3 into develop Aug 1, 2024
5 checks passed
@KieranRatcliffeInvertedAI KieranRatcliffeInvertedAI deleted the scene_plotter_visualiztion_features branch August 1, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants