Skip to content

Commit

Permalink
[Unity] Add listVehicles API
Browse files Browse the repository at this point in the history
  • Loading branch information
rajat2004 committed Aug 16, 2020
1 parent 3a90233 commit e5f229b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,15 @@ bool WorldSimApi::isRecording() const
return false;
}

std::vector<std::string> WorldSimApi::listVehicles() const
{
auto vehicle_names = (simmode_->getApiProvider()->getVehicleSimApis()).keys();
// Remove '' from the list, representing default vehicle
auto position = std::find(vehicle_names.begin(), vehicle_names.end(), "");
if (position != vehicle_names.end())
vehicle_names.erase(position);
return vehicle_names;
}


#pragma endregion
2 changes: 2 additions & 0 deletions Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class WorldSimApi : public msr::airlib::WorldSimApiBase
virtual void stopRecording() override;
virtual bool isRecording() const override;

virtual std::vector<std::string> listVehicles() const override;

private:
SimModeBase * simmode_;
std::string vehicle_name_;
Expand Down

0 comments on commit e5f229b

Please sign in to comment.