-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrl_hover.py
41 lines (38 loc) · 1.49 KB
/
rl_hover.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# We'll use a normal Proximal Policy Optimization reinforcement learning algorithm
# and for this we'll use stable-baselines3 lib.
# PPO:
from isaacsim import SimulationApp
simulation_app = SimulationApp({"headless": False})
#this is needed as other apps
import omni.timeline
from omni.isaac.core.world import World
from pegasus.simulator.params import ROBOTS, SIMULATION_ENVIRONMENTS
from pegasus.simulator.logic.vehicles.multirotor import Multirotor, MultirotorConfig
from pegasus.simulator.logic.interface.pegasus_interface import PegasusInterface
from scipy.spatial.transform import Rotation
class PegasusApp:
def __init__(self):
self.timeline = omni.timeline.get_timeline_interface()
self.pg = PegasusInterface()
self.pg._world = World(**self.pg._world_settings)
self.world = self.pg.world
self.pg.load_environment(SIMULATION_ENVIRONMENTS["Default Environment"])
config_multirotor = MultirotorConfig()
Multirotor(
"/World/quadrotor",
ROBOTS['Iris'],
0,
[0.0, 0.0, 0.07],
Rotation.from_euler("XYZ", [0.0, 0.0, 0.0], degrees=True).as_quat(),
config=config_multirotor,
)
self.world.reset()
self.stop_sim = False
def run(self):
self.timeline.play()
while simulation_app.is_running() and not self.stop_sim:
self.world.step(render=True)
self.timeline.stop()
simulation_app.close()
pg_app = PegasusApp()
pg_app.run()