Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OUTDATED Verse-library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AutonomyCourse_ECEIllinois
OUTDATED Verse-library
Commits
6a2f7527
Commit
6a2f7527
authored
2 years ago
by
sayanmitracode
Browse files
Options
Downloads
Patches
Plain Diff
states added for f16
parent
ce3385e6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
demo/F16/F16_waypoint_scene.py
+42
-0
42 additions, 0 deletions
demo/F16/F16_waypoint_scene.py
demo/F16/aerobench/run_f16_sim.py
+1
-1
1 addition, 1 deletion
demo/F16/aerobench/run_f16_sim.py
with
43 additions
and
1 deletion
demo/F16/F16_waypoint_scene.py
+
42
−
0
View file @
6a2f7527
...
@@ -8,6 +8,7 @@ from typing import Tuple, List
...
@@ -8,6 +8,7 @@ from typing import Tuple, List
import
numpy
as
np
import
numpy
as
np
from
scipy.integrate
import
ode
from
scipy.integrate
import
ode
from
enum
import
Enum
,
auto
from
dryvr_plus_plus.scene_verifier.agents.base_agent
import
BaseAgent
from
dryvr_plus_plus.scene_verifier.agents.base_agent
import
BaseAgent
from
dryvr_plus_plus.scene_verifier.map.lane_map
import
LaneMap
from
dryvr_plus_plus.scene_verifier.map.lane_map
import
LaneMap
...
@@ -25,6 +26,46 @@ from aerobench.visualize import plot
...
@@ -25,6 +26,46 @@ from aerobench.visualize import plot
from
waypoint_autopilot
import
WaypointAutopilot
from
waypoint_autopilot
import
WaypointAutopilot
class
F16Mode
(
Enum
):
'''
Defines the discrete modes of a single agent
'''
Normal
=
auto
()
# TODO: The one mode of this automation is called "Normal" and auto assigns it an integer value.
class
State
:
'''
Defines the state variables of the model
Both discrete and continuous variables.
Initial values defined here do not matter.
'''
mode
:
F16Mode
### Continuous variable initial conditions ###
power
=
9
# engine power level (0-10)
# Default alpha & beta
alpha
=
deg2rad
(
2.1215
)
# Trim Angle of Attack (rad)
beta
=
0
# Side slip angle (rad)
# Initial Attitude
alt
=
3800
# altitude (ft)
vt
=
540
# initial velocity (ft/sec)
phi
=
0
# Roll angle from wings level (rad)
theta
=
0
# Pitch angle from nose level (rad)
psi
=
math
.
pi
/
8
# Yaw angle from North (rad)
P
=
0
Q
=
0
R
=
0
pn
=
0
pe
=
0
# Build Initial Condition Vectors
# state = [vt, alpha, beta, phi, theta, psi, P, Q, R, pn, pe, h, pow]
init
=
[
vt
,
alpha
,
beta
,
phi
,
theta
,
psi
,
0
,
0
,
0
,
0
,
0
,
alt
,
power
]
def
__init__
(
self
,
vt
,
alpha
,
beta
,
phi
,
theta
,
psi
,
P
,
Q
,
R
,
pn
,
pe
,
alt
,
power
,
mode
:
F16Mode
):
pass
def
main
():
def
main
():
'
main function
'
'
main function
'
...
@@ -61,6 +102,7 @@ def main():
...
@@ -61,6 +102,7 @@ def main():
step
=
1
/
30
step
=
1
/
30
extended_states
=
True
extended_states
=
True
'''
Main call to simulation
'''
res
=
run_f16_sim
(
init
,
tmax
,
ap
,
step
=
step
,
extended_states
=
extended_states
,
integrator_str
=
'
rk45
'
)
res
=
run_f16_sim
(
init
,
tmax
,
ap
,
step
=
step
,
extended_states
=
extended_states
,
integrator_str
=
'
rk45
'
)
print
(
f
"
Simulation Completed in
{
round
(
res
[
'
runtime
'
],
2
)
}
seconds (extended_states=
{
extended_states
}
)
"
)
print
(
f
"
Simulation Completed in
{
round
(
res
[
'
runtime
'
],
2
)
}
seconds (extended_states=
{
extended_states
}
)
"
)
...
...
This diff is collapsed.
Click to expand it.
demo/F16/aerobench/run_f16_sim.py
+
1
−
1
View file @
6a2f7527
...
@@ -20,7 +20,7 @@ class F16Agent(BaseAgent):
...
@@ -20,7 +20,7 @@ class F16Agent(BaseAgent):
'''
Dynamics of an F16 aircraft
'''
Dynamics of an F16 aircraft
derived from Stanley Bak
'
s python library
'''
derived from Stanley Bak
'
s python library
'''
def
__init__
(
self
,
id
,
code
=
None
,
file_name
=
None
):
def
__init__
(
self
,
id
,
code
=
None
,
file_name
=
None
):
'''
Contructor for
tha
agent
'''
Contructor for
one F16
agent
EXACTLY one of the following should be given
EXACTLY one of the following should be given
file_name: name of the controller
file_name: name of the controller
code: pyhton string ddefning the controller
code: pyhton string ddefning the controller
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment