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 Oct 9, 2020
1 parent 032f6d7 commit 6d2de35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ bool WorldSimApi::isRecording() const
void WorldSimApi::setWind(const Vector3r& wind) const
{
simmode_->setWind(wind);
};
}

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
1 change: 1 addition & 0 deletions Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class WorldSimApi : public msr::airlib::WorldSimApiBase
virtual bool isRecording() const override;

virtual void setWind(const Vector3r& wind) const override;
virtual std::vector<std::string> listVehicles() const override;

private:
SimModeBase * simmode_;
Expand Down

0 comments on commit 6d2de35

Please sign in to comment.