Code Monkey home page Code Monkey logo

Boost.Python.ArgumentError: Python argument types in VehicleControl.__init__(VehicleControl) did not match C++ signature: __init__(struct _object * __ptr64, float throttle=0.0, float steer=0.0, float brake=0.0, bool hand_brake=False, bool reverse=False, bool manual_gear_shift=False, int gear=0) __init__(struct _object * __ptr64) about carla HOT 9 OPEN

catarinam93 avatar catarinam93 commented on June 3, 2024
Boost.Python.ArgumentError: Python argument types in VehicleControl.__init__(VehicleControl) did not match C++ signature: __init__(struct _object * __ptr64, float throttle=0.0, float steer=0.0, float brake=0.0, bool hand_brake=False, bool reverse=False, bool manual_gear_shift=False, int gear=0) __init__(struct _object * __ptr64)

from carla.

Comments (9)

GoodarzMehr avatar GoodarzMehr commented on June 3, 2024

The arguments to VehicleControl should be float values, seems like you are passing float arrays to it instead.

from carla.

catarinam93 avatar catarinam93 commented on June 3, 2024

The arguments to VehicleControl should be float values, seems like you are passing float arrays to it instead.

In that case I get the following:
Assertion failed: (_clients.find(token.get_stream_id())) ==(_clients.end()), file C:\workspace\carla\LibCarla\cmake\..\source\carla/streaming/low_level/Client.h, line 56
:/

from carla.

joel-mb avatar joel-mb commented on June 3, 2024

@catarinam93 As @GoodarzMehr has said this error means there is a mismatch in the python arguments types your are sending to the carla.VehicleControl.

From your code it seems you are using a numpy.float32 type instead of float. Please, convert these values to float first:

ego_vehicle_control = carla.VehicleControl(throttle=float(linear_velocity), steer=float(angular_velocity)) 

from carla.

catarinam93 avatar catarinam93 commented on June 3, 2024

@catarinam93 As @GoodarzMehr has said this error means there is a mismatch in the python arguments types your are sending to the carla.VehicleControl.

From your code it seems you are using a numpy.float32 type instead of float. Please, convert these values to float first:

ego_vehicle_control = carla.VehicleControl(throttle=float(linear_velocity), steer=float(angular_velocity)) 

Passing as floats I get the following:
Assertion failed: (_clients.find(token.get_stream_id())) ==(_clients.end()), file C:\workspace\carla\LibCarla\cmake..\source\carla/streaming/low_level/Client.h, line 56

What should I do?

from carla.

GoodarzMehr avatar GoodarzMehr commented on June 3, 2024

Can you print the full stack trace please? It's hard to know what happened based on a single line of error.

from carla.

catarinam93 avatar catarinam93 commented on June 3, 2024

Can you print the full stack trace please? It's hard to know what happened based on a single line of error.

C:\Users\Caty\Documents\Transfer-Reinforcement-Learning-for-Enhanced-Autonomy-in-Vehicles>python main.py INFO: Found the required file in cache! Carla/Maps/Nav/Town01.bin INFO: Connection has been setup successfully. INFO: Found the required file in cache! Carla/Maps/TM/Town01.bin Car Spawned Path Generated Sensors Spawned Using cpu device Wrapping the env with a Monitor wrapper Wrapping the env in a DummyVecEnv. Assertion failed: (_clients.find(token.get_stream_id())) == (_clients.end()), file C:\workspace\carla\LibCarla\cmake\..\source\carla/streaming/low_level/Client.h, line 56

I am using a gymnasium environment btw

from carla.

GoodarzMehr avatar GoodarzMehr commented on June 3, 2024

Since the error is somewhat coming out of nowhere, using the traceback package might be helpful in debugging the code. You can use something like this in your main file:

try:
    ...
except Exception:
    print(traceback.format_exc())

Given where the error is coming from, there is a good chance it is unrelated to VehicleControl and perhaps more related to how you've set up your Gymnasium environment. I've used VehicleControl in a Gymnasium environment before and everything worked fine (I was using Ubuntu though, don't know about Windows).

from carla.

catarinam93 avatar catarinam93 commented on June 3, 2024

Since the error is somewhat coming out of nowhere, using the traceback package might be helpful in debugging the code. You can use something like this in your main file:

try:
    ...
except Exception:
    print(traceback.format_exc())

Given where the error is coming from, there is a good chance it is unrelated to VehicleControl and perhaps more related to how you've set up your Gymnasium environment. I've used VehicleControl in a Gymnasium environment before and everything worked fine (I was using Ubuntu though, don't know about Windows).

I did that (I think:)) in my main file:
`...
try:

# ----------------------------------------------- PPO Algorithm ----------------------------------------------
    ppo = PPO(policy="MlpPolicy", env=env, verbose=1) # Instantiate PPO algorithm
    ppo.learn(total_timesteps=100) # Train the PPO algorithm

    # ppo.save("trained_ppo_model") # Save the trained model
    # ppo.evaluate(env, n_eval_episodes=10) # Evaluate the trained model
except Exception:
    print(traceback.format_exc())`

but the outcome on the cmd was exactly the same :/

from carla.

GoodarzMehr avatar GoodarzMehr commented on June 3, 2024

I'm not really sure what to make of this, perhaps someone like @joel-mb from the CARLA team can help you better. There isn't a lot of information in that specific Client.h file apart from the fact that a client cannot subscribe twice to the same stream. I also found #7295 but there isn't much information in that either. Based on these two, the only thing I can think of is that perhaps your client is somehow listening to a sensor's datastream twice (maybe because you are vectorizing the environment for RL training?)

I doubt this new error is related to your use of VehicleControl, so one thing you could do is use a debugger (e.g. VSCode's Python Debugger) to see how your code progresses and where the problematic line is. Or you can just put print() lines along your code and see what gets printed and what doesn't to see which lines get executed and which line throws out the error.

from carla.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.