Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency between state and self.ControlParameters.state14 #12

Open
rizwan-malik opened this issue Sep 19, 2021 · 1 comment
Open

Comments

@rizwan-malik
Copy link

While trying to understand the workings of the code and writing an agent myself, I noticed certain inconsistencies in the parameters defined in parameters.py file and value assignment to those variables in xplane_envBase.py file.
In Line 14 of parameters.py file state14 is defined as:
"state14" :{"roll_rate" :0 ,"pitch_rate" :0, "altitude": 0 ,"Pitch" :0 ,"Roll" :0, "velocity_x": 0, "velocity_y" :0 ,"velocity_z" :0 ,"delta_altitude" :0, "delta_heading" :0 ,"yaw_rate" :0},

then on Line 139 of xplane_envBase.py the variable state is assigned:

state = self.ControlParameters.stateAircraftPosition + self.ControlParameters.stateVariableValue

stateAircraftPosition is retrieved from XPlane Connect's getPOSI() function which returns these values : [Lat, Lon, Alt, Pitch, Roll, Yaw, Gear]

and stateVariableValue containes values for these drefs:

"stateVariable" : ["sim/flightmodel/position/local_vx" ,"sim/flightmodel/position/local_vy", "sim/flightmodel/position/local_vz"],

so, essentially the list 'state' contains following variables:
state = [Lat, Lon, Alt, Pitch, Roll, Yaw, Gear, local_vx, local_vy, local_vz]

However, when we look at assignments in Line 175, 176 and 177 of xplane_envBase.py file it can be noted that

  1. state14['velocity_x'] = state[6] whereas state[6] = Gear
  2. state14['velocity_y'] = state[6] whereas state[6] = local_vx
  3. state14['velocity_z'] = state[6] whereas state[6] = local_vy

So, I don't know if I am missing on something or what, but this should have a major impact on training.

@adderbyte
Copy link
Owner

adderbyte commented Sep 28, 2021

Hi,
You could adapt the state parameters to suit the scenario you are trying to train. For example gear might not be needed for a point to point navigation but for landing it would be essential. Since I played with different training scenario it might be possible I changed it along the line.

Your observation is perhaps correct. You meant the indices should be 7, 8 and 9 correcponding to local_vx ,local_vy and local_vz. Additional data refs are defined here for position and velocity and are in fact well explained.

Thank you for the observation.

Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants