@@ -110,7 +110,7 @@ def simContinueForTime(self, seconds):
110
110
seconds (float): Time to run the simulation for
111
111
"""
112
112
self .client .call ('simContinueForTime' , seconds )
113
-
113
+
114
114
def simContinueForFrames (self , frames ):
115
115
"""
116
116
Continue (or resume if paused) the simulation for the specified number of frames, after which the simulation will be paused.
@@ -158,6 +158,19 @@ def confirmConnection(self):
158
158
print (ver_info )
159
159
print ('' )
160
160
161
+ def simSetLightIntensity (self , light_name , intensity ):
162
+ """
163
+ Change intensity of named light
164
+
165
+ Args:
166
+ light_name (str): Name of light to change
167
+ intensity (float): New intensity value
168
+
169
+ Returns:
170
+ bool: True if successful, otherwise False
171
+ """
172
+ return self .client .call ("simSetLightIntensity" , light_name , intensity )
173
+
161
174
def simSwapTextures (self , tags , tex_id = 0 , component_id = 0 , material_id = 0 ):
162
175
"""
163
176
Runtime Swap Texture API
@@ -178,6 +191,35 @@ def simSwapTextures(self, tags, tex_id = 0, component_id = 0, material_id = 0):
178
191
return self .client .call ("simSwapTextures" , tags , tex_id , component_id , material_id )
179
192
180
193
#time - of - day control
194
+ def simSetObjectMaterial (self , object_name , material_name ):
195
+ """
196
+ Runtime Swap Texture API
197
+ See https://microsoft.github.io/AirSim/retexturing/ for details
198
+ Args:
199
+ object_name (str): name of object to set material for
200
+ material_name (str): name of material to set for object
201
+
202
+ Returns:
203
+ bool: True if material was set
204
+ """
205
+ return self .client .call ("simSetObjectMaterial" , object_name , material_name )
206
+
207
+ def simSetObjectMaterialFromTexture (self , object_name , texture_path ):
208
+ """
209
+ Runtime Swap Texture API
210
+ See https://microsoft.github.io/AirSim/retexturing/ for details
211
+ Args:
212
+ object_name (str): name of object to set material for
213
+ texture_path (str): path to texture to set for object
214
+
215
+ Returns:
216
+ bool: True if material was set
217
+ """
218
+ return self .client .call ("simSetObjectMaterialFromTexture" , object_name , texture_path )
219
+
220
+
221
+ # time-of-day control
222
+
181
223
def simSetTimeOfDay (self , is_enabled , start_datetime = "" , is_start_datetime_dst = False , celestial_clock_speed = 1 , update_interval_secs = 60 , move_sun = True ):
182
224
"""
183
225
Control the position of Sun in the environment
@@ -333,6 +375,7 @@ def simGetCurrentFieldOfView(self, camera_name, vehicle_name = '', external = Fa
333
375
return result
334
376
335
377
#End CinemAirSim
378
+
336
379
def simTestLineOfSightToPoint (self , point , vehicle_name = '' ):
337
380
"""
338
381
Returns whether the target point is visible from the perspective of the inputted vehicle
@@ -345,7 +388,7 @@ def simTestLineOfSightToPoint(self, point, vehicle_name = ''):
345
388
[bool]: Success
346
389
"""
347
390
return self .client .call ('simTestLineOfSightToPoint' , point , vehicle_name )
348
-
391
+
349
392
def simTestLineOfSightBetweenPoints (self , point1 , point2 ):
350
393
"""
351
394
Returns whether the target point is visible from the perspective of the source point
@@ -358,7 +401,7 @@ def simTestLineOfSightBetweenPoints(self, point1, point2):
358
401
[bool]: Success
359
402
"""
360
403
return self .client .call ('simTestLineOfSightBetweenPoints' , point1 , point2 )
361
-
404
+
362
405
def simGetWorldExtents (self ):
363
406
"""
364
407
Returns a list of GeoPoints representing the minimum and maximum extents of the world
@@ -510,7 +553,7 @@ def simListSceneObjects(self, name_regex = '.*'):
510
553
list[str]: List containing all the names
511
554
"""
512
555
return self .client .call ('simListSceneObjects' , name_regex )
513
-
556
+
514
557
def simLoadLevel (self , level_name ):
515
558
"""
516
559
Loads a level specified by its name
@@ -523,26 +566,37 @@ def simLoadLevel(self, level_name):
523
566
"""
524
567
return self .client .call ('simLoadLevel' , level_name )
525
568
526
- def simSpawnObject (self , object_name , asset_name , pose , scale , physics_enabled = False ):
569
+ def simListAssets (self ):
570
+ """
571
+ Lists all the assets present in the Asset Registry
572
+
573
+ Returns:
574
+ list[str]: Names of all the assets
575
+ """
576
+ return self .client .call ('simListAssets' )
577
+
578
+ def simSpawnObject (self , object_name , asset_name , pose , scale , physics_enabled = False , is_blueprint = False ):
527
579
"""Spawned selected object in the world
528
-
580
+
529
581
Args:
530
582
object_name (str): Desired name of new object
531
583
asset_name (str): Name of asset(mesh) in the project database
532
584
pose (airsim.Pose): Desired pose of object
533
585
scale (airsim.Vector3r): Desired scale of object
534
-
586
+ physics_enabled (bool, optional): Whether to enable physics for the object
587
+ is_blueprint (bool, optional): Whether to spawn a blueprint or an actor
588
+
535
589
Returns:
536
590
str: Name of spawned object, in case it had to be modified
537
591
"""
538
- return self .client .call ('simSpawnObject' , object_name , asset_name , pose , scale , physics_enabled )
592
+ return self .client .call ('simSpawnObject' , object_name , asset_name , pose , scale , physics_enabled , is_blueprint )
539
593
540
594
def simDestroyObject (self , object_name ):
541
595
"""Removes selected object from the world
542
-
596
+
543
597
Args:
544
598
object_name (str): Name of object to be removed
545
-
599
+
546
600
Returns:
547
601
bool: True if object is queued up for removal
548
602
"""
@@ -592,7 +646,7 @@ def simAddDetectionFilterMeshName(self, camera_name, image_type, mesh_name, vehi
592
646
593
647
"""
594
648
self .client .call ('simAddDetectionFilterMeshName' , camera_name , image_type , mesh_name , vehicle_name , external )
595
-
649
+
596
650
def simSetDetectionFilterRadius (self , camera_name , image_type , radius_cm , vehicle_name = '' , external = False ):
597
651
"""
598
652
Set detection radius for all cameras
@@ -605,7 +659,7 @@ def simSetDetectionFilterRadius(self, camera_name, image_type, radius_cm, vehicl
605
659
external (bool, optional): Whether the camera is an External Camera
606
660
"""
607
661
self .client .call ('simSetDetectionFilterRadius' , camera_name , image_type , radius_cm , vehicle_name , external )
608
-
662
+
609
663
def simClearDetectionMeshNames (self , camera_name , image_type , vehicle_name = '' , external = False ):
610
664
"""
611
665
Clear all mesh names from detection filter
@@ -679,7 +733,7 @@ def simGetDistortionParams(self, camera_name, vehicle_name = '', external = Fals
679
733
Returns:
680
734
List (float): List of distortion parameter values corresponding to K1, K2, K3, P1, P2 respectively.
681
735
"""
682
-
736
+
683
737
return self .client .call ('simGetDistortionParams' , str (camera_name ), vehicle_name , external )
684
738
685
739
def simSetDistortionParams (self , camera_name , distortion_params , vehicle_name = '' , external = False ):
@@ -750,6 +804,19 @@ def simGetGroundTruthKinematics(self, vehicle_name = ''):
750
804
return KinematicsState .from_msgpack (kinematics_state )
751
805
simGetGroundTruthKinematics .__annotations__ = {'return' : KinematicsState }
752
806
807
+ def simSetKinematics (self , state , ignore_collision , vehicle_name = '' ):
808
+ """
809
+ Set the kinematics state of the vehicle
810
+
811
+ If you don't want to change position (or orientation) then just set components of position (or orientation) to floating point nan values
812
+
813
+ Args:
814
+ state (KinematicsState): Desired Pose pf the vehicle
815
+ ignore_collision (bool): Whether to ignore any collision or not
816
+ vehicle_name (str, optional): Name of the vehicle to move
817
+ """
818
+ self .client .call ('simSetKinematics' , state , ignore_collision , vehicle_name )
819
+
753
820
def simGetGroundTruthEnvironment (self , vehicle_name = '' ):
754
821
"""
755
822
Get ground truth environment state
@@ -988,7 +1055,7 @@ def simSetWind(self, wind):
988
1055
Set simulated wind, in World frame, NED direction, m/s
989
1056
990
1057
Args:
991
- wind (Vector3r): Wind, in World frame, NED direction, in m/s
1058
+ wind (Vector3r): Wind, in World frame, NED direction, in m/s
992
1059
"""
993
1060
self .client .call ('simSetWind' , wind )
994
1061
@@ -1152,6 +1219,10 @@ def moveToPositionAsync(self, x, y, z, velocity, timeout_sec = 3e+38, drivetrain
1152
1219
lookahead = - 1 , adaptive_lookahead = 1 , vehicle_name = '' ):
1153
1220
return self .client .call_async ('moveToPosition' , x , y , z , velocity , timeout_sec , drivetrain , yaw_mode , lookahead , adaptive_lookahead , vehicle_name )
1154
1221
1222
+ def moveToGPSAsync (self , latitude , longitude , altitude , velocity , timeout_sec = 3e+38 , drivetrain = DrivetrainType .MaxDegreeOfFreedom , yaw_mode = YawMode (),
1223
+ lookahead = - 1 , adaptive_lookahead = 1 , vehicle_name = '' ):
1224
+ return self .client .call_async ('moveToGPS' , latitude , longitude , altitude , velocity , timeout_sec , drivetrain , yaw_mode , lookahead , adaptive_lookahead , vehicle_name )
1225
+
1155
1226
def moveToZAsync (self , z , velocity , timeout_sec = 3e+38 , yaw_mode = YawMode (), lookahead = - 1 , adaptive_lookahead = 1 , vehicle_name = '' ):
1156
1227
return self .client .call_async ('moveToZ' , z , velocity , timeout_sec , yaw_mode , lookahead , adaptive_lookahead , vehicle_name )
1157
1228
@@ -1243,7 +1314,7 @@ def moveByRollPitchYawZAsync(self, roll, pitch, yaw, z, duration, vehicle_name =
1243
1314
def moveByRollPitchYawThrottleAsync (self , roll , pitch , yaw , throttle , duration , vehicle_name = '' ):
1244
1315
"""
1245
1316
- Desired throttle is between 0.0 to 1.0
1246
- - Roll angle, pitch angle, and yaw angle are given in **radians**, in the body frame.
1317
+ - Roll angle, pitch angle, and yaw angle are given in **degrees** when using PX4 and in ** radians** when using SimpleFlight , in the body frame.
1247
1318
- The body frame follows the Front Left Up (FLU) convention, and right-handedness.
1248
1319
1249
1320
- Frame Convention:
@@ -1263,9 +1334,9 @@ def moveByRollPitchYawThrottleAsync(self, roll, pitch, yaw, throttle, duration,
1263
1334
| Hence, yawing with a positive angle is equivalent to rotated towards the **left** direction wrt our FLU body frame. Or in an anticlockwise fashion in the body XY / FL plane.
1264
1335
1265
1336
Args:
1266
- roll (float): Desired roll angle, in radians .
1267
- pitch (float): Desired pitch angle, in radians .
1268
- yaw (float): Desired yaw angle, in radians .
1337
+ roll (float): Desired roll angle.
1338
+ pitch (float): Desired pitch angle.
1339
+ yaw (float): Desired yaw angle.
1269
1340
throttle (float): Desired throttle (between 0.0 to 1.0)
1270
1341
duration (float): Desired amount of time (seconds), to send this command for
1271
1342
vehicle_name (str, optional): Name of the multirotor to send this command to
0 commit comments