Skip to content

Commit

Permalink
added stress_test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Nov 28, 2017
1 parent 1dd5956 commit a2d81ff
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 4 deletions.
11 changes: 7 additions & 4 deletions PythonClient/PythonClient.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>e2049e20-b6dd-474e-8bca-1c8dc54725aa</ProjectGuid>
<ProjectHome>.</ProjectHome>
<StartupFile>segmentation.py</StartupFile>
<StartupFile>hello_car.py</StartupFile>
<SearchPath>
</SearchPath>
<WorkingDirectory>.</WorkingDirectory>
Expand Down Expand Up @@ -39,6 +39,9 @@
<Compile Include="drive_straight.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="drone_stress_test.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="seg_pallete.py">
<SubType>Code</SubType>
</Compile>
Expand All @@ -48,9 +51,6 @@
<Compile Include="hello_drone.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="infrared.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="navigate.py">
<SubType>Code</SubType>
</Compile>
Expand All @@ -62,6 +62,9 @@
<Compile Include="segmentation.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="car_stress_test.py">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<InterpreterReference Include="{9a7a9026-48c1-4688-9d5d-e5699d47d074}\3.5" />
Expand Down
48 changes: 48 additions & 0 deletions PythonClient/car_stress_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from AirSimClient import *

# connect to the AirSim simulator
client = CarClient()
client.confirmConnection()
client.enableApiControl(True)
car_controls = CarControls()

for idx in xrange(3000):
# get state of the car
car_state = client.getCarState()
print("Speed %d, Gear %d" % (car_state.speed, car_state.gear))

# go forward
car_controls.throttle = 0.5
car_controls.steering = 0
client.setCarControls(car_controls)
time.sleep(0.1) # let car drive a bit

# Go forward + steer right
car_controls.throttle = 0.5
car_controls.steering = 1
client.setCarControls(car_controls)
time.sleep(0.1) # let car drive a bit

# go reverse
car_controls.throttle = -0.5
car_controls.is_manual_gear = True;
car_controls.manual_gear = -1
car_controls.steering = 0
client.setCarControls(car_controls)
time.sleep(0.1) # let car drive a bit
car_controls.is_manual_gear = False; # change back gear to auto
car_controls.manual_gear = 0

# apply breaks
car_controls.brake = 1
client.setCarControls(car_controls)
time.sleep(0.1) # let car drive a bit
car_controls.brake = 0 #remove break

#restore to original state
client.reset()

client.enableApiControl(False)



17 changes: 17 additions & 0 deletions PythonClient/drone_stress_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from AirSimClient import *

# connect to the AirSim simulator
client = MultirotorClient()
client.confirmConnection()
client.enableApiControl(True)
client.armDisarm(True)


for idx in range(3000):
client.moveToPosition(-10, 10, -10, 5)
client.reset()
client.enableApiControl(True)
print("%d" % idx)

# that's enough fun for now. let's quite cleanly
client.enableApiControl(False)

0 comments on commit a2d81ff

Please sign in to comment.