Remove the location argument when calling start()

This commit is contained in:
bernatx 2019-06-27 11:23:35 +02:00 committed by Néstor Subirón
parent 8ce3daadbe
commit 0e91e19c32
4 changed files with 8 additions and 9 deletions

View File

@ -14,7 +14,7 @@ namespace client {
WalkerAIController::WalkerAIController(ActorInitializer init)
: Actor(std::move(init)) {}
void WalkerAIController::Start(carla::geom::Location location) {
void WalkerAIController::Start() {
GetEpisode().Lock()->RegisterAIController(*this);
// add the walker in the Recast & Detour
@ -22,7 +22,7 @@ namespace client {
if (walker != nullptr) {
auto nav = GetEpisode().Lock()->GetNavigation();
if (nav != nullptr) {
nav->AddWalker(walker->GetId(), location);
nav->AddWalker(walker->GetId(), walker->GetLocation());
}
}
}

View File

@ -18,7 +18,7 @@ namespace client {
explicit WalkerAIController(ActorInitializer init);
void Start(carla::geom::Location location);
void Start();
void Stop();

View File

@ -356,8 +356,8 @@ namespace nav {
// force single thread running this
std::lock_guard<std::mutex> lock(_mutex);
// from Unreal coordinates
float PointFrom[3] = { from.x, from.z, from.y };
// from Unreal coordinates (subtract half height to move pivot from center (unreal) to bottom (recast))
float PointFrom[3] = { from.x, from.z - (AGENT_HEIGHT / 2.0f), from.y };
// add walker
int index = _crowd->addAgent(PointFrom, &params);
if (index == -1) {

View File

@ -172,11 +172,10 @@ def main():
for i in range(0, len(all_id), 2):
# index in the walkers_list
index = int(i / 2)
# set start position of walker
all_actors[i].start(walkers_list[index]["trans"].location)
# start walker
all_actors[i].start()
# set walk to random point
target = world.get_random_location_from_navigation()
all_actors[i].go_to_location(target)
all_actors[i].go_to_location(world.get_random_location_from_navigation())
# random max speed
all_actors[i].set_max_speed(1 + random.random()) # max speed between 1 and 2 (default is 1.4 m/s)