UT-Austin-RPL/Coopernaut

Collect RGB or RGBD images from front camera

gaopeng5 opened this issue · 5 comments

Thanks for sharing this amazing work!

I found the simulation can also set up front view Stereo Camera, could you please let me know how to record these images ?

Hi, You can set up the front-view camera, the main changes are:
Step 1:
In https://github.com/hangqiu/AutoCastSim/blob/5b6a5bdc591c01c6111f4de1c5af48fecd5117bf/AVR/DataLogger.py#L288
Add something like the following lines:

if 'Front' in name:
    format = '.png'
    if ego_vehicle_id_str in name:
        data[1].save_to_disk(os.path.join(episode_path, name, data_point_id.zfill(5) + format))

Step 2:
In https://github.com/hangqiu/AutoCastSim/blob/5b6a5bdc591c01c6111f4de1c5af48fecd5117bf/AVR/autocast_agents/simple_agent.py#L100-L109
Micmiking L100-L109, add ad sensor with id 'id=FrontRGB'. Example Code, you can simply modify :

            {'type': 'sensor.camera.rgb', 'x': 0.0, 'y': 0.0, 'z': 0.0, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
             'width': 1920, 'height': 1080, 'fov': 100, 'id': 'FrontRGB'},

(You should modify the width and height based on your need as this high resolution takes large storage.)
Let me know by @ me if you have further questions.

Thank you so much, Jiaxun! That works.

I just found a follow-up question, when I run the following command, it seems like only the ego vehicle can collect rgb data. Could you please help with it? Many thanks!

python3 AutoCastSim/parallel_scenario_runner.py
--agent AutoCastSim/AVR/autocast_agents/simple_agent.py
--reloadWorld
--port 2001
--trafficManagerPort 3123
--mqttport 4884
--bgtraffic 30
--num-workers 1
--file --sharing
--benchmark_config benchmark/scene6.json
--commlog
--full
--hud
--passive_collider
--outputdir ./results
--resample-config 'random_uniform'
--num-config 12

That's because we only record ego RGB data by default
https://github.com/hangqiu/AutoCastSim/blob/5b6a5bdc591c01c6111f4de1c5af48fecd5117bf/AVR/DataLogger.py#L289-L300
One way to work around this is removing the condition:

if ego_vehicle_id_str in name:

for the code we added, and same thing for other RGB cameras https://github.com/hangqiu/AutoCastSim/blob/5b6a5bdc591c01c6111f4de1c5af48fecd5117bf/AVR/DataLogger.py#L289-L300

Thanks for the help!