tud-hri/joan

How to save camera snapshots

Closed this issue · 8 comments

Hello,

I would love to take snapshots with joan as the Ego vehicle is driven by human. Is it possible to do so in Joan ?

hi @KAArunmoli!

This is something that is not implemented in JOAN yet. But it should be possible to add it to the carlainterface module. Carla itself has camera objects that return image objects to the python side. These images can be saved.

Hello @OlgerSiebinga,

Thanks for your reply. Could you tell me in which particular function I need to add these changes ? I tried to change the ego_vehicle.py function (in do() function) but was not able to save the images.

as long as you add it in a do() function in carlainterface it should work. You could add it in an agent, or in the main process. As long as you can get the camera object from the carla client, you should be fine.

@OlgerSiebinga Do you mean do() or do_while_running() ? Because is see the latter in the carlainterface module

You're right! It's do_while_running()

Hey @OlgerSiebinga. I tried to add the carla command for saving in the do_while_running() function, but the rendering is not happening because i think CARLA takes time to render the images and JOAN doesnt gives it time to render the images and jump to the next frame. I also tried using Queues so that the images are synchronised, but still it doesnt work. Is there any fix for this issue ?

Hi @KAArunmoli.
I'm happy to help but I think I need some extra information to help you.

  • What is it exactly that you try to do? Do you want to save every single frame of the simulation as an image?
  • What is the current behavior? Do you get any warnings or exceptions? Does the camera object actually return an image?
  • Do you have a forked repo I can have a look at to see how you've implemented this currently?

There are some things you could try:

  • you could try to stop the time of the Carla interface module while saving the image. This will mess up the simulation but might provide enough time to save the image if that's really the problem.
  • You could also try to create a new module with its own Carla client whose only purpose is to save images. This would allow you to handle this in a function that's not called in a loop
  • But I would start with checking what the current problem is. Is it the saving of the image that takes too much time, or the retrieving of the image object? The queue you mentioned will only fix the first problem, not the second.

hopefully, this helps.

Hi @OlgerSiebinga,

  1. I am trying to take the sanp shots of each frame in the simulation as image.
  2. The current behaviour is able to save to save image but the images are just black.
  3. I dont have the repo yet, but I can share the file with your through you mail address. I have made changes in the CarlaInterface Module and the agentclass module (in ego vehicle)