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

Not able to run basic usage examples #21

Open
ParvezAlam123 opened this issue Aug 1, 2023 · 0 comments
Open

Not able to run basic usage examples #21

ParvezAlam123 opened this issue Aug 1, 2023 · 0 comments

Comments

@ParvezAlam123
Copy link

Hello All,
I am trying to run following basic 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
trace_path = ["/home/parvez_alam/Downloads/vista_traces/20210726-131322_lexus_devens_center"]

def main(trace_path):
   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
    })

camera = car.spawn_camera(config={
    'size': (200, 320),
})
display = vista.Display(world)

world.reset()
display.reset()

while not car.done:
    action = follow_human_trajectory(car)
    car.step_dynamics(action)
    car.step_sensors()

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


def follow_human_trajectory(agent):
    action = np.array([
       agent.trace.f_curvature(agent.timestamp),
       agent.trace.f_speed(agent.timestamp)
    ])
    return action






main(trace_path)

But it is showing following error
2023-08-01 16:24:26,442::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 16:24:27,060::WARNING::[vista.core.Trace._divide_to_good_segments] No video_label.csv
2023-08-01 16:24:28,728::WARNING::[vista.entities.sensors.Camera.reset] No flow data
Traceback (most recent call last):
File "vista1.py", line 54, in
main(trace_path)
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

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

No branches or pull requests

1 participant