vista-simulator / vista

Data-driven simulation for training and evaluating full-scale autonomous vehicles.
https://vista.csail.mit.edu
Other
379 stars 88 forks source link

Cannot run basic examples #6

Open FahadRazaKhan opened 2 years ago

FahadRazaKhan commented 2 years ago

Hi,

I am trying to run basic examples (i.e sim_control.py, sim_lidar.py) after the installation, however, it gives me the following error "~/python3.8/site-packages/vista/core/World.py", line 32, in init self._traces: List[Trace] = [ TypeError: 'NoneType' object is not iterable"

Any help would be appreciated.

Thanks.

MarkCodering commented 2 years ago

@FahadRazaKhan I ran to this issue before. Could you paste your code snippet to help us better understand your script?

Potential Solution:

The experimental trace path could be download by following the instruction of this tutorial.

trace_path = ["./trace/20210726-154641_lexus_devens_center"]
world = vista.World(trace_path, trace_config={'road_width': 4})
FahadRazaKhan commented 2 years ago

@MarkCodering thanks for your response. Actually, I have just downloaded the Repo from Github, and after the installation, I tried to run the scripts in the example folder. I did not write anything. Do you still need to see the script?

MarkCodering commented 2 years ago

@FahadRazaKhan Good morning from Taiwan. If you want to run an example code like sim_rgb.py is not possible since the sample code hasn't loaded any trace dataset. You need to add the trace data like the code snippet I gave you in the comment before.

FahadRazaKhan commented 2 years ago

@MarkCodering thanks for your help and good morning from Singapore. I downloaded the traces as you suggested, but I am still getting some warnings and it seems simulator is not working properly. Here is the screenshot of my code sim_control.py (edited in basic examples).

Screenshot from 2022-06-28 09-48-25

MarkCodering commented 2 years ago

Good morning, @FahadRazaKhan. I just looked up your reply. I would suggest doing the following to solve the problem potentially.

  1. Install openeb dependency and initialize the module with set_env.sh
  2. Choose one trace path to run instead of multiple traces (It might confuse VISTA to run the computation.)

Here is my code snippet for your reference.

def main():
    trace_path = ["./trace/20210726-154641_lexus_devens_center"]
    world = vista.World(trace_path, trace_config={'road_width': 4})
    car = world.spawn_agent(
        config={
            'length': 5.,
            'width': 2.,
            'wheel_base': 2.78,
            'steering_ratio': 14.7,
            'lookahead_road': True
        })
    display = vista.Display(world)
    state_space_controller = [
        follow_human_trajectory, pure_pursuit_controller
    ][1]

    world.reset()
    display.reset()

    while not car.done:
        action = state_space_controller(car)
        car.step_dynamics(action)

        vis_img = display.render()
        cv2.imshow('Visualize control', vis_img[:, :, ::-1])
        cv2.waitKey(20)
osugiw commented 1 year ago

Good morning, @FahadRazaKhan. I just looked up your reply. I would suggest doing the following to solve the problem potentially.

  1. Install openeb dependency and initialize the module with set_env.sh
  2. Choose one trace path to run instead of multiple traces (It might confuse VISTA to run the computation.)

Here is my code snippet for your reference.

def main():
    trace_path = ["./trace/20210726-154641_lexus_devens_center"]
    world = vista.World(trace_path, trace_config={'road_width': 4})
    car = world.spawn_agent(
        config={
            'length': 5.,
            'width': 2.,
            'wheel_base': 2.78,
            'steering_ratio': 14.7,
            'lookahead_road': True
        })
    display = vista.Display(world)
    state_space_controller = [
        follow_human_trajectory, pure_pursuit_controller
    ][1]

    world.reset()
    display.reset()

    while not car.done:
        action = state_space_controller(car)
        car.step_dynamics(action)

        vis_img = display.render()
        cv2.imshow('Visualize control', vis_img[:, :, ::-1])
        cv2.waitKey(20)

Hi, the latest repository doesn't contain trace/20210726-154641_lexus_devens_center; how could I obtain the data? Thanks in advance!

MarkCodering commented 1 year ago

Hi, @osugiw you can search for the author’s class, introduction to deep learning with its dataset sample

ParvezAlam123 commented 1 year ago

Hello MarkCodering, I am not able to run basic example code: import argparse import numpy as np import os import cv2

import vista from vista.utils import transform from vista.entities.agents.Dynamics import tireangle2curvature

def main(): trace_path = ["/home/parvez_alam/Downloads/vista_traces/20210726-131322_lexus_devens_center"]
world = vista.World(trace_path, trace_config={'road_width': 4}) car = world.spawn_agent( config={ 'length': 5., 'width': 2., 'wheel_base': 2.78, 'steering_ratio': 14.7, 'lookahead_road': True }) display = vista.Display(world)

state_space_controller = [

#   follow_human_trajectory, pure_pursuit_controller
#][1]

world.reset()
display.reset()

while not car.done:
    #action = state_space_controller(car)
    #car.step_dynamics(action)

    vis_img = display.render()
    cv2.imshow('Visualize control', vis_img[:, :, ::-1])
    cv2.waitKey(20) 

main()

error: 2023-08-01 15:15:54,426::WARNING::[vista.entities.sensors.EventCamera.] Fail to import module for event camera. Remember to do source /openeb/build/utils/scripts/setup_env.shCan ignore this if not using it 2023-08-01 15:15:55,130::WARNING::[vista.core.Trace._divide_to_good_segments] No video_label.csv Traceback (most recent call last): File "vista1.py", line 43, in main() File "vista1.py", line 37, in main vis_img = display.render() File "/home/parvez_alam/.local/lib/python3.8/site-packages/vista/core/Display.py", line 227, in render patch = PolygonPatch(patch, File "/home/parvez_alam/.local/lib/python3.8/site-packages/descartes/patch.py", line 87, in PolygonPatch return PathPatch(PolygonPath(polygon), **kwargs) File "/home/parvez_alam/.local/lib/python3.8/site-packages/descartes/patch.py", line 62, in PolygonPath vertices = concatenate([ File "/home/parvez_alam/.local/lib/python3.8/site-packages/descartes/patch.py", line 63, in concatenate([asarray(t.exterior)[:, :2]] + IndexError: too many indices for array: array is 0-dimensional, but 2 were indexed

May you help ?

masskro0 commented 1 year ago

Hello MarkCodering, I am not able to run basic example code: import argparse import numpy as np import os import cv2

import vista from vista.utils import transform from vista.entities.agents.Dynamics import tireangle2curvature

def main(): trace_path = ["/home/parvez_alam/Downloads/vista_traces/20210726-131322_lexus_devens_center"] world = vista.World(trace_path, trace_config={'road_width': 4}) car = world.spawn_agent( config={ 'length': 5., 'width': 2., 'wheel_base': 2.78, 'steering_ratio': 14.7, 'lookahead_road': True }) display = vista.Display(world) #state_space_controller = [ # follow_human_trajectory, pure_pursuit_controller #][1]

world.reset()
display.reset()

while not car.done:
    #action = state_space_controller(car)
    #car.step_dynamics(action)

    vis_img = display.render()
    cv2.imshow('Visualize control', vis_img[:, :, ::-1])
    cv2.waitKey(20) 

main()

error: 2023-08-01 15:15:54,426::WARNING::[vista.entities.sensors.EventCamera.] Fail to import module for event camera. Remember to do source /openeb/build/utils/scripts/setup_env.shCan ignore this if not using it 2023-08-01 15:15:55,130::WARNING::[vista.core.Trace._divide_to_good_segments] No video_label.csv Traceback (most recent call last): File "vista1.py", line 43, in main() File "vista1.py", line 37, in main vis_img = display.render() File "/home/parvez_alam/.local/lib/python3.8/site-packages/vista/core/Display.py", line 227, in render patch = PolygonPatch(patch, File "/home/parvez_alam/.local/lib/python3.8/site-packages/descartes/patch.py", line 87, in PolygonPatch return PathPatch(PolygonPath(polygon), **kwargs) File "/home/parvez_alam/.local/lib/python3.8/site-packages/descartes/patch.py", line 62, in PolygonPath vertices = concatenate([ File "/home/parvez_alam/.local/lib/python3.8/site-packages/descartes/patch.py", line 63, in concatenate([asarray(t.exterior)[:, :2]] + IndexError: too many indices for array: array is 0-dimensional, but 2 were indexed

May you help ?

@ParvezAlam123 Had the same issue. This reply helped me: https://github.com/vista-simulator/vista/issues/20#issuecomment-1623287350