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 Apr 21, 2021
1 parent 3026bb2 commit 00d9737
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 @@ -193,7 +193,17 @@ 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;
}

bool WorldSimApi::addVehicle(const std::string& vehicle_name, const std::string& vehicle_type, const WorldSimApi::Pose& pose, const std::string& pawn_path)
{
Expand Down
1 change: 1 addition & 0 deletions Unity/AirLibWrapper/AirsimWrapper/Source/WorldSimApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class WorldSimApi : public msr::airlib::WorldSimApiBase
virtual void setWind(const Vector3r& wind) const override;
virtual bool createVoxelGrid(const Vector3r& position, const int& x_size, const int& y_size, const int& z_size, const float& res, const std::string& output_file) override;
virtual bool addVehicle(const std::string& vehicle_name, const std::string& vehicle_type, const Pose& pose, const std::string& pawn_path = "") override;
virtual std::vector<std::string> listVehicles() const override;

virtual std::string getSettingsString() const override;

Expand Down

0 comments on commit 00d9737

Please sign in to comment.