Skip to content

Commit 0985804

Browse files
authored
Merge pull request #84 from joelreymont/main
Update to UE 5.3
2 parents 2e4b784 + f573de8 commit 0985804

28 files changed

+333
-120
lines changed

AirLib/include/api/RpcLibClientBase.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ namespace airlib
6060
void simSetWeatherParameter(WorldSimApiBase::WeatherParameter param, float val);
6161

6262
vector<string> simListSceneObjects(const string& name_regex = string(".*")) const;
63+
vector<string> simListSceneObjectsByTag(const string& tag_regex = string(".*")) const;
64+
6365
Pose simGetObjectPose(const std::string& object_name) const;
6466
bool simLoadLevel(const string& level_name);
6567
Vector3r simGetObjectScale(const std::string& object_name) const;
@@ -163,6 +165,8 @@ namespace airlib
163165
void simSetWind(const Vector3r& wind) const;
164166
void simSetExtForce(const Vector3r& ext_force) const;
165167

168+
Vector3r simFindLookAtRotation(const std::string& vehicle_name, const std::string& object_name) const;
169+
166170
vector<string> listVehicles();
167171

168172
std::string getSettingsString() const;

AirLib/include/api/WorldSimApiBase.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ namespace airlib
6767
virtual void simPlotTransformsWithNames(const vector<Pose>& poses, const vector<std::string>& names, float tf_scale, float tf_thickness, float text_scale, const vector<float>& text_color_rgba, float duration) = 0;
6868

6969
virtual std::vector<std::string> listSceneObjects(const std::string& name_regex) const = 0;
70+
virtual std::vector<std::string> listSceneObjectsByTag(const std::string& tag_regex) const = 0;
71+
7072
virtual Pose getObjectPose(const std::string& object_name) const = 0;
7173
virtual Vector3r getObjectScale(const std::string& object_name) const = 0;
7274
virtual bool setObjectPose(const std::string& object_name, const Pose& pose, bool teleport) = 0;
@@ -79,6 +81,7 @@ namespace airlib
7981
virtual vector<MeshPositionVertexBuffersResponse> getMeshPositionVertexBuffers() const = 0;
8082

8183
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) = 0;
84+
virtual Vector3r findLookAtRotation(const std::string& vehicle_name, const std::string& object_name) = 0;
8285

8386
// Recording APIs
8487
virtual void startRecording() = 0;

AirLib/src/api/RpcLibClientBase.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,11 @@ __pragma(warning(disable : 4239))
488488
return pimpl_->client.call("simListSceneObjects", name_regex).as<vector<string>>();
489489
}
490490

491+
vector<string> RpcLibClientBase::simListSceneObjectsByTag(const string& tag_regex) const
492+
{
493+
return pimpl_->client.call("simListSceneObjectsByTag", tag_regex).as<vector<string>>();
494+
}
495+
491496
std::vector<std::string> RpcLibClientBase::simSwapTextures(const std::string& tags, int tex_id, int component_id, int material_id)
492497
{
493498
return pimpl_->client.call("simSwapTextures", tags, tex_id, component_id, material_id).as<vector<string>>();
@@ -578,6 +583,11 @@ __pragma(warning(disable : 4239))
578583
return pimpl_->client.call("simCreateVoxelGrid", RpcLibAdaptorsBase::Vector3r(position), x, y, z, res, output_file).as<bool>();
579584
}
580585

586+
msr::airlib::Vector3r RpcLibClientBase::simFindLookAtRotation(const std::string& vehicle_name, const std::string& object_name) const
587+
{
588+
return pimpl_->client.call("simFindLookAtRotation", vehicle_name, object_name).as<RpcLibAdaptorsBase::Vector3r>().to();
589+
}
590+
581591
void RpcLibClientBase::cancelLastTask(const std::string& vehicle_name)
582592
{
583593
pimpl_->client.call("cancelLastTask", vehicle_name);

AirLib/src/api/RpcLibServerBase.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ namespace airlib
364364
return getWorldSimApi()->listSceneObjects(name_regex);
365365
});
366366

367+
pimpl_->server.bind("simListSceneObjectsByTag", [&](const std::string& tag_regex) -> std::vector<string> {
368+
return getWorldSimApi()->listSceneObjectsByTag(tag_regex);
369+
});
370+
367371
pimpl_->server.bind("simLoadLevel", [&](const std::string& level_name) -> bool {
368372
return getWorldSimApi()->loadLevel(level_name);
369373
});
@@ -512,6 +516,11 @@ namespace airlib
512516
return getWorldSimApi()->getSettingsString();
513517
});
514518

519+
pimpl_->server.bind("simFindLookAtRotation", [&](const std::string& vehicle_name, const std::string& object_name) -> RpcLibAdaptorsBase::Vector3r {
520+
const auto& rot = getWorldSimApi()->findLookAtRotation(vehicle_name, object_name);
521+
return RpcLibAdaptorsBase::Vector3r(rot);
522+
});
523+
515524
//if we don't suppress then server will bomb out for exceptions raised by any method
516525
pimpl_->server.suppress_exceptions(true);
517526
}

PythonClient/airsim/client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,20 @@ def simListSceneObjects(self, name_regex = '.*'):
555555
"""
556556
return self.client.call('simListSceneObjects', name_regex)
557557

558+
def simListSceneObjectsByTag(self, tag_regex = '.*'):
559+
"""
560+
Lists the objects present in the environment by searching their tags
561+
562+
Default behaviour is to list all objects, regex can be used to return smaller list of matching objects or actors
563+
564+
Args:
565+
tag_regex (str, optional): String to match actor tags against, e.g. "Tag.*"
566+
567+
Returns:
568+
list[str]: List containing all the names
569+
"""
570+
return self.client.call('simListSceneObjectsByTag', tag_regex)
571+
558572
def simLoadLevel(self, level_name):
559573
"""
560574
Loads a level specified by its name
@@ -1123,6 +1137,9 @@ def simSetExtForce(self, ext_force):
11231137
"""
11241138
self.client.call('simSetExtForce', ext_force)
11251139

1140+
def simFindLookAtRotation(self, object_name, vehicle_name = ''):
1141+
return self.client.call('simFindLookAtRotation', vehicle_name, object_name)
1142+
11261143
# ----------------------------------- Multirotor APIs ---------------------------------------------
11271144
class MultirotorClient(VehicleClient, object):
11281145
def __init__(self, ip = "", port = 41451, timeout_value = 3600):

PythonClient/multirotor/add_drone.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import airsim
33
import tempfile
44
import os
5+
import random
56
import numpy as np
67
import cv2
78
import pprint
@@ -11,7 +12,7 @@
1112
client.confirmConnection()
1213

1314
# add new vehicle
14-
vehicle_name = "Drone2"
15+
vehicle_name = "Drone2" + str(random.randrange(100))
1516
pose = airsim.Pose(airsim.Vector3r(0, 0, 0), airsim.to_quaternion(0, 0, 0))
1617

1718
client.simAddVehicle(vehicle_name, "simpleflight", pose)

PythonClient/multirotor/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
# AirSim uses NED coordinates so negative axis is up.
3232
# z of -5 is 5 meters above the original launch point.
33-
z = -5
33+
z = -30
3434
print("make sure we are hovering at {} meters...".format(-z))
3535
client.moveToZAsync(z, 1).join()
3636

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
{
2-
"FileVersion": 3,
3-
"EngineAssociation": "5.1",
4-
"Category": "",
5-
"Description": "",
6-
"Modules": [
7-
{
8-
"Name": "Blocks",
9-
"Type": "Runtime",
10-
"LoadingPhase": "Default",
11-
"AdditionalDependencies": [
12-
"AirSim"
13-
]
14-
}
15-
],
16-
"Plugins": [
17-
{
18-
"Name": "AirSim",
19-
"Enabled": true
20-
},
21-
{
22-
"Name": "SteamVR",
23-
"Enabled": false
24-
},
25-
{
26-
"Name": "OculusVR",
27-
"Enabled": false
28-
}
29-
]
1+
{
2+
"FileVersion": 3,
3+
"EngineAssociation": "5.3",
4+
"Category": "",
5+
"Description": "",
6+
"Modules": [
7+
{
8+
"Name": "Blocks",
9+
"Type": "Runtime",
10+
"LoadingPhase": "Default",
11+
"AdditionalDependencies": [
12+
"AirSim"
13+
]
14+
}
15+
],
16+
"Plugins": [
17+
{
18+
"Name": "AirSim",
19+
"Enabled": true
20+
},
21+
{
22+
"Name": "SteamVR",
23+
"Enabled": false
24+
},
25+
{
26+
"Name": "OculusVR",
27+
"Enabled": false
28+
}
29+
]
3030
}

Unreal/Environments/Blocks/Config/DefaultEditor.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ bReplaceBlueprintWithClass= true
77
bDontLoadBlueprintOutsideEditor= true
88
bBlueprintIsNotBlueprintType= true
99

10+
[/Script/AdvancedPreviewScene.SharedProfiles]
1011

Unreal/Environments/Blocks/Config/DefaultEngine.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,17 @@ AsyncSceneSmoothingFactor=0.990000
6868
InitialAverageFrameRate=0.016667
6969
PhysXTreeRebuildRate=10
7070

71+
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
72+
bEnablePlugin=True
73+
bAllowNetworkConnection=True
74+
SecurityToken=811F8F1C4E41692A119A55BE04E6DB61
75+
bIncludeInShipping=False
76+
bAllowExternalStartInShipping=False
77+
bCompileAFSProject=False
78+
bUseCompression=False
79+
bLogFiles=False
80+
bReportStats=False
81+
ConnectionType=USBOnly
82+
bUseManualIPAddress=False
83+
ManualIPAddress=
7184

0 commit comments

Comments
 (0)