8000 add multi vehicle control API by sina-sixwheel · Pull Request #3 · sixwheel-inc/carla · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add multi vehicle control API #3

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

Open
wants to merge 2 commits into
base: release/0.9.15
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions LibCarla/source/carla/client/World.cpp
8000
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ namespace client {
return _episode.Lock()->GetWeatherParameters();
}

void World::EnableMultiVehicleChrono(const std::vector<ActorId>& vehicle_ids) const {
log_warning("World::EnableMultiVehicleChrono is not implemented yet.");
}

void World::SetWeather(const rpc::WeatherParameters &weather) {
_episode.Lock()->SetWeatherParameters(weather);
}
Expand Down
2 changes: 2 additions & 0 deletions LibCarla/source/carla/client/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ namespace client {

void UnloadLevelLayer(rpc::MapLayer map_layers) const;

void EnableMultiVehicleChrono(const std::vector<ActorId>& vehicle_ids) const;

/// Return the list of blueprints available in this world. This blueprints
/// can be used to spawning actor into the world.
SharedPtr<BlueprintLibrary> GetBlueprintLibrary() const;
Expand Down
1 change: 1 addition & 0 deletions PythonAPI/carla/source/libcarla/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ void export_world() {
.def("get_snapshot", &cc::World::GetSnapshot)
.def("get_actor", CONST_CALL_WITHOUT_GIL_1(cc::World, GetActor, carla::ActorId), (arg("actor_id")))
.def("get_actors", CONST_CALL_WITHOUT_GIL(cc::World, GetActors))
.def("enable_multi_vehicle_chrono", &cc::World::EnableMultiVehicleChrono, (arg("vehicle_ids")))
.def("get_actors", &GetActorsById, (arg("actor_ids")))
.def("spawn_actor", SPAWN_ACTOR_WITHOUT_GIL(SpawnActor))
.def("try_spawn_actor", SPAWN_ACTOR_WITHOUT_GIL(TrySpawnActor))
Expand Down
8 changes: 4 additions & 4 deletions PythonAPI/examples/manual_control_chrono.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ class KeyboardControl(object):
"""Class that handles keyboard input."""
def __init__(self, world, start_in_autopilot):
self._carsim_enabled = False
self._chrono_enabled = False
self._carsim_road = False
self._autopilot_enabled = start_in_autopilot
if isinstance(world.player, carla.Vehicle):
Expand Down Expand Up @@ -434,10 +435,9 @@ def parse_events(self, client, world, clock):
self._carsim_road = not self._carsim_road
world.player.use_carsim_road(self._carsim_road)
print("j pressed, using carsim road =", self._carsim_road)
# elif event.key == K_i and (pygame.key.get_mods() & KMOD_CTRL):
# print("i pressed")
# imp = carla.Location(z=50000)
# world.player.add_impulse(imp)
elif event.key == K_i and (pygame.key.get_mods() & KMOD_CTRL):
print("i pressed")
world.enable_multi_vehicle_chrono([world.player.id])
elif event.key == K_MINUS and (pygame.key.get_mods() & KMOD_CTRL):
if pygame.key.get_mods() & KMOD_SHIFT:
world.recording_start -= 10
Expand Down
0