Skip to content

Commit

Permalink
add PID script
Browse files Browse the repository at this point in the history
  • Loading branch information
AOS55 committed Oct 2, 2023
1 parent 6229538 commit 72105e6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/pid_control.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import gymnasium as gym
import numpy as np

def main():

env_config = {
"duration": 10.0,
"action": {
"type": "PursuitAction"
}
}

env = gym.make("flyer-v1", config=env_config, render_mode="rgb_array")

obs, info = env.reset()
observations = []
terminated = truncated = False
goal = env.unwrapped.goal

while not (terminated or truncated):
action = {"goal_pos": goal[0:2], "other_controls": np.array([goal[-1]/10000, 100.0/300.0])}
obs, reward, terminated, truncated, info = env.step(action)
env.close()

if __name__=="__main__":
main()

0 comments on commit 72105e6

Please sign in to comment.