-
Notifications
You must be signed in to change notification settings - Fork 45
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
why my vehicle don't move? #257
Comments
For now I think your "AI" stops with the python script. |
I tried that, but I still can't get the vehicle to move according to my coordinates. Could it be related to the map? The map I loaded is gridsmall, and the road sign information in it is incomplete, making it impossible to move the vehicle. |
If you put the AI in |
Hi @lsm2842035890, This code works for me, you can try yourself: from beamngpy import BeamNGpy, Road, Scenario, Vehicle
def generate_scripts():
script = [
{'x': 0, 'y': 300, 'z': 0.1, 't': 0},
{'x': 0, 'y': 400, 'z': 0.1, 't': 10},
{'x': 0, 'y': 500, 'z': 0.1, 't': 20},
{'x': 0, 'y': 600, 'z': 0.1, 't': 30}
]
return script
def set_scripts():
bng = BeamNGpy('localhost', 64256)
bng.open()
scenario = Scenario('smallgrid', 'custom_road_network')
road_a = Road('track_editor_C_center', rid='center_road', looped=False)
road_a.add_nodes(
(0, 300, 0, 6),
(0, 400, 0, 6),
(0, 500, 0, 6),
(0, 600, 0, 6)
)
scenario.add_road(road_a)
vehicle = Vehicle('ego_vehicle', model='etk800')
scenario.add_vehicle(vehicle, pos=(0, 300, 0), rot_quat=(0, 0, 1, 0))
positions = [(0, 400, 0), (0, 500, 0), (0, 600, 0)]
scales = [(1., 1., 1.)] * 3
ids = ['my_waypoint_1', 'my_waypoint_2', 'my_waypoint_3']
scenario.add_checkpoints(positions, scales, ids)
scripts = generate_scripts()
scenario.make(bng)
bng.scenario.load(scenario)
bng.scenario.start()
vehicle.ai.set_speed(30, 'set')
vehicle.ai.execute_script(scripts)
set_scripts()
input('Press Enter to exit...') |
I was with the same point. That function here: It should record that points for us? Have some feacture that can helps with it? Or it is like try and error? In ai_line.py we have points passed by sin function, like: But if I load that map:
It will load this: I dont have the points to follow, but have someting to get the point at the moment to build it manualy? Was thinking about run that using:
|
I got those points here:
But looks that AI is not looking collision, just going on to the left wall. Those points have time enough to go across. |
I dont know if it will help anyone but.. The problem was that I was using the function to get my positions of the car on the street:
It returns:
The point is that the grid of the ground is a little bit higher then the grid of the car, so, when I passed the It is possible observe that have a line that going deep in to the ground, it is the second point that the car should go to, was the point of the bug. To fix that needed use an offset of
Using that we can get someting like that: |
I loaded the gridsmall map and paved a simple road. I want the vehicle to run according to my trajectory. Why does the vehicle not move?
The text was updated successfully, but these errors were encountered: