juanmanzanero / fastest-lap

Fastest-lap is a vehicle dynamics simulator. It can be used to understand vehicle dynamics, to learn about driving techniques, to design car prototypes, or just for fun!
MIT License
575 stars 43 forks source link

Bad cast #43

Open TylerPaquette opened 1 year ago

TylerPaquette commented 1 year ago

Hi,

I am using v0.5 on Ubuntu 22, built and installed from source. I am running this through matlab and all is well but I am getting a segfault following the quickstart example. The only error I can see is this in terminal, and it seems to happen on calling optimal_laptime function.

[C++ exception] -> std::bad_cast
terminate called after throwing an instance of 'std::exception'
  what():  std::exception
Aborted (core dumped)

The whole program I am running is just this (quickstart code):

import sys,os,inspect
sys.path.append("/home/tyler/fastest-lap/src/main/python/")
import fastest_lap

vehicle_name = "car"
fastest_lap.create_vehicle_from_xml(vehicle_name, "/home/tyler/fastest-lap/database/vehicles/f1/mercedes-2020-catalunya.xml");
track_name = "catalunya"
fastest_lap.create_track_from_xml(track_name, "/home/tyler/fastest-lap/database/tracks/catalunya/catalunya_adapted.xml");
s = fastest_lap.track_download_data(track_name,"arclength");

options  = "<options>"
options += "<output_variables>"
options += "<prefix>run/</prefix>"
options += "</output_variables>"
options += "<print_level> 5 </print_level>"
options += "</options>"

#print(vehicle)
#print(track)
#print(s)
#print(options)

run = fastest_lap.download_variables(*fastest_lap.optimal_laptime(vehicle_name, track_name, s, options));

Should note this terminal output is from simply running this using python (3.10) and not the matlab api.

Have you seen this or know what might cause this? Thanks